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
inline void recalculateBoundingBox();
//! update the given state's matrix
void setTransformState( video::E_TRANSFORMATION_STATE state);
//! the position of the camera
@ -313,21 +314,19 @@ namespace scene
recalculateBoundingBox();
}
inline void SViewFrustum::setTransformState( video::E_TRANSFORMATION_STATE state)
inline void SViewFrustum::setTransformState(video::E_TRANSFORMATION_STATE state)
{
switch ( state )
{
case video::ETS_VIEW:
Matrices[ETS_VIEW_PROJECTION_3].setbyproduct_nocheck ( Matrices[ video::ETS_PROJECTION],
Matrices[ video::ETS_VIEW]
);
Matrices[ETS_VIEW_MODEL_INVERSE_3] = Matrices[ video::ETS_VIEW];
Matrices[ETS_VIEW_PROJECTION_3].setbyproduct_nocheck( Matrices[ video::ETS_PROJECTION], Matrices[ video::ETS_VIEW] );
Matrices[ETS_VIEW_MODEL_INVERSE_3] = Matrices[video::ETS_VIEW];
Matrices[ETS_VIEW_MODEL_INVERSE_3].makeInverse();
break;
case video::ETS_WORLD:
Matrices[ETS_CURRENT_3].setbyproduct ( Matrices[ ETS_VIEW_PROJECTION_3 ],
Matrices[ video::ETS_WORLD] );
Matrices[ETS_CURRENT_3].setbyproduct( Matrices[ETS_VIEW_PROJECTION_3],
Matrices[video::ETS_WORLD]);
break;
default:
break;

View File

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

View File

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

View File

@ -215,8 +215,6 @@ bool CQuake3ShaderSceneNode::isTransparent ()
}
else
{
video::IVideoDriver* driver = SceneManager->getVideoDriver();
for ( u32 stage = 0; stage < Shader->VarGroup->VariableGroup.size (); ++stage )
{
if ( 0 == Q3Texture [ stage].Texture.size() )
@ -258,7 +256,7 @@ void CQuake3ShaderSceneNode::render()
group = Shader->getGroup ( 1 );
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 );

View File

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

View File

@ -676,8 +676,7 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh)
const u32 nVertices = readInt();
// read vertices
mesh.Vertices.set_used(nVertices); //luke: change
mesh.Vertices.set_used(nVertices);
for (u32 n=0; n<nVertices; ++n)
{
readVector3(mesh.Vertices[n].Pos);
@ -738,12 +737,7 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh)
}
}
if (BinaryFormat && BinaryNumCount)
{
os::Printer::log("Binary X: Mesh: Integer count mismatch", ELL_WARNING);
return false;
}
else if (!checkForTwoFollowingSemicolons())
if (!checkForTwoFollowingSemicolons())
{
os::Printer::log("No finishing semicolon in Mesh Face Array found in x file", ELL_WARNING);
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
bool CXMeshFileLoader::readRGB(video::SColor& color)
{
color.setRed( (u32)(readFloat()*255)) ;
color.setGreen( (u32)(readFloat()*255)) ;
color.setBlue( (u32)(readFloat()*255)) ;
color.setRed( (u32)(readFloat()*255.f)) ;
color.setGreen( (u32)(readFloat()*255.f)) ;
color.setBlue( (u32)(readFloat()*255.f)) ;
color.setAlpha( 255 );
return checkForOneFollowingSemicolons();
}

View File

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

View File

@ -73,7 +73,7 @@ staticlib sharedlib : CXXINCS += -I/usr/X11R6/include
#Windows specific options
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
staticlib_win32: CPPFLAGS += -D_IRR_STATIC_LIB_

View File

@ -37,4 +37,4 @@ A) This disables the use of OpenGL extensions:
B) Replace all occurrences of 'glXGetProcAddress' with 'glXGetProcAddressARB' and run a
make
This will solve the issue but keep the OpenGL extension enabled.