Rikkje
14-11-2006 22:32:27
Hi people
I have a little problem with a little game i am building using vc8 pro
The problem has something to do with: setShadowTechnique
I have searched for days for a solution but just didn't found it anyware
My script looks as follow:
It works if i let this part out:
mSceneMgr->setShadowTechnique( SHADOWTYPE_STENCIL_ADDITIVE );
And the error says the following:
Run-Time Check Failure #1 - A cast to a smaller data type has caused a loss of data. If this was intentional, you should mask the source of the cast with the appropriate bitmask. For example:
char c = (i & +xFF);
Changing the code in this way wil not effect the quality of the resulting optimized code.
Thats the error
I hope someone can help me with this ...
Greetzz Rikkje
I have a little problem with a little game i am building using vc8 pro
The problem has something to do with: setShadowTechnique
I have searched for days for a solution but just didn't found it anyware
My script looks as follow:
#include ".\ogrenewtapplication.h"
#include <OgreNewt.h>
OgreNewtApplication::OgreNewtApplication(void)
{
mWorld = new OgreNewt::World();
}
OgreNewtApplication::~OgreNewtApplication(void)
{
delete mWorld;
}
void OgreNewtApplication::createScene()
{
mSceneMgr->setAmbientLight( ColourValue( 1, 4, 1 ) );
mSceneMgr->setShadowTechnique( SHADOWTYPE_STENCIL_ADDITIVE );
////////////////////////////////////////////////////////////////////////////////
// make immobile floor element.
Ogre::Vector3 size(1.0,1.0,1.0);
Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
Ogre::Entity* ent = mSceneMgr->createEntity( "floorobj", "plane.mesh" );
node->attachObject( ent );
node->setScale( size );
OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::TreeCollision( mWorld, node , true );
OgreNewt::Body* floorbody = new OgreNewt::Body( mWorld, col );
floorbody->attachToNode( node );
floorbody->setPositionOrientation( Ogre::Vector3(0,-200,0), Ogre::Quaternion::IDENTITY );
ent->setMaterialName( "Material/SOLID/TEX/grass.png" );
ent->setNormaliseNormals(true);
delete col;
// CYLINDER BODY
// cylinder with a radius of 0.5, height of 1.3
size = Ogre::Vector3( 1.3, 0.5, 0.5 );
node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
ent = mSceneMgr->createEntity("cylinder_body", "cylinder.mesh" );
node->attachObject( ent );
node->setScale( size );
// rigid body.
col = new OgreNewt::CollisionPrimitives::Cylinder( mWorld, 0.5, 1.3 );
OgreNewt::Body* bod = new OgreNewt::Body( mWorld, col );
bod->attachToNode( node );
// initial position
bod->setPositionOrientation( Ogre::Vector3(-2,3,2), Ogre::Quaternion::IDENTITY );
delete col;
Ogre::Real mass = 10.0;
Ogre::Vector3 inertia = OgreNewt::MomentOfInertia::CalcCylinderSolid( mass, 0.5, 1.3 );
bod->setMassMatrix( mass, inertia );
bod->setStandardForceCallback();
// CONE BODY
// cone with a radius of 0.8, height of 1.0
size = Ogre::Vector3( 1.0, 0.8, 0.8 );
node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
ent = mSceneMgr->createEntity("cone_body", "cone.mesh" );
node->attachObject( ent );
node->setScale( size );
// rigid body.
col = new OgreNewt::CollisionPrimitives::Cone( mWorld, 0.8, 1.0 );
bod = new OgreNewt::Body( mWorld, col );
bod->attachToNode( node );
// initial position
bod->setPositionOrientation( Ogre::Vector3(2,3,2), Ogre::Quaternion::IDENTITY );
delete col;
mass = 10.0;
inertia = OgreNewt::MomentOfInertia::CalcCylinderSolid( mass, 0.5, 1.3 );
bod->setMassMatrix( mass, inertia );
bod->setStandardForceCallback();
// BOX BODY
// standard 1x1x1 cube.
size = Ogre::Vector3( 1, 1, 1 );
node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
ent = mSceneMgr->createEntity("box_body", "box.mesh" );
node->attachObject( ent );
node->setScale( size );
// rigid body.
col = new OgreNewt::CollisionPrimitives::Box( mWorld, size );
bod = new OgreNewt::Body( mWorld, col );
bod->attachToNode( node );
// initial position
bod->setPositionOrientation( Ogre::Vector3(0,3,-2), Ogre::Quaternion::IDENTITY );
delete col;
mass = 10.0;
inertia = OgreNewt::MomentOfInertia::CalcBoxSolid( mass, size );
bod->setMassMatrix( mass, inertia );
bod->setStandardForceCallback();
////////////////////////////////////////////////////////////////////////////////
// create a light for the scene
Ogre::Light* light = mSceneMgr->createLight("light");
light->setPosition( Ogre::Vector3(0,15,5) );
light->setType( Ogre::Light::LT_POINT );
// position and point the camera
mCamera->setPosition( Ogre::Vector3( 0, 2, 10) );
mCamera->lookAt( Ogre::Vector3(0,0,0) );
}
void OgreNewtApplication::createFrameListener()
{
mFrameListener = new ExampleFrameListener( mWindow, mCamera );
mRoot->addFrameListener( mFrameListener );
mOgreNewtListener = new OgreNewt::BasicFrameListener( mWindow, mSceneMgr, mWorld, 120 );
mRoot->addFrameListener( mOgreNewtListener );
}
It works if i let this part out:
mSceneMgr->setShadowTechnique( SHADOWTYPE_STENCIL_ADDITIVE );
And the error says the following:
Run-Time Check Failure #1 - A cast to a smaller data type has caused a loss of data. If this was intentional, you should mask the source of the cast with the appropriate bitmask. For example:
char c = (i & +xFF);
Changing the code in this way wil not effect the quality of the resulting optimized code.
Thats the error
I hope someone can help me with this ...
Greetzz Rikkje