Make use of core::IdentityMatrix. Removed some redundant or unused code. Some minor reorganizations.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1079 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2007-12-02 23:57:20 +00:00
parent a691540444
commit 29b968088a
9 changed files with 25 additions and 61 deletions

View File

@ -91,6 +91,7 @@ namespace scene
//! recalculates the bounding box member based on the planes //! recalculates the bounding box member based on the planes
inline void recalculateBoundingBox(); inline void recalculateBoundingBox();
//! update the given state's matrix
void setTransformState( video::E_TRANSFORMATION_STATE state); void setTransformState( video::E_TRANSFORMATION_STATE state);
//! the position of the camera //! the position of the camera
@ -318,9 +319,7 @@ namespace scene
switch ( state ) switch ( state )
{ {
case video::ETS_VIEW: case video::ETS_VIEW:
Matrices[ETS_VIEW_PROJECTION_3].setbyproduct_nocheck ( Matrices[ video::ETS_PROJECTION], Matrices[ETS_VIEW_PROJECTION_3].setbyproduct_nocheck( Matrices[ video::ETS_PROJECTION], Matrices[ video::ETS_VIEW] );
Matrices[ video::ETS_VIEW]
);
Matrices[ETS_VIEW_MODEL_INVERSE_3] = Matrices[video::ETS_VIEW]; Matrices[ETS_VIEW_MODEL_INVERSE_3] = Matrices[video::ETS_VIEW];
Matrices[ETS_VIEW_MODEL_INVERSE_3].makeInverse(); Matrices[ETS_VIEW_MODEL_INVERSE_3].makeInverse();
break; break;

View File

@ -108,8 +108,7 @@ void CBillboardSceneNode::render()
driver->draw3DBox(BBox, video::SColor(0,208,195,152)); driver->draw3DBox(BBox, video::SColor(0,208,195,152));
} }
core::matrix4 mat; driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
driver->setTransform(video::ETS_WORLD, mat);
driver->setMaterial(Material); driver->setMaterial(Material);

View File

@ -730,9 +730,9 @@ void CGUIContextMenu::setEventParent(IGUIElement *parent)
bool CGUIContextMenu::hasOpenSubMenu() const bool CGUIContextMenu::hasOpenSubMenu() const
{ {
for (u32 i=0; i<Items.size(); ++i) for (u32 i=0; i<Items.size(); ++i)
if (Items[i].SubMenu) if (Items[i].SubMenu && Items[i].SubMenu->isVisible())
if ( Items[i].SubMenu->isVisible() )
return true; return true;
return false; return false;
} }

View File

@ -215,8 +215,6 @@ bool CQuake3ShaderSceneNode::isTransparent ()
} }
else else
{ {
video::IVideoDriver* driver = SceneManager->getVideoDriver();
for ( u32 stage = 0; stage < Shader->VarGroup->VariableGroup.size (); ++stage ) for ( u32 stage = 0; stage < Shader->VarGroup->VariableGroup.size (); ++stage )
{ {
if ( 0 == Q3Texture [ stage].Texture.size() ) if ( 0 == Q3Texture [ stage].Texture.size() )
@ -258,7 +256,7 @@ void CQuake3ShaderSceneNode::render()
group = Shader->getGroup ( 1 ); group = Shader->getGroup ( 1 );
material.BackfaceCulling = quake3::isDisabled ( group->get ( "cull" ) ); material.BackfaceCulling = quake3::isDisabled ( group->get ( "cull" ) );
u32 zEnable = group->getIndex ( "polygonoffset" ) >= 0; // u32 zEnable = group->getIndex ( "polygonoffset" ) >= 0;
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation ); driver->setTransform(video::ETS_WORLD, AbsoluteTransformation );

View File

@ -1146,14 +1146,13 @@ void CSceneManager::drawAll()
video::IVideoDriver* driver = getVideoDriver(); video::IVideoDriver* driver = getVideoDriver();
if ( driver ) if ( driver )
{ {
core::matrix4 identity; driver->setTransform ( video::ETS_PROJECTION, core::IdentityMatrix );
driver->setTransform ( video::ETS_PROJECTION, identity ); driver->setTransform ( video::ETS_VIEW, core::IdentityMatrix );
driver->setTransform ( video::ETS_VIEW, identity ); driver->setTransform ( video::ETS_WORLD, core::IdentityMatrix );
driver->setTransform ( video::ETS_WORLD, identity ); driver->setTransform ( video::ETS_TEXTURE_0, core::IdentityMatrix );
driver->setTransform ( video::ETS_TEXTURE_0, identity ); driver->setTransform ( video::ETS_TEXTURE_1, core::IdentityMatrix );
driver->setTransform ( video::ETS_TEXTURE_1, identity ); driver->setTransform ( video::ETS_TEXTURE_2, core::IdentityMatrix );
driver->setTransform ( video::ETS_TEXTURE_2, identity ); driver->setTransform ( video::ETS_TEXTURE_3, core::IdentityMatrix );
driver->setTransform ( video::ETS_TEXTURE_3, identity );
} }
// do animations and other stuff. // do animations and other stuff.

View File

@ -676,8 +676,7 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh)
const u32 nVertices = readInt(); const u32 nVertices = readInt();
// read vertices // read vertices
mesh.Vertices.set_used(nVertices); //luke: change mesh.Vertices.set_used(nVertices);
for (u32 n=0; n<nVertices; ++n) for (u32 n=0; n<nVertices; ++n)
{ {
readVector3(mesh.Vertices[n].Pos); readVector3(mesh.Vertices[n].Pos);
@ -738,12 +737,7 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh)
} }
} }
if (BinaryFormat && BinaryNumCount) if (!checkForTwoFollowingSemicolons())
{
os::Printer::log("Binary X: Mesh: Integer count mismatch", ELL_WARNING);
return false;
}
else if (!checkForTwoFollowingSemicolons())
{ {
os::Printer::log("No finishing semicolon in Mesh Face Array found in x file", ELL_WARNING); os::Printer::log("No finishing semicolon in Mesh Face Array found in x file", ELL_WARNING);
return false; return false;
@ -2059,34 +2053,12 @@ bool CXMeshFileLoader::readVector3(core::vector3df& vec)
} }
// read color without alpha value. Stops after second semicolon after blue value
bool CXMeshFileLoader::readRGB(video::SColorf& color)
{
color.r = readFloat();
color.g = readFloat();
color.b = readFloat();
color.a = 1.0f;
return checkForOneFollowingSemicolons();
}
// read color with alpha value. Stops after second semicolon after blue value
bool CXMeshFileLoader::readRGBA(video::SColorf& color)
{
color.r = readFloat();
color.g = readFloat();
color.b = readFloat();
color.a = readFloat();
return checkForOneFollowingSemicolons();
}
// read color without alpha value. Stops after second semicolon after blue value // read color without alpha value. Stops after second semicolon after blue value
bool CXMeshFileLoader::readRGB(video::SColor& color) bool CXMeshFileLoader::readRGB(video::SColor& color)
{ {
color.setRed( (u32)(readFloat()*255)) ; color.setRed( (u32)(readFloat()*255.f)) ;
color.setGreen( (u32)(readFloat()*255)) ; color.setGreen( (u32)(readFloat()*255.f)) ;
color.setBlue( (u32)(readFloat()*255)) ; color.setBlue( (u32)(readFloat()*255.f)) ;
color.setAlpha( 255 ); color.setAlpha( 255 );
return checkForOneFollowingSemicolons(); return checkForOneFollowingSemicolons();
} }

View File

@ -161,9 +161,6 @@ private:
f32 readFloat(); f32 readFloat();
bool readVector2(core::vector2df& vec); bool readVector2(core::vector2df& vec);
bool readVector3(core::vector3df& vec); bool readVector3(core::vector3df& vec);
bool readRGB(video::SColorf& color);
bool readRGBA(video::SColorf& color);
bool readRGB(video::SColor& color); bool readRGB(video::SColor& color);
bool readRGBA(video::SColor& color); bool readRGBA(video::SColor& color);

View File

@ -73,7 +73,7 @@ staticlib sharedlib : CXXINCS += -I/usr/X11R6/include
#Windows specific options #Windows specific options
sharedlib_win32 staticlib_win32: SYSTEM = Win32-gcc sharedlib_win32 staticlib_win32: SYSTEM = Win32-gcc
sharedlib_win32: LDFLAGS = -lgdi32 -lopengl32 -ld3dx9d -lSDL sharedlib_win32: LDFLAGS = -lgdi32 -lopengl32 -ld3dx9d
sharedlib_win32 staticlib_win32: CPPFLAGS += -DIRR_COMPILE_WITH_DX9_DEV_PACK -D__GNUWIN32__ -D_WIN32 -DWIN32 -D_WINDOWS -D_MBCS -D_USRDLL sharedlib_win32 staticlib_win32: CPPFLAGS += -DIRR_COMPILE_WITH_DX9_DEV_PACK -D__GNUWIN32__ -D_WIN32 -DWIN32 -D_WINDOWS -D_MBCS -D_USRDLL
staticlib_win32: CPPFLAGS += -D_IRR_STATIC_LIB_ staticlib_win32: CPPFLAGS += -D_IRR_STATIC_LIB_