diff -Nauwr source/Irrlicht/CAnimatedMeshMD2.cpp source/Irrlicht/CAnimatedMeshMD2.cpp --- source/Irrlicht/CAnimatedMeshMD2.cpp 2005-08-20 22:17:50.000000000 +0200 +++ source/Irrlicht/CAnimatedMeshMD2.cpp 2005-08-29 10:26:30.000000000 +0200 @@ -399,7 +399,7 @@ //! returns pointer to Indices -const u16* CAnimatedMeshMD2::getIndices() const +const u32* CAnimatedMeshMD2::getIndices() const { return Indices.const_pointer(); } @@ -407,7 +407,7 @@ //! returns pointer to Indices -u16* CAnimatedMeshMD2::getIndices() +u32* CAnimatedMeshMD2::getIndices() { return Indices.pointer(); } diff -Nauwr source/Irrlicht/CAnimatedMeshMD2.h source/Irrlicht/CAnimatedMeshMD2.h --- source/Irrlicht/CAnimatedMeshMD2.h 2005-08-20 22:17:50.000000000 +0200 +++ source/Irrlicht/CAnimatedMeshMD2.h 2005-08-29 10:25:56.000000000 +0200 @@ -60,10 +60,10 @@ virtual s32 getVertexCount() const; //! returns pointer to Indices - virtual const u16* getIndices() const; + virtual const u32* getIndices() const; //! returns pointer to Indices - virtual u16* getIndices(); + virtual u32* getIndices(); //! returns amount of indices virtual s32 getIndexCount() const; @@ -109,7 +109,7 @@ //! calculates normals void calculateNormals(); - core::array Indices; + core::array Indices; core::array *FrameList; core::array > BoxList; u32 FrameCount; diff -Nauwr source/Irrlicht/CAnimatedMeshMS3D.cpp source/Irrlicht/CAnimatedMeshMS3D.cpp --- source/Irrlicht/CAnimatedMeshMS3D.cpp 2005-08-20 22:17:50.000000000 +0200 +++ source/Irrlicht/CAnimatedMeshMS3D.cpp 2005-08-29 10:26:26.000000000 +0200 @@ -368,7 +368,7 @@ SGroup& grp = Groups[i]; core::array& vertexIds = grp.VertexIds; SMS3DMeshBuffer &buffer = Buffers[grp.MaterialIdx]; - core::array& indices = buffer.Indices; + core::array& indices = buffer.Indices; for (s32 j=0; j<(int)grp.VertexIds.size(); ++j) { @@ -447,7 +447,7 @@ //SDI2000'S .MS3D 0-MATERIAL PATCH (part 2) SMS3DMeshBuffer &buffer = Buffers[grp.MaterialIdx]; - core::array& indices = buffer.Indices; + core::array& indices = buffer.Indices; for (s32 j=0; j<(int)grp.VertexIds.size(); ++j) { @@ -617,13 +617,13 @@ } //! returns pointer to Indices -const u16* CAnimatedMeshMS3D::SMS3DMeshBuffer::getIndices() const +const u32* CAnimatedMeshMS3D::SMS3DMeshBuffer::getIndices() const { return Indices.const_pointer(); } //! returns pointer to Indices -u16* CAnimatedMeshMS3D::SMS3DMeshBuffer::getIndices() +u32* CAnimatedMeshMS3D::SMS3DMeshBuffer::getIndices() { return Indices.pointer(); } diff -Nauwr source/Irrlicht/CAnimatedMeshMS3D.h source/Irrlicht/CAnimatedMeshMS3D.h --- source/Irrlicht/CAnimatedMeshMS3D.h 2005-08-20 22:17:50.000000000 +0200 +++ source/Irrlicht/CAnimatedMeshMS3D.h 2005-08-29 10:26:16.000000000 +0200 @@ -131,10 +131,10 @@ virtual s32 getVertexCount() const; //! returns pointer to Indices - virtual const u16* getIndices() const; + virtual const u32* getIndices() const; //! returns pointer to Indices - virtual u16* getIndices(); + virtual u32* getIndices(); //! returns amount of indices virtual s32 getIndexCount() const; @@ -150,7 +150,7 @@ video::SMaterial Material; //! material for this meshBuffer. core::array *Vertices; //! Array of vertices - core::array Indices; //! Array of the Indices. + core::array Indices; //! Array of the Indices. core::aabbox3d *BoundingBox; }; @@ -161,7 +161,7 @@ core::array Vertices; core::array AnimatedVertices; - core::array Indices; + core::array Indices; core::array Joints; core::array Groups; diff -Nauwr source/Irrlicht/CD3D8Driver.cpp source/Irrlicht/CD3D8Driver.cpp --- source/Irrlicht/CD3D8Driver.cpp 2005-08-20 22:25:10.000000000 +0200 +++ source/Irrlicht/CD3D8Driver.cpp 2005-09-21 19:37:04.000000000 +0200 @@ -736,7 +736,25 @@ } } +//! draws an indexed triangle list +void CD3D8Driver::drawIndexedTriangleList(const S3DVertex* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + + CNullDriver::drawIndexedTriangleList(vertices, vertexCount, indexList, triangleCount); + + if (!vertexCount || !triangleCount) + return; + + setVertexShader(EVT_STANDARD); + if (setRenderStates3DMode()) + { + pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, vertexCount, + triangleCount, indexList, D3DFMT_INDEX32, vertices, sizeof(S3DVertex)); + } +} //! draws an indexed triangle list void CD3D8Driver::drawIndexedTriangleList(const S3DVertex2TCoords* vertices, @@ -758,8 +776,25 @@ } } +//! draws an indexed triangle list +void CD3D8Driver::drawIndexedTriangleList(const S3DVertex2TCoords* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + CNullDriver::drawIndexedTriangleList(vertices, vertexCount, indexList, triangleCount); + if (!vertexCount || !triangleCount) + return; + + setVertexShader(EVT_2TCOORDS); + + if (setRenderStates3DMode()) + { + pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, vertexCount, + triangleCount, indexList, D3DFMT_INDEX32, vertices, sizeof(S3DVertex2TCoords)); + } +} //! Draws an indexed triangle list. void CD3D8Driver::drawIndexedTriangleList(const S3DVertexTangents* vertices, @@ -781,10 +816,70 @@ } } - //! Draws an indexed triangle list. -void CD3D8Driver::drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, - s32 vertexCount, const u16* indexList, s32 triangleCount) +void CD3D8Driver::drawIndexedTriangleList(const S3DVertexTangents* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + + CNullDriver::drawIndexedTriangleList(vertices, vertexCount, indexList, triangleCount); + + if (!vertexCount || !triangleCount) + return; + + setVertexShader(EVT_TANGENTS); + + if (setRenderStates3DMode()) + { + pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, vertexCount, + triangleCount, indexList, D3DFMT_INDEX32, vertices, sizeof(S3DVertexTangents)); + } +} + +//! Draws an indexed triangle fan. +void CD3D8Driver::drawIndexedTriangleFan(const S3DVertex* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + + CNullDriver::drawIndexedTriangleFan(vertices, vertexCount, indexList, triangleCount); + + if (!vertexCount || !triangleCount) + return; + + setVertexShader(EVT_STANDARD); + + + if (setRenderStates3DMode()) + { + pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLEFAN, 0, vertexCount, + triangleCount, indexList, D3DFMT_INDEX16, vertices, sizeof(S3DVertex)); + } +} + +//! Draws an indexed triangle fan. +void CD3D8Driver::drawIndexedTriangleFan(const S3DVertex* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + + CNullDriver::drawIndexedTriangleFan(vertices, vertexCount, indexList, triangleCount); + + if (!vertexCount || !triangleCount) + return; + + setVertexShader(EVT_STANDARD); + + + if (setRenderStates3DMode()) + { + pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLEFAN, 0, vertexCount, + triangleCount, indexList, D3DFMT_INDEX32, vertices, sizeof(S3DVertex)); + } +} + +//! Draws an indexed triangle fan. +void CD3D8Driver::drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) { if (!checkPrimitiveCount(triangleCount)) return; @@ -795,22 +890,56 @@ return; setVertexShader(EVT_2TCOORDS); - setRenderStates3DMode(); - pID3DDevice->DrawIndexedPrimitiveUP( D3DPT_TRIANGLEFAN, 0, - vertexCount, - triangleCount, - indexList, - D3DFMT_INDEX16, - vertices, - sizeof(S3DVertex2TCoords)); + if (setRenderStates3DMode()) + { + pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLEFAN, 0, vertexCount, + triangleCount, indexList, D3DFMT_INDEX16, vertices, sizeof(S3DVertex2TCoords)); + } +} + +//! Draws an indexed triangle fan. +void CD3D8Driver::drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + + CNullDriver::drawIndexedTriangleFan(vertices, vertexCount, indexList, triangleCount); + + if (!vertexCount || !triangleCount) + return; + + setVertexShader(EVT_2TCOORDS); + + if (setRenderStates3DMode()) + { + pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLEFAN, 0, vertexCount, + triangleCount, indexList, D3DFMT_INDEX32, vertices, sizeof(S3DVertex2TCoords)); + } } +//! Draws an indexed triangle fan. +void CD3D8Driver::drawIndexedTriangleFan(const S3DVertexTangents* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + + CNullDriver::drawIndexedTriangleFan(vertices, vertexCount, indexList, triangleCount); + + if (!vertexCount || !triangleCount) + return; + + setVertexShader(EVT_2TCOORDS); + if (setRenderStates3DMode()) + { + pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLEFAN, 0, vertexCount, + triangleCount, indexList, D3DFMT_INDEX16, vertices, sizeof(S3DVertexTangents)); + } +} //! Draws an indexed triangle fan. -void CD3D8Driver::drawIndexedTriangleFan(const S3DVertex* vertices, - s32 vertexCount, const u16* indexList, s32 triangleCount) +void CD3D8Driver::drawIndexedTriangleFan(const S3DVertexTangents* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) { if (!checkPrimitiveCount(triangleCount)) return; @@ -820,16 +949,13 @@ if (!vertexCount || !triangleCount) return; - setVertexShader(EVT_STANDARD); - setRenderStates3DMode(); + setVertexShader(EVT_2TCOORDS); - pID3DDevice->DrawIndexedPrimitiveUP( D3DPT_TRIANGLEFAN, 0, - vertexCount, - triangleCount, - indexList, - D3DFMT_INDEX16, - vertices, - sizeof(S3DVertex)); + if (setRenderStates3DMode()) + { + pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLEFAN, 0, vertexCount, + triangleCount, indexList, D3DFMT_INDEX32, vertices, sizeof(S3DVertexTangents)); + } } @@ -1167,9 +1293,6 @@ if (!pos.isValid()) return; - if (!pos.isValid()) - return; - core::dimension2d renderTargetSize = getCurrentRenderTargetSize(); s32 xPlus = -(renderTargetSize.Width>>1); f32 xFact = 1.0f / (renderTargetSize.Width>>1); diff -Nauwr source/Irrlicht/CD3D8Driver.h source/Irrlicht/CD3D8Driver.h --- source/Irrlicht/CD3D8Driver.h 2005-08-20 22:17:50.000000000 +0200 +++ source/Irrlicht/CD3D8Driver.h 2005-08-29 10:21:34.000000000 +0200 @@ -69,20 +69,38 @@ const u16* indexList, s32 triangleCount); //! draws an indexed triangle list - virtual void drawIndexedTriangleList(const S3DVertex2TCoords* vertices, s32 vertexCount, - const u16* indexList, s32 triangleCount); + virtual void drawIndexedTriangleList(const S3DVertex* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); + + //! draws an indexed triangle list + virtual void drawIndexedTriangleList(const S3DVertex2TCoords* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); + + //! draws an indexed triangle list + virtual void drawIndexedTriangleList(const S3DVertex2TCoords* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); //! Draws an indexed triangle list. virtual void drawIndexedTriangleList(const S3DVertexTangents* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); + + //! Draws an indexed triangle list. + virtual void drawIndexedTriangleList(const S3DVertexTangents* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); + + //! Draws an indexed triangle fan. + virtual void drawIndexedTriangleFan(const S3DVertex* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); + + //! Draws an indexed triangle fan. + virtual void drawIndexedTriangleFan(const S3DVertex* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); + + //! Draws an indexed triangle fan. + virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); + + //! Draws an indexed triangle fan. + virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); //! Draws an indexed triangle fan. - virtual void drawIndexedTriangleFan(const S3DVertex* vertices, - s32 vertexCount, const u16* indexList, s32 triangleCount); + virtual void drawIndexedTriangleFan(const S3DVertexTangents* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); //! Draws an indexed triangle fan. - virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, - s32 vertexCount, const u16* indexList, s32 triangleCount); + virtual void drawIndexedTriangleFan(const S3DVertexTangents* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); //! draws an 2d image virtual void draw2DImage(video::ITexture* texture, const core::position2d& destPos); diff -Nauwr source/Irrlicht/CD3D9Driver.cpp source/Irrlicht/CD3D9Driver.cpp --- source/Irrlicht/CD3D9Driver.cpp 2005-08-20 22:25:16.000000000 +0200 +++ source/Irrlicht/CD3D9Driver.cpp 2005-09-23 10:19:28.000000000 +0200 @@ -733,7 +733,25 @@ } } +//! draws an indexed triangle list +void CD3D9Driver::drawIndexedTriangleList(const S3DVertex* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + CNullDriver::drawIndexedTriangleList(vertices, vertexCount, indexList, triangleCount); + + if (!vertexCount || !triangleCount) + return; + + setVertexShader(EVT_STANDARD); + + if (setRenderStates3DMode()) + { + pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, vertexCount, + triangleCount, indexList, D3DFMT_INDEX32, vertices, sizeof(S3DVertex)); + } +} //! draws an indexed triangle list void CD3D9Driver::drawIndexedTriangleList(const S3DVertex2TCoords* vertices, @@ -756,6 +771,26 @@ } } +//! draws an indexed triangle list +void CD3D9Driver::drawIndexedTriangleList(const S3DVertex2TCoords* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + + CNullDriver::drawIndexedTriangleList(vertices, vertexCount, indexList, triangleCount); + + if (!vertexCount || !triangleCount) + return; + + setVertexShader(EVT_2TCOORDS); + + if (setRenderStates3DMode()) + { + pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, vertexCount, + triangleCount, indexList, D3DFMT_INDEX32, vertices, sizeof(S3DVertex2TCoords)); + } +} + //! Draws an indexed triangle list. void CD3D9Driver::drawIndexedTriangleList(const S3DVertexTangents* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) @@ -764,11 +798,70 @@ } } +//! Draws an indexed triangle list. +void CD3D9Driver::drawIndexedTriangleList(const S3DVertexTangents* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + CNullDriver::drawIndexedTriangleList(vertices, vertexCount, indexList, triangleCount); -//! Draws an indexed triangle list. -void CD3D9Driver::drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, - s32 vertexCount, const u16* indexList, s32 triangleCount) + if (!vertexCount || !triangleCount) + return; + + setVertexShader(EVT_TANGENTS); + + if (setRenderStates3DMode()) + { + pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, vertexCount, + triangleCount, indexList, D3DFMT_INDEX32, vertices, sizeof(S3DVertexTangents)); + } +} + +//! Draws an indexed triangle fan. +void CD3D9Driver::drawIndexedTriangleFan(const S3DVertex* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + + CNullDriver::drawIndexedTriangleFan(vertices, vertexCount, indexList, triangleCount); + + if (!vertexCount || !triangleCount) + return; + + setVertexShader(EVT_STANDARD); + + + if (setRenderStates3DMode()) + { + pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLEFAN, 0, vertexCount, + triangleCount, indexList, D3DFMT_INDEX16, vertices, sizeof(S3DVertex)); + } +} + +//! Draws an indexed triangle fan. +void CD3D9Driver::drawIndexedTriangleFan(const S3DVertex* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + + CNullDriver::drawIndexedTriangleFan(vertices, vertexCount, indexList, triangleCount); + + if (!vertexCount || !triangleCount) + return; + + setVertexShader(EVT_STANDARD); + + + if (setRenderStates3DMode()) + { + pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLEFAN, 0, vertexCount, + triangleCount, indexList, D3DFMT_INDEX32, vertices, sizeof(S3DVertex)); + } +} + +//! Draws an indexed triangle fan. +void CD3D9Driver::drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) { if (!checkPrimitiveCount(triangleCount)) return; @@ -787,11 +880,28 @@ } } +//! Draws an indexed triangle fan. +void CD3D9Driver::drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + + CNullDriver::drawIndexedTriangleFan(vertices, vertexCount, indexList, triangleCount); + if (!vertexCount || !triangleCount) + return; + + setVertexShader(EVT_2TCOORDS); + + if (setRenderStates3DMode()) + { + pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLEFAN, 0, vertexCount, + triangleCount, indexList, D3DFMT_INDEX32, vertices, sizeof(S3DVertex2TCoords)); + } +} //! Draws an indexed triangle fan. -void CD3D9Driver::drawIndexedTriangleFan(const S3DVertex* vertices, - s32 vertexCount, const u16* indexList, s32 triangleCount) +void CD3D9Driver::drawIndexedTriangleFan(const S3DVertexTangents* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) { if (!checkPrimitiveCount(triangleCount)) return; @@ -801,13 +911,32 @@ if (!vertexCount || !triangleCount) return; - setVertexShader(EVT_STANDARD); + setVertexShader(EVT_2TCOORDS); + if (setRenderStates3DMode()) + { + pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLEFAN, 0, vertexCount, + triangleCount, indexList, D3DFMT_INDEX16, vertices, sizeof(S3DVertexTangents)); + } +} + +//! Draws an indexed triangle fan. +void CD3D9Driver::drawIndexedTriangleFan(const S3DVertexTangents* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + + CNullDriver::drawIndexedTriangleFan(vertices, vertexCount, indexList, triangleCount); + + if (!vertexCount || !triangleCount) + return; + + setVertexShader(EVT_2TCOORDS); if (setRenderStates3DMode()) { pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLEFAN, 0, vertexCount, - triangleCount, indexList, D3DFMT_INDEX16, vertices, sizeof(S3DVertex)); + triangleCount, indexList, D3DFMT_INDEX32, vertices, sizeof(S3DVertexTangents)); } } @@ -1137,9 +1266,6 @@ if (!pos.isValid()) return; - if (!pos.isValid()) - return; - core::dimension2d renderTargetSize = getCurrentRenderTargetSize(); s32 xPlus = -(renderTargetSize.Width>>1); diff -Nauwr source/Irrlicht/CD3D9Driver.h source/Irrlicht/CD3D9Driver.h --- source/Irrlicht/CD3D9Driver.h 2005-08-20 22:17:50.000000000 +0200 +++ source/Irrlicht/CD3D9Driver.h 2005-08-29 10:20:58.000000000 +0200 @@ -57,20 +57,38 @@ const u16* indexList, s32 triangleCount); //! draws an indexed triangle list - virtual void drawIndexedTriangleList(const S3DVertex2TCoords* vertices, s32 vertexCount, - const u16* indexList, s32 triangleCount); + virtual void drawIndexedTriangleList(const S3DVertex* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); + + //! draws an indexed triangle list + virtual void drawIndexedTriangleList(const S3DVertex2TCoords* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); + + //! draws an indexed triangle list + virtual void drawIndexedTriangleList(const S3DVertex2TCoords* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); //! Draws an indexed triangle list. virtual void drawIndexedTriangleList(const S3DVertexTangents* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); + + //! Draws an indexed triangle list. + virtual void drawIndexedTriangleList(const S3DVertexTangents* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); + + //! Draws an indexed triangle fan. + virtual void drawIndexedTriangleFan(const S3DVertex* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); + + //! Draws an indexed triangle fan. + virtual void drawIndexedTriangleFan(const S3DVertex* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); + + //! Draws an indexed triangle fan. + virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); + + //! Draws an indexed triangle fan. + virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); //! Draws an indexed triangle fan. - virtual void drawIndexedTriangleFan(const S3DVertex* vertices, - s32 vertexCount, const u16* indexList, s32 triangleCount); + virtual void drawIndexedTriangleFan(const S3DVertexTangents* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); //! Draws an indexed triangle fan. - virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, - s32 vertexCount, const u16* indexList, s32 triangleCount); + virtual void drawIndexedTriangleFan(const S3DVertexTangents* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); //! draws an 2d image virtual void draw2DImage(video::ITexture* texture, const core::position2d& destPos); diff -Nauwr source/Irrlicht/CMeshManipulator.cpp source/Irrlicht/CMeshManipulator.cpp --- source/Irrlicht/CMeshManipulator.cpp 2005-08-20 22:17:50.000000000 +0200 +++ source/Irrlicht/CMeshManipulator.cpp 2005-09-16 15:31:22.000000000 +0200 @@ -21,7 +21,7 @@ //! visual studio 6.0 didn't like it. template inline void recalculateNormalsT_Flat(VTXTYPE* v, int vtxcnt, - u16* idx, int idxcnt) + u32* idx, int idxcnt) { for (int i=0; i inline void recalculateNormalsT_Smooth(VTXTYPE* v, int vtxcnt, - u16* idx, int idxcnt) + u32* idx, int idxcnt) { s32 i; @@ -69,7 +69,7 @@ template inline void makePlanarMappingT(VERTEXTYPE *v, int vtxcnt, - u16* idx, int idxcnt, f32 resolution) + u32* idx, int idxcnt, f32 resolution ) { for (int i=0; i inline void makePlanarMappingT2(VERTEXTYPE *v, int vtxcnt, - u16* idx, int idxcnt, f32 resolution ) + u32* idx, int idxcnt, f32 resolution ) { for (int i=0; igetMeshBuffer(b); s32 idxcnt = buffer->getIndexCount(); - u16* idx = buffer->getIndices(); + u32* idx = buffer->getIndices(); s32 tmp; for (s32 i=0; igetVertexCount(); s32 idxcnt = buffer->getIndexCount(); - u16* idx = buffer->getIndices(); + u32* idx = buffer->getIndices(); switch(buffer->getVertexType()) { @@ -436,7 +436,7 @@ { s32 vtxCnt = mesh->getMeshBuffer(b)->getVertexCount(); s32 idxCnt = mesh->getMeshBuffer(b)->getIndexCount(); - const u16* idx = mesh->getMeshBuffer(b)->getIndices(); + const u32* idx = mesh->getMeshBuffer(b)->getIndices(); switch(mesh->getMeshBuffer(b)->getVertexType()) { @@ -525,7 +525,7 @@ IMeshBuffer* buffer = mesh->getMeshBuffer(b); s32 vtxcnt = buffer->getVertexCount(); s32 idxcnt = buffer->getIndexCount(); - u16* idx = buffer->getIndices(); + u32* idx = buffer->getIndices(); switch(buffer->getVertexType()) { @@ -574,7 +574,7 @@ { s32 vtxCnt = mesh->getMeshBuffer(b)->getVertexCount(); s32 idxCnt = mesh->getMeshBuffer(b)->getIndexCount(); - const u16* idx = mesh->getMeshBuffer(b)->getIndices(); + const u32* idx = mesh->getMeshBuffer(b)->getIndices(); switch(mesh->getMeshBuffer(b)->getVertexType()) { @@ -676,7 +676,7 @@ { s32 vtxCnt = mesh->getMeshBuffer(b)->getVertexCount(); s32 idxCnt = mesh->getMeshBuffer(b)->getIndexCount(); - const u16* idx = mesh->getMeshBuffer(b)->getIndices(); + const u32* idx = mesh->getMeshBuffer(b)->getIndices(); SMeshBufferTangents* buffer = new SMeshBufferTangents(); buffer->Material = mesh->getMeshBuffer(b)->getMaterial(); @@ -737,7 +737,7 @@ int vtxCnt = clone->getMeshBuffer(b)->getVertexCount(); int idxCnt = clone->getMeshBuffer(b)->getIndexCount(); - u16* idx = clone->getMeshBuffer(b)->getIndices(); + u32* idx = clone->getMeshBuffer(b)->getIndices(); video::S3DVertexTangents* v = (video::S3DVertexTangents*)clone->getMeshBuffer(b)->getVertices(); @@ -922,7 +922,7 @@ { s32 vtxCnt = mesh->getMeshBuffer( b )->getVertexCount(); s32 idxCnt = mesh->getMeshBuffer( b )->getIndexCount(); - const u16* idx = mesh->getMeshBuffer( b )->getIndices(); + const u32* idx = mesh->getMeshBuffer( b )->getIndices(); SMeshBufferLightMap* buffer = new SMeshBufferLightMap(); buffer->Material = mesh->getMeshBuffer( b )->getMaterial(); diff -Nauwr source/Irrlicht/CNullDriver.cpp source/Irrlicht/CNullDriver.cpp --- source/Irrlicht/CNullDriver.cpp 2005-08-20 22:25:06.000000000 +0200 +++ source/Irrlicht/CNullDriver.cpp 2005-08-29 10:18:54.000000000 +0200 @@ -373,7 +373,11 @@ PrimitivesDrawn += triangleCount; } - +//! draws an indexed triangle list +void CNullDriver::drawIndexedTriangleList(const S3DVertex* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + PrimitivesDrawn += triangleCount; +} //! draws an indexed triangle list void CNullDriver::drawIndexedTriangleList(const S3DVertex2TCoords* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) @@ -381,25 +385,56 @@ PrimitivesDrawn += triangleCount; } +//! draws an indexed triangle list +void CNullDriver::drawIndexedTriangleList(const S3DVertex2TCoords* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + PrimitivesDrawn += triangleCount; +} //! Draws an indexed triangle list. void CNullDriver::drawIndexedTriangleList(const S3DVertexTangents* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) { PrimitivesDrawn += triangleCount; } - //! Draws an indexed triangle list. -void CNullDriver::drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, - s32 vertexCount, const u16* indexList, s32 triangleCount) +void CNullDriver::drawIndexedTriangleList(const S3DVertexTangents* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + PrimitivesDrawn += triangleCount; +} + +//! Draws an indexed triangle fan. +void CNullDriver::drawIndexedTriangleFan(const S3DVertex* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) +{ + PrimitivesDrawn += triangleCount; +} + +//! Draws an indexed triangle fan. +void CNullDriver::drawIndexedTriangleFan(const S3DVertex* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) { PrimitivesDrawn += triangleCount; } +//! Draws an indexed triangle fan. +void CNullDriver::drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) +{ + PrimitivesDrawn += triangleCount; +} + +//! Draws an indexed triangle fan. +void CNullDriver::drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + PrimitivesDrawn += triangleCount; +} + +//! Draws an indexed triangle fan. +void CNullDriver::drawIndexedTriangleFan(const S3DVertexTangents* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) +{ + PrimitivesDrawn += triangleCount; +} //! Draws an indexed triangle fan. -void CNullDriver::drawIndexedTriangleFan(const S3DVertex* vertices, - s32 vertexCount, const u16* indexList, s32 triangleCount) +void CNullDriver::drawIndexedTriangleFan(const S3DVertexTangents* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) { PrimitivesDrawn += triangleCount; } diff -Nauwr source/Irrlicht/CNullDriver.h source/Irrlicht/CNullDriver.h --- source/Irrlicht/CNullDriver.h 2005-08-20 22:17:50.000000000 +0200 +++ source/Irrlicht/CNullDriver.h 2005-08-29 10:18:10.000000000 +0200 @@ -64,19 +64,39 @@ virtual void drawIndexedTriangleList(const S3DVertex* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); //! draws an indexed triangle list + virtual void drawIndexedTriangleList(const S3DVertex* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); + + //! draws an indexed triangle list virtual void drawIndexedTriangleList(const S3DVertex2TCoords* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); + //! draws an indexed triangle list + virtual void drawIndexedTriangleList(const S3DVertex2TCoords* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); + //! Draws an indexed triangle list. virtual void drawIndexedTriangleList(const S3DVertexTangents* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); + + //! Draws an indexed triangle list. + virtual void drawIndexedTriangleList(const S3DVertexTangents* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); //! Draws an indexed triangle fan. virtual void drawIndexedTriangleFan(const S3DVertex* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); - //! Draws an indexed triangle list. - virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, - s32 vertexCount, const u16* indexList, s32 triangleCount); + //! Draws an indexed triangle fan. + virtual void drawIndexedTriangleFan(const S3DVertex* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); + + //! Draws an indexed triangle fan. + virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); + + //! Draws an indexed triangle fan. + virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); + + //! Draws an indexed triangle fan. + virtual void drawIndexedTriangleFan(const S3DVertexTangents* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); + + //! Draws an indexed triangle fan. + virtual void drawIndexedTriangleFan(const S3DVertexTangents* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); //! Draws a 3d line. virtual void draw3DLine(const core::vector3df& start, diff -Nauwr source/Irrlicht/COpenGLDriver.cpp source/Irrlicht/COpenGLDriver.cpp --- source/Irrlicht/COpenGLDriver.cpp 2005-08-24 20:40:26.000000000 +0200 +++ source/Irrlicht/COpenGLDriver.cpp 2005-09-21 19:36:50.000000000 +0200 @@ -641,7 +641,49 @@ glDisableClientState(GL_NORMAL_ARRAY ); } +//! draws an indexed triangle list +void COpenGLDriver::drawIndexedTriangleList(const S3DVertex* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(vertexCount)) + return; + + CNullDriver::drawIndexedTriangleList(vertices, vertexCount, indexList, triangleCount); + + setRenderStates3DMode(); + + extGlClientActiveTextureARB(GL_TEXTURE0_ARB); + + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY ); + glEnableClientState(GL_NORMAL_ARRAY ); + + // convert colors to gl color format. + + const S3DVertex* p = vertices; + ColorBuffer.set_used(vertexCount); + for (s32 i=0; iColor.toOpenGLColor(); + ++p; + } + // draw everything + + glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(video::SColor), &ColorBuffer[0]); + glNormalPointer(GL_FLOAT, sizeof(S3DVertex), &vertices[0].Normal); + glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex), &vertices[0].TCoords); + glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex), &vertices[0].Pos); + + glDrawElements(GL_TRIANGLES, triangleCount * 3, GL_UNSIGNED_INT, indexList); + + glFlush(); + + glDisableClientState(GL_COLOR_ARRAY); + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY ); + glDisableClientState(GL_NORMAL_ARRAY ); +} //! draws an indexed triangle list void COpenGLDriver::drawIndexedTriangleList(const S3DVertex2TCoords* vertices, s32 vertexCount, @@ -710,6 +751,71 @@ glDisableClientState(GL_NORMAL_ARRAY ); } +//! draws an indexed triangle list +void COpenGLDriver::drawIndexedTriangleList(const S3DVertex2TCoords* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + + CNullDriver::drawIndexedTriangleList(vertices, vertexCount, indexList, triangleCount); + + setRenderStates3DMode(); + + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY ); + glEnableClientState(GL_NORMAL_ARRAY ); + + // convert colors to gl color format. + + const S3DVertex2TCoords* p = vertices; + ColorBuffer.set_used(vertexCount); + for (s32 i=0; iColor.toOpenGLColor(); + ++p; + } + + // draw everything + + glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(video::SColor), &ColorBuffer[0]); + glNormalPointer(GL_FLOAT, sizeof(S3DVertex2TCoords), &vertices[0].Normal); + glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex2TCoords), &vertices[0].Pos); + + // texture coordiantes + if (MultiTextureExtension) + { + extGlClientActiveTextureARB(GL_TEXTURE0_ARB); + glEnableClientState ( GL_TEXTURE_COORD_ARRAY ); + glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &vertices[0].TCoords); + + extGlClientActiveTextureARB(GL_TEXTURE1_ARB); + glEnableClientState ( GL_TEXTURE_COORD_ARRAY ); + glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &vertices[0].TCoords2); + } + else + glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &vertices[0].TCoords); + + glDrawElements(GL_TRIANGLES, triangleCount * 3, GL_UNSIGNED_INT, indexList); + + glFlush(); + + glDisableClientState(GL_COLOR_ARRAY); + glDisableClientState(GL_VERTEX_ARRAY); + + if (MultiTextureExtension) + { + extGlClientActiveTextureARB(GL_TEXTURE0_ARB); + glDisableClientState ( GL_TEXTURE_COORD_ARRAY ); + + extGlClientActiveTextureARB(GL_TEXTURE1_ARB); + glDisableClientState ( GL_TEXTURE_COORD_ARRAY ); + } + else + glDisableClientState(GL_TEXTURE_COORD_ARRAY ); + + glDisableClientState(GL_NORMAL_ARRAY ); +} //! Draws an indexed triangle list. void COpenGLDriver::drawIndexedTriangleList(const S3DVertexTangents* vertices, @@ -770,7 +875,63 @@ glDisableClientState(GL_TEXTURE_COORD_ARRAY ); } +//! Draws an indexed triangle list. +void COpenGLDriver::drawIndexedTriangleList(const S3DVertexTangents* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + + CNullDriver::drawIndexedTriangleList(vertices, vertexCount, indexList, triangleCount); + + setRenderStates3DMode(); + + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY ); + glEnableClientState(GL_NORMAL_ARRAY ); + + // convert colors to gl color format. + + const S3DVertexTangents* p = vertices; + ColorBuffer.set_used(vertexCount); + for (s32 i=0; iColor.toOpenGLColor(); + ++p; + } + + // draw everything + + glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(video::SColor), &ColorBuffer[0]); + glNormalPointer(GL_FLOAT, sizeof(S3DVertexTangents), &vertices[0].Normal); + glVertexPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &vertices[0].Pos); + + extGlClientActiveTextureARB(GL_TEXTURE0_ARB); + glEnableClientState ( GL_TEXTURE_COORD_ARRAY ); + glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertexTangents), &vertices[0].TCoords); + + extGlClientActiveTextureARB(GL_TEXTURE1_ARB); + glEnableClientState ( GL_TEXTURE_COORD_ARRAY ); + glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &vertices[0].Tangent); + + extGlClientActiveTextureARB(GL_TEXTURE2_ARB); + glEnableClientState ( GL_TEXTURE_COORD_ARRAY ); + glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &vertices[0].Binormal); + + glDrawElements(GL_TRIANGLES, triangleCount * 3, GL_UNSIGNED_INT, indexList); + + glFlush(); + + glDisableClientState(GL_COLOR_ARRAY); + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY ); + glDisableClientState(GL_NORMAL_ARRAY ); + extGlClientActiveTextureARB(GL_TEXTURE1_ARB); + glDisableClientState(GL_TEXTURE_COORD_ARRAY ); + extGlClientActiveTextureARB(GL_TEXTURE2_ARB); + glDisableClientState(GL_TEXTURE_COORD_ARRAY ); +} //! draws an indexed triangle fan void COpenGLDriver::drawIndexedTriangleFan(const S3DVertex* vertices, s32 vertexCount, @@ -820,11 +980,119 @@ glDisableClientState(GL_NORMAL_ARRAY ); } +//! draws an indexed triangle fan +void COpenGLDriver::drawIndexedTriangleFan(const S3DVertex* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + + CNullDriver::drawIndexedTriangleFan(vertices, vertexCount, indexList, triangleCount); + + setRenderStates3DMode(); + + extGlClientActiveTextureARB(GL_TEXTURE0_ARB); + + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY ); + glEnableClientState(GL_NORMAL_ARRAY ); + + // convert colors to gl color format. + + const S3DVertex* p = vertices; + ColorBuffer.set_used(vertexCount); + for (s32 i=0; iColor.toOpenGLColor(); + ++p; + } + + // draw everything + + glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(video::SColor), &ColorBuffer[0]); + glNormalPointer(GL_FLOAT, sizeof(S3DVertex), &vertices[0].Normal); + glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex), &vertices[0].TCoords); + glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex), &vertices[0].Pos); + + glDrawElements(GL_TRIANGLE_FAN, triangleCount+2, GL_UNSIGNED_INT, indexList); + + glFlush(); + + glDisableClientState(GL_COLOR_ARRAY); + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY ); + glDisableClientState(GL_NORMAL_ARRAY ); +} + + +//! draws an indexed triangle fan +void COpenGLDriver::drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + + CNullDriver::drawIndexedTriangleFan(vertices, vertexCount, indexList, triangleCount); + + setRenderStates3DMode(); + + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY ); + glEnableClientState(GL_NORMAL_ARRAY ); + + // convert colors to gl color format. + + const S3DVertex2TCoords* p = vertices; + ColorBuffer.set_used(vertexCount); + for (s32 i=0; iColor.toOpenGLColor(); + ++p; + } + + // draw everything + + glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(video::SColor), &ColorBuffer[0]); + glNormalPointer(GL_FLOAT, sizeof(S3DVertex2TCoords), &vertices[0].Normal); + glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex2TCoords), &vertices[0].Pos); + + // texture coordiantes + if (MultiTextureExtension) + { + extGlClientActiveTextureARB(GL_TEXTURE0_ARB); + glEnableClientState ( GL_TEXTURE_COORD_ARRAY ); + glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &vertices[0].TCoords); + + extGlClientActiveTextureARB(GL_TEXTURE1_ARB); + glEnableClientState ( GL_TEXTURE_COORD_ARRAY ); + glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &vertices[0].TCoords2); + } + else + glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &vertices[0].TCoords); + + glDrawElements(GL_TRIANGLE_FAN, triangleCount+2, GL_UNSIGNED_SHORT, indexList); + + glFlush(); + + glDisableClientState(GL_COLOR_ARRAY); + glDisableClientState(GL_VERTEX_ARRAY); + + if (MultiTextureExtension) + { + extGlClientActiveTextureARB(GL_TEXTURE0_ARB); + glDisableClientState ( GL_TEXTURE_COORD_ARRAY ); + extGlClientActiveTextureARB(GL_TEXTURE1_ARB); + glDisableClientState ( GL_TEXTURE_COORD_ARRAY ); + } + else + glDisableClientState(GL_TEXTURE_COORD_ARRAY ); + + glDisableClientState(GL_NORMAL_ARRAY ); +} //! draws an indexed triangle fan -void COpenGLDriver::drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, - s32 vertexCount, const u16* indexList, s32 triangleCount) +void COpenGLDriver::drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) { if (!checkPrimitiveCount(triangleCount)) return; @@ -865,6 +1133,61 @@ else glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &vertices[0].TCoords); + glDrawElements(GL_TRIANGLE_FAN, triangleCount+2, GL_UNSIGNED_INT, indexList); + + glFlush(); + + glDisableClientState(GL_COLOR_ARRAY); + glDisableClientState(GL_VERTEX_ARRAY); + + if (MultiTextureExtension) + { + extGlClientActiveTextureARB(GL_TEXTURE0_ARB); + glDisableClientState ( GL_TEXTURE_COORD_ARRAY ); + + extGlClientActiveTextureARB(GL_TEXTURE1_ARB); + glDisableClientState ( GL_TEXTURE_COORD_ARRAY ); + } + else + glDisableClientState(GL_TEXTURE_COORD_ARRAY ); + + glDisableClientState(GL_NORMAL_ARRAY ); +} + +//! draws an indexed triangle fan +void COpenGLDriver::drawIndexedTriangleFan(const S3DVertexTangents* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + + CNullDriver::drawIndexedTriangleFan(vertices, vertexCount, indexList, triangleCount); + + setRenderStates3DMode(); + + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY ); + glEnableClientState(GL_NORMAL_ARRAY ); + + // convert colors to gl color format. + + const S3DVertexTangents* p = vertices; + ColorBuffer.set_used(vertexCount); + for (s32 i=0; iColor.toOpenGLColor(); + ++p; + } + + // draw everything + + glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(video::SColor), &ColorBuffer[0]); + glNormalPointer(GL_FLOAT, sizeof(S3DVertexTangents), &vertices[0].Normal); + glVertexPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &vertices[0].Pos); + + // texture coordiantes + glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertexTangents), &vertices[0].TCoords); + glDrawElements(GL_TRIANGLE_FAN, triangleCount+2, GL_UNSIGNED_SHORT, indexList); glFlush(); @@ -886,6 +1209,61 @@ glDisableClientState(GL_NORMAL_ARRAY ); } +//! draws an indexed triangle fan +void COpenGLDriver::drawIndexedTriangleFan(const S3DVertexTangents* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) +{ + if (!checkPrimitiveCount(triangleCount)) + return; + + CNullDriver::drawIndexedTriangleFan(vertices, vertexCount, indexList, triangleCount); + + setRenderStates3DMode(); + + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY ); + glEnableClientState(GL_NORMAL_ARRAY ); + + // convert colors to gl color format. + + const S3DVertexTangents* p = vertices; + ColorBuffer.set_used(vertexCount); + for (s32 i=0; iColor.toOpenGLColor(); + ++p; + } + + // draw everything + + glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(video::SColor), &ColorBuffer[0]); + glNormalPointer(GL_FLOAT, sizeof(S3DVertexTangents), &vertices[0].Normal); + glVertexPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &vertices[0].Pos); + + // texture coordiantes + glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertexTangents), &vertices[0].TCoords); + + glDrawElements(GL_TRIANGLE_FAN, triangleCount+2, GL_UNSIGNED_INT, indexList); + + glFlush(); + + glDisableClientState(GL_COLOR_ARRAY); + glDisableClientState(GL_VERTEX_ARRAY); + + if (MultiTextureExtension) + { + extGlClientActiveTextureARB(GL_TEXTURE0_ARB); + glDisableClientState ( GL_TEXTURE_COORD_ARRAY ); + + extGlClientActiveTextureARB(GL_TEXTURE1_ARB); + glDisableClientState ( GL_TEXTURE_COORD_ARRAY ); + } + else + glDisableClientState(GL_TEXTURE_COORD_ARRAY ); + + glDisableClientState(GL_NORMAL_ARRAY ); +} + //! draws an 2d image diff -Nauwr source/Irrlicht/COpenGLDriver.h source/Irrlicht/COpenGLDriver.h --- source/Irrlicht/COpenGLDriver.h 2005-08-24 20:25:14.000000000 +0200 +++ source/Irrlicht/COpenGLDriver.h 2005-08-29 10:22:14.000000000 +0200 @@ -68,20 +68,38 @@ s32 vertexCount, const u16* indexList, s32 triangleCount); //! draws an indexed triangle list - virtual void drawIndexedTriangleList(const S3DVertex2TCoords* vertices, - s32 vertexCount, const u16* indexList, s32 triangleCount); + virtual void drawIndexedTriangleList(const S3DVertex* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); + + //! draws an indexed triangle list + virtual void drawIndexedTriangleList(const S3DVertex2TCoords* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); + + //! draws an indexed triangle list + virtual void drawIndexedTriangleList(const S3DVertex2TCoords* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); //! Draws an indexed triangle list. virtual void drawIndexedTriangleList(const S3DVertexTangents* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); + + //! Draws an indexed triangle list. + virtual void drawIndexedTriangleList(const S3DVertexTangents* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); + + //! Draws an indexed triangle fan. + virtual void drawIndexedTriangleFan(const S3DVertex* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); + + //! Draws an indexed triangle fan. + virtual void drawIndexedTriangleFan(const S3DVertex* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); + + //! Draws an indexed triangle fan. + virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); + + //! Draws an indexed triangle fan. + virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); //! Draws an indexed triangle fan. - virtual void drawIndexedTriangleFan(const S3DVertex* vertices, - s32 vertexCount, const u16* indexList, s32 triangleCount); + virtual void drawIndexedTriangleFan(const S3DVertexTangents* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); //! Draws an indexed triangle fan. - virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, - s32 vertexCount, const u16* indexList, s32 triangleCount); + virtual void drawIndexedTriangleFan(const S3DVertexTangents* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount); //! queries the features of the driver, returns true if feature is available bool queryFeature(E_VIDEO_DRIVER_FEATURE feature); diff -Nauwr source/Irrlicht/CShadowVolumeSceneNode.cpp source/Irrlicht/CShadowVolumeSceneNode.cpp --- source/Irrlicht/CShadowVolumeSceneNode.cpp 2005-08-20 22:17:52.000000000 +0200 +++ source/Irrlicht/CShadowVolumeSceneNode.cpp 2005-09-19 12:59:20.000000000 +0200 @@ -320,8 +320,8 @@ s32 idxcnt = b->getIndexCount(); s32 vtxnow = VertexCount; - const u16* idxp = b->getIndices(); - const u16* idxpend = idxp + idxcnt; + const u32* idxp = b->getIndices(); + const u32* idxpend = idxp + idxcnt; for (; idxp!=idxpend; ++idxp) Indices[IndexCount++] = *idxp + vtxnow; diff -Nauwr source/Irrlicht/CTriangleSelector.cpp source/Irrlicht/CTriangleSelector.cpp --- source/Irrlicht/CTriangleSelector.cpp 2005-08-20 22:17:54.000000000 +0200 +++ source/Irrlicht/CTriangleSelector.cpp 2005-08-29 10:25:56.000000000 +0200 @@ -35,7 +35,7 @@ s32 idxCnt = buf->getIndexCount(); s32 vtxCnt = buf->getVertexCount(); - const u16* indices = buf->getIndices(); + const u32* indices = buf->getIndices(); core::triangle3df tri; switch (buf->getVertexType()) diff -Nauwr source/Irrlicht/include/IMeshBuffer.h source/Irrlicht/include/IMeshBuffer.h --- source/Irrlicht/include/IMeshBuffer.h 2005-08-20 22:17:44.000000000 +0200 +++ source/Irrlicht/include/IMeshBuffer.h 2005-08-29 10:25:04.000000000 +0200 @@ -45,10 +45,10 @@ virtual s32 getVertexCount() const = 0; //! returns pointer to Indices - virtual const u16* getIndices() const = 0; + virtual const u32* getIndices() const = 0; //! returns pointer to Indices - virtual u16* getIndices() = 0; + virtual u32* getIndices() = 0; //! returns amount of indices virtual s32 getIndexCount() const = 0; diff -Nauwr source/Irrlicht/include/IVideoDriver.h source/Irrlicht/include/IVideoDriver.h --- source/Irrlicht/include/IVideoDriver.h 2005-08-20 22:43:48.000000000 +0200 +++ source/Irrlicht/include/IVideoDriver.h 2005-08-29 10:19:52.000000000 +0200 @@ -328,6 +328,17 @@ \param triangleCount: amount of Triangles. Usually amount of indizes / 3. */ virtual void drawIndexedTriangleList(const S3DVertex* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) = 0; + + //! Draws an indexed triangle list. + /** Note that there may be at maximum 4294967296 vertices, because the + index list is a array of 32 bit values each with a maximum value + of 4294967296. If there are more than 4294967296 vertices in the list, + results of this operation are not defined. + \param vertices: Pointer to array of vertices. + \param vertexCount: Amount of vertices in the array. + \param indexList: Pointer to array of indizes. + \param triangleCount: amount of Triangles. Usually amount of indizes / 3. */ + virtual void drawIndexedTriangleList(const S3DVertex* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) = 0; //! Draws an indexed triangle list. /** Note that there may be at maximum 65536 vertices, because the @@ -340,6 +350,17 @@ \param triangleCount: amount of Triangles. Usually amount of indizes / 3.*/ virtual void drawIndexedTriangleList(const S3DVertex2TCoords* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) = 0; + + //! Draws an indexed triangle list. + /** Note that there may be at maximum 4294967296 vertices, because the + index list is a array of 32 bit values each with a maximum value + of 4294967296. If there are more than 4294967296 vertices in the list, + results of this operation are not defined. + \param vertices: Pointer to array of vertices. + \param vertexCount: Amount of vertices in the array. + \param indexList: Pointer to array of indizes. + \param triangleCount: amount of Triangles. Usually amount of indizes / 3.*/ + virtual void drawIndexedTriangleList(const S3DVertex2TCoords* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) = 0; //! Draws an indexed triangle list. /** Note that there may be at maximum 65536 vertices, because the @@ -352,6 +372,69 @@ \param triangleCount: amount of Triangles. Usually amount of indizes / 3. */ virtual void drawIndexedTriangleList(const S3DVertexTangents* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) = 0; + + //! Draws an indexed triangle list. + /** Note that there may be at maximum 4294967296 vertices, because the + index list is a array of 32 bit values each with a maximum value + of 4294967296. If there are more than 4294967296 vertices in the list, + results of this operation are not defined. + \param vertices: Pointer to array of vertices. + \param vertexCount: Amount of vertices in the array. + \param indexList: Pointer to array of indizes. + \param triangleCount: amount of Triangles. Usually amount of indizes / 3. */ + virtual void drawIndexedTriangleList(const S3DVertexTangents* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) = 0; + + //! Draws an indexed triangle fan. + /** Note that there may be at maximum 65536 vertices, because the + index list is a array of 16 bit values each with a maximum value + of 65536. If there are more than 65536 vertices in the list, + results of this operation are not defined. + Please note that some of the implementation code for this method is based on + free code sent in by Mario Gruber, lots of thanks go to him! + \param vertices: Pointer to array of vertices. + \param vertexCount: Amount of vertices in the array. + \param indexList: Pointer to array of indizes. + \param triangleCount: amount of Triangles. Usually amount of indizes - 2. */ + virtual void drawIndexedTriangleFan(const S3DVertex* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) = 0; + + //! Draws an indexed triangle fan. + /** Note that there may be at maximum 65536 vertices, because the + index list is a array of 32 bit values each with a maximum value + of 65536. If there are more than 65536 vertices in the list, + results of this operation are not defined. + Please note that some of the implementation code for this method is based on + free code sent in by Mario Gruber, lots of thanks go to him! + \param vertices: Pointer to array of vertices. + \param vertexCount: Amount of vertices in the array. + \param indexList: Pointer to array of indizes. + \param triangleCount: amount of Triangles. Usually amount of indizes - 2. */ + virtual void drawIndexedTriangleFan(const S3DVertex* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) = 0; + + //! Draws an indexed triangle fan. + /** Note that there may be at maximum 65536 vertices, because the + index list is a array of 16 bit values each with a maximum value + of 65536. If there are more than 65536 vertices in the list, + results of this operation are not defined. + Please note that some of the implementation code for this method is based on + free code sent in by Mario Gruber, lots of thanks go to him! + \param vertices: Pointer to array of vertices. + \param vertexCount: Amount of vertices in the array. + \param indexList: Pointer to array of indizes. + \param triangleCount: amount of Triangles. Usually amount of indizes - 2. */ + virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) = 0; + + //! Draws an indexed triangle fan. + /** Note that there may be at maximum 65536 vertices, because the + index list is a array of 16 bit values each with a maximum value + of 65536. If there are more than 65536 vertices in the list, + results of this operation are not defined. + Please note that some of the implementation code for this method is based on + free code sent in by Mario Gruber, lots of thanks go to him! + \param vertices: Pointer to array of vertices. + \param vertexCount: Amount of vertices in the array. + \param indexList: Pointer to array of indizes. + \param triangleCount: amount of Triangles. Usually amount of indizes - 2. */ + virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) = 0; //! Draws an indexed triangle fan. /** Note that there may be at maximum 65536 vertices, because the @@ -364,8 +446,7 @@ \param vertexCount: Amount of vertices in the array. \param indexList: Pointer to array of indizes. \param triangleCount: amount of Triangles. Usually amount of indizes - 2. */ - virtual void drawIndexedTriangleFan(const S3DVertex* vertices, - s32 vertexCount, const u16* indexList, s32 triangleCount) = 0; + virtual void drawIndexedTriangleFan(const S3DVertexTangents* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount) = 0; //! Draws an indexed triangle fan. /** Note that there may be at maximum 65536 vertices, because the @@ -378,8 +459,7 @@ \param vertexCount: Amount of vertices in the array. \param indexList: Pointer to array of indizes. \param triangleCount: amount of Triangles. Usually amount of indizes - 2. */ - virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, - s32 vertexCount, const u16* indexList, s32 triangleCount) = 0; + virtual void drawIndexedTriangleFan(const S3DVertexTangents* vertices, s32 vertexCount, const u32* indexList, s32 triangleCount) = 0; //! Draws a 3d line. /** This method usually simply calls drawIndexedTriangles with some diff -Nauwr source/Irrlicht/include/SMeshBuffer.h source/Irrlicht/include/SMeshBuffer.h --- source/Irrlicht/include/SMeshBuffer.h 2005-08-20 22:17:46.000000000 +0200 +++ source/Irrlicht/include/SMeshBuffer.h 2005-08-29 10:24:40.000000000 +0200 @@ -57,13 +57,13 @@ } //! returns pointer to Indices - virtual const u16* getIndices() const + virtual const u32* getIndices() const { return Indices.const_pointer(); } //! returns pointer to Indices - virtual u16* getIndices() + virtual u32* getIndices() { return Indices.pointer(); } @@ -107,7 +107,7 @@ video::SMaterial Material; //! material for this meshBuffer. core::array Vertices; //! Array of vertices - core::array Indices; //! Array of the Indices. + core::array Indices; //! Array of the Indices. core::aabbox3d BoundingBox; }; diff -Nauwr source/Irrlicht/include/SMeshBufferLightMap.h source/Irrlicht/include/SMeshBufferLightMap.h --- source/Irrlicht/include/SMeshBufferLightMap.h 2005-08-20 22:17:46.000000000 +0200 +++ source/Irrlicht/include/SMeshBufferLightMap.h 2005-08-29 10:24:48.000000000 +0200 @@ -58,13 +58,13 @@ } //! returns pointer to Indices - virtual const u16* getIndices() const + virtual const u32* getIndices() const { return Indices.const_pointer(); } //! returns pointer to Indices - virtual u16* getIndices() + virtual u32* getIndices() { return Indices.pointer(); } @@ -108,7 +108,7 @@ video::SMaterial Material; //! material for this meshBuffer. core::array Vertices; //! Array of vertices - core::array Indices; //! Array of the Indices. + core::array Indices; //! Array of the Indices. core::aabbox3d BoundingBox; }; diff -Nauwr source/Irrlicht/include/SMeshBufferTangents.h source/Irrlicht/include/SMeshBufferTangents.h --- source/Irrlicht/include/SMeshBufferTangents.h 2005-08-20 22:26:40.000000000 +0200 +++ source/Irrlicht/include/SMeshBufferTangents.h 2005-08-29 10:25:28.000000000 +0200 @@ -57,13 +57,13 @@ } //! returns pointer to Indices - virtual const u16* getIndices() const + virtual const u32* getIndices() const { return Indices.const_pointer(); } //! returns pointer to Indices - virtual u16* getIndices() + virtual u32* getIndices() { return Indices.pointer(); } @@ -107,7 +107,7 @@ video::SMaterial Material; //! material for this meshBuffer. core::array Vertices; //! Array of vertices - core::array Indices; //! Array of the Indices. + core::array Indices; //! Array of the Indices. core::aabbox3d BoundingBox; };