Commit b1f728db authored by hybrid's avatar hybrid

Merge the UserClipPlane elements into a common struct.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2886 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 559cdaeb
...@@ -550,7 +550,7 @@ bool COpenGLDriver::genericDriverInit(const core::dimension2d<u32>& screenSize, ...@@ -550,7 +550,7 @@ bool COpenGLDriver::genericDriverInit(const core::dimension2d<u32>& screenSize,
if (renderer && vendor) if (renderer && vendor)
{ {
os::Printer::log(reinterpret_cast<const c8*>(renderer), reinterpret_cast<const c8*>(vendor), ELL_INFORMATION); os::Printer::log(reinterpret_cast<const c8*>(renderer), reinterpret_cast<const c8*>(vendor), ELL_INFORMATION);
vendorName = reinterpret_cast<const c8*>(vendor); VendorName = reinterpret_cast<const c8*>(vendor);
} }
u32 i; u32 i;
...@@ -573,13 +573,9 @@ bool COpenGLDriver::genericDriverInit(const core::dimension2d<u32>& screenSize, ...@@ -573,13 +573,9 @@ bool COpenGLDriver::genericDriverInit(const core::dimension2d<u32>& screenSize,
// Reset The Current Viewport // Reset The Current Viewport
glViewport(0, 0, screenSize.Width, screenSize.Height); glViewport(0, 0, screenSize.Width, screenSize.Height);
UserClipPlane.reallocate(MaxUserClipPlanes); UserClipPlanes.reallocate(MaxUserClipPlanes);
UserClipPlaneEnabled.reallocate(MaxUserClipPlanes);
for (i=0; i<MaxUserClipPlanes; ++i) for (i=0; i<MaxUserClipPlanes; ++i)
{ UserClipPlanes.push_back(SUserClipPlane());
UserClipPlane.push_back(core::plane3df());
UserClipPlaneEnabled.push_back(false);
}
for (i=0; i<ETS_COUNT; ++i) for (i=0; i<ETS_COUNT; ++i)
setTransform(static_cast<E_TRANSFORMATION_STATE>(i), core::IdentityMatrix); setTransform(static_cast<E_TRANSFORMATION_STATE>(i), core::IdentityMatrix);
...@@ -791,7 +787,7 @@ void COpenGLDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matri ...@@ -791,7 +787,7 @@ void COpenGLDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matri
glLoadMatrixf((Matrices[ETS_VIEW] * Matrices[ETS_WORLD]).pointer()); glLoadMatrixf((Matrices[ETS_VIEW] * Matrices[ETS_WORLD]).pointer());
// we have to update the clip planes to the latest view matrix // we have to update the clip planes to the latest view matrix
for (u32 i=0; i<MaxUserClipPlanes; ++i) for (u32 i=0; i<MaxUserClipPlanes; ++i)
if (UserClipPlaneEnabled[i]) if (UserClipPlanes[i].Enabled)
uploadClipPlane(i); uploadClipPlane(i);
} }
break; break;
...@@ -3669,7 +3665,7 @@ bool COpenGLDriver::setClipPlane(u32 index, const core::plane3df& plane, bool en ...@@ -3669,7 +3665,7 @@ bool COpenGLDriver::setClipPlane(u32 index, const core::plane3df& plane, bool en
if (index >= MaxUserClipPlanes) if (index >= MaxUserClipPlanes)
return false; return false;
UserClipPlane[index]=plane; UserClipPlanes[index].Plane=plane;
enableClipPlane(index, enable); enableClipPlane(index, enable);
return true; return true;
} }
...@@ -3679,10 +3675,10 @@ void COpenGLDriver::uploadClipPlane(u32 index) ...@@ -3679,10 +3675,10 @@ void COpenGLDriver::uploadClipPlane(u32 index)
{ {
// opengl needs an array of doubles for the plane equation // opengl needs an array of doubles for the plane equation
double clip_plane[4]; double clip_plane[4];
clip_plane[0] = UserClipPlane[index].Normal.X; clip_plane[0] = UserClipPlanes[index].Plane.Normal.X;
clip_plane[1] = UserClipPlane[index].Normal.Y; clip_plane[1] = UserClipPlanes[index].Plane.Normal.Y;
clip_plane[2] = UserClipPlane[index].Normal.Z; clip_plane[2] = UserClipPlanes[index].Plane.Normal.Z;
clip_plane[3] = UserClipPlane[index].D; clip_plane[3] = UserClipPlanes[index].Plane.D;
glClipPlane(GL_CLIP_PLANE0 + index, clip_plane); glClipPlane(GL_CLIP_PLANE0 + index, clip_plane);
} }
...@@ -3694,7 +3690,7 @@ void COpenGLDriver::enableClipPlane(u32 index, bool enable) ...@@ -3694,7 +3690,7 @@ void COpenGLDriver::enableClipPlane(u32 index, bool enable)
return; return;
if (enable) if (enable)
{ {
if (!UserClipPlaneEnabled[index]) if (!UserClipPlanes[index].Enabled)
{ {
uploadClipPlane(index); uploadClipPlane(index);
glEnable(GL_CLIP_PLANE0 + index); glEnable(GL_CLIP_PLANE0 + index);
...@@ -3703,7 +3699,7 @@ void COpenGLDriver::enableClipPlane(u32 index, bool enable) ...@@ -3703,7 +3699,7 @@ void COpenGLDriver::enableClipPlane(u32 index, bool enable)
else else
glDisable(GL_CLIP_PLANE0 + index); glDisable(GL_CLIP_PLANE0 + index);
UserClipPlaneEnabled[index]=enable; UserClipPlanes[index].Enabled=enable;
} }
......
...@@ -317,7 +317,7 @@ namespace video ...@@ -317,7 +317,7 @@ namespace video
virtual void enableClipPlane(u32 index, bool enable); virtual void enableClipPlane(u32 index, bool enable);
//! Returns the graphics card vendor name. //! Returns the graphics card vendor name.
virtual core::stringc getVendorInfo() {return vendorName;} virtual core::stringc getVendorInfo() {return VendorName;}
//! Returns the maximum texture size supported. //! Returns the maximum texture size supported.
virtual core::dimension2du getMaxTextureSize() const; virtual core::dimension2du getMaxTextureSize() const;
...@@ -395,12 +395,17 @@ namespace video ...@@ -395,12 +395,17 @@ namespace video
COpenGLTexture* RenderTargetTexture; COpenGLTexture* RenderTargetTexture;
const ITexture* CurrentTexture[MATERIAL_MAX_TEXTURES]; const ITexture* CurrentTexture[MATERIAL_MAX_TEXTURES];
core::array<ITexture*> DepthTextures; core::array<ITexture*> DepthTextures;
core::array<core::plane3df> UserClipPlane; struct SUserClipPlane
core::array<bool> UserClipPlaneEnabled; {
SUserClipPlane() : Enabled(false) {}
core::plane3df Plane;
bool Enabled;
};
core::array<SUserClipPlane> UserClipPlanes;
core::dimension2d<u32> CurrentRendertargetSize; core::dimension2d<u32> CurrentRendertargetSize;
core::stringc vendorName; core::stringc VendorName;
core::matrix4 TextureFlipMatrix; core::matrix4 TextureFlipMatrix;
...@@ -421,7 +426,7 @@ namespace video ...@@ -421,7 +426,7 @@ namespace video
: LightData(lightData), HardwareLightIndex(-1), DesireToBeOn(true) { } : LightData(lightData), HardwareLightIndex(-1), DesireToBeOn(true) { }
SLight LightData; SLight LightData;
s32 HardwareLightIndex; // GL_LIGHT0 - GL_LIGHT7 s32 HardwareLightIndex; // GL_LIGHT0 - GL_LIGHT7
bool DesireToBeOn; bool DesireToBeOn;
}; };
core::array<RequestedLight> RequestedLights; core::array<RequestedLight> RequestedLights;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment