diff --git a/changes.txt b/changes.txt index a41a52f6..4639dd47 100644 --- a/changes.txt +++ b/changes.txt @@ -1,13 +1,32 @@ ------------------------------------------- -Changes in version 1.4 (... 13.11.2007) - - Fixed somed CQuake3ShaderSceneNode problems. - - Changed BurningsVideo internal Vertex Format. version changed to 0.39 - - SceneManager: - Removed the seperate rendering states for quake3 Shader Scene Nodes. - Nodes are now solid or transparent. ( but still more states are needed ) +Changes in version 1.5 (... 2008) + + - Hardware accelerated Vertex and Index Buffer support finally integrated into Irrlicht. Thanks to a ressource handling idea by Klasker and the almost immediate implementation by Luke, Irrlicht now supports VBOs under OpenGL. D3D will follow soon. + Hardware buffers make rendering the same vertices much faster. In some cases this can be more than 10x faster. To sue this feature with a mesh simple set a usage type, e.g. via MeshBuffer->setHardwareMappingHint(scene::EHM_STATIC). The driver will upload the vertices and indices on the next draw and reuse this information without the need to upload it each frame. + + - MeshBuffers can now access the elements of the S3DVertex base class in all vertex types directly, instead of using teh getVertices() pointer access. This simplifies simple mesh manipulations as it does not require a switch statement over all vertex types. + + - GLSL changes for setting arrays. Also allow for only pixel or vertex shader to be set. + + - Some bugfixes for Joint handling and skinned meshes. + + - Added WAL image format support based on the original loader by Murphy McCauley, written for Irrlicht around version 0.7. + + - OpenGL RTTs now also support alpha values. + + - New method driver->getVendorInfo() to query information about the actual hardware driver. + + - Fixed somed CQuake3ShaderSceneNode problems. + + - Changed BurningsVideo internal Vertex Format. version changed to 0.39 + + - SceneManager: + Removed the seperate rendering states for quake3 Shader Scene Nodes. + Nodes are now solid or transparent. ( but still more states are needed ) + ------------------------------------------- -Changes in version 1.4 (... 2007) +Changes in version 1.4 (30.11.2007) - Major API change: All material properties which are available per texture layer (curently texture, texture matrix, texture filters, and texture wrap mode) are separated into a new struct SMaterialLayer. You can access them via the array TextureLayer[] in SMaterial. The texture matrix methods in SMaterial are still alive, and also textures can be accessed via methods in SMaterial now. But still, many places in user code need some update (usually changing material.Textures[i] to material.TextureLayer[i].Texture etc.) diff --git a/include/ISceneNode.h b/include/ISceneNode.h index f09cfcf8..3c5e160b 100644 --- a/include/ISceneNode.h +++ b/include/ISceneNode.h @@ -73,7 +73,7 @@ namespace scene children from being able to register them selfes if they are clipped by simply not calling their OnRegisterSceneNode-Method. If you are implementing your own scene node, you should overwrite this method - with an implementtion code looking like this: + with an implementation code looking like this: \code if (IsVisible) SceneManager->registerNodeForRendering(this); @@ -95,9 +95,9 @@ namespace scene //! OnAnimate() is called just before rendering the whole scene. //! Nodes may calculate or store animations here, and may do other useful things, //! dependent on what they are. Also, OnAnimate() should be called for all - //! child scene nodes here. This method will called once per frame, independent + //! child scene nodes here. This method will be called once per frame, independent //! of if the scene node is visible or not. - //! \param timeMs: Current time in milli seconds. + //! \param timeMs: Current time in milliseconds. virtual void OnAnimate(u32 timeMs) { if (IsVisible) diff --git a/include/S3DVertex.h b/include/S3DVertex.h index ad6e7e62..3158f545 100644 --- a/include/S3DVertex.h +++ b/include/S3DVertex.h @@ -65,16 +65,16 @@ struct S3DVertex //! Texture coordinates core::vector2d TCoords; - bool operator == (const S3DVertex& other) const + bool operator==(const S3DVertex& other) const { - return (Pos == other.Pos && Normal == other.Normal && - Color == other.Color && TCoords == other.TCoords); + return ((Pos == other.Pos) && (Normal == other.Normal) && + (Color == other.Color) && (TCoords == other.TCoords)); } - bool operator != (const S3DVertex& other) const + bool operator!=(const S3DVertex& other) const { - return (Pos != other.Pos || Normal != other.Normal || - Color != other.Color || TCoords != other.TCoords); + return ((Pos != other.Pos) || (Normal != other.Normal) || + (Color != other.Color) || (TCoords != other.TCoords)); } E_VERTEX_TYPE getType() const @@ -127,17 +127,17 @@ struct S3DVertex2TCoords : public S3DVertex core::vector2d TCoords2; //! Equality operator - bool operator == (const S3DVertex2TCoords& other) const + bool operator==(const S3DVertex2TCoords& other) const { - return (static_cast(*this)==other && - TCoords2 == other.TCoords2); + return ((static_cast(*this)==other) && + (TCoords2 == other.TCoords2)); } //! Inequality operator - bool operator != (const S3DVertex2TCoords& other) const + bool operator!=(const S3DVertex2TCoords& other) const { - return (static_cast(*this)!=other && - TCoords2 != other.TCoords2); + return ((static_cast(*this)!=other) || + (TCoords2 != other.TCoords2)); } E_VERTEX_TYPE getType() const @@ -178,16 +178,18 @@ struct S3DVertexTangents : public S3DVertex //! Binormal vector (tangent x normal) core::vector3df Binormal; - bool operator == (const S3DVertexTangents& other) const + bool operator==(const S3DVertexTangents& other) const { - return (static_cast(*this)==other && - Tangent == other.Tangent && Binormal == other.Binormal); + return ((static_cast(*this)==other) && + (Tangent == other.Tangent) && + (Binormal == other.Binormal)); } - bool operator != (const S3DVertexTangents& other) const + bool operator!=(const S3DVertexTangents& other) const { - return (static_cast(*this)!=other && - Tangent != other.Tangent || Binormal != other.Binormal); + return ((static_cast(*this)!=other) || + (Tangent != other.Tangent) || + (Binormal != other.Binormal)); } E_VERTEX_TYPE getType() const diff --git a/include/SMaterial.h b/include/SMaterial.h index e775fed1..df3c4e63 100644 --- a/include/SMaterial.h +++ b/include/SMaterial.h @@ -218,8 +218,7 @@ namespace video //! Gets the texture transformation matrix for level i core::matrix4& getTextureMatrix(u32 i) { - if (iread(c, data.header.length - data.read); - if (matSection == C3DS_MATTEXMAP) + switch (matSection) + { + case C3DS_MATTEXMAP: CurrentMaterial.Filename[0] = c; - else if (matSection == C3DS_MATSPECMAP) + break; + case C3DS_MATSPECMAP: CurrentMaterial.Filename[1] = c; - else if (matSection == C3DS_MATOPACMAP) + break; + case C3DS_MATOPACMAP: CurrentMaterial.Filename[2] = c; - else if (matSection == C3DS_MATREFLMAP) + break; + case C3DS_MATREFLMAP: CurrentMaterial.Filename[3] = c; - else if (matSection == C3DS_MATBUMPMAP) + break; + case C3DS_MATBUMPMAP: CurrentMaterial.Filename[4] = c; + break; + } data.read += data.header.length - data.read; delete [] c; } @@ -433,6 +441,27 @@ bool C3DSMeshFileLoader::readMaterialChunk(io::IReadFile* file, ChunkData* paren #ifdef __BIG_ENDIAN__ value = os::Byteswap::byteswap(value); #endif + u32 i=0; + if (matSection != C3DS_MATTEXMAP) + i=1; + u32 j=0,k=0; + if (data.header.id == C3DS_MAT_VSCALE) + { + j=1; + k=1; + } + else if (data.header.id == C3DS_MAT_UOFFSET) + { + j=2; + k=0; + } + else if (data.header.id == C3DS_MAT_VOFFSET) + { + j=2; + k=1; + } + CurrentMaterial.Material.getTextureMatrix(i)(j,k)=value; + data.read += 4; } break; @@ -889,8 +918,7 @@ void C3DSMeshFileLoader::composeObject(io::IReadFile* file, const core::stringc& mb->getMaterial() = Materials[0].Material; mb->drop(); // add an empty mesh buffer name - core::stringc c = ""; - MeshBufferNames.push_back(c); + MeshBufferNames.push_back(""); } } diff --git a/source/Irrlicht/CB3DMeshFileLoader.cpp b/source/Irrlicht/CB3DMeshFileLoader.cpp index 7d1350b9..ed906997 100644 --- a/source/Irrlicht/CB3DMeshFileLoader.cpp +++ b/source/Irrlicht/CB3DMeshFileLoader.cpp @@ -912,10 +912,12 @@ core::stringc CB3DMeshFileLoader::stripPathFromString(core::stringc string, bool if (backSlash>slashIndex) slashIndex=backSlash; if (slashIndex==-1)//no slashes found + { if (returnPath) return core::stringc(); //no path to return else return string; + } if (returnPath) return string.subString(0, slashIndex + 1); diff --git a/source/Irrlicht/CD3D8Driver.cpp b/source/Irrlicht/CD3D8Driver.cpp index 6e32166c..07a9a76c 100644 --- a/source/Irrlicht/CD3D8Driver.cpp +++ b/source/Irrlicht/CD3D8Driver.cpp @@ -2054,7 +2054,7 @@ IImage* CD3D8Driver::createScreenShot() // returns the current size of the screen or rendertarget -core::dimension2d CD3D8Driver::getCurrentRenderTargetSize() +const core::dimension2d& CD3D8Driver::getCurrentRenderTargetSize() const { if ( CurrentRendertargetSize.Width == 0 ) return ScreenSize; diff --git a/source/Irrlicht/CD3D8Driver.h b/source/Irrlicht/CD3D8Driver.h index df66af79..15764d6f 100644 --- a/source/Irrlicht/CD3D8Driver.h +++ b/source/Irrlicht/CD3D8Driver.h @@ -235,7 +235,7 @@ namespace video virtual video::ITexture* createDeviceDependentTexture(IImage* surface, const char* name); // returns the current size of the screen or rendertarget - core::dimension2d getCurrentRenderTargetSize(); + virtual const core::dimension2d& getCurrentRenderTargetSize() const; //! Adds a new material renderer to the VideoDriver, using pixel and/or //! vertex shaders to render geometry. diff --git a/source/Irrlicht/CD3D9Driver.cpp b/source/Irrlicht/CD3D9Driver.cpp index 727ad4c0..1c2609e9 100644 --- a/source/Irrlicht/CD3D9Driver.cpp +++ b/source/Irrlicht/CD3D9Driver.cpp @@ -2155,7 +2155,7 @@ IImage* CD3D9Driver::createScreenShot() // returns the current size of the screen or rendertarget -core::dimension2d CD3D9Driver::getCurrentRenderTargetSize() +const core::dimension2d& CD3D9Driver::getCurrentRenderTargetSize() const { if ( CurrentRendertargetSize.Width == 0 ) return ScreenSize; diff --git a/source/Irrlicht/CD3D9Driver.h b/source/Irrlicht/CD3D9Driver.h index dd99cbfe..265d6d0b 100644 --- a/source/Irrlicht/CD3D9Driver.h +++ b/source/Irrlicht/CD3D9Driver.h @@ -232,7 +232,7 @@ namespace video virtual video::ITexture* createDeviceDependentTexture(IImage* surface, const char* name); // returns the current size of the screen or rendertarget - core::dimension2d getCurrentRenderTargetSize(); + virtual const core::dimension2d& getCurrentRenderTargetSize() const; //! Adds a new material renderer to the VideoDriver, using pixel and/or //! vertex shaders to render geometry. diff --git a/source/Irrlicht/CGeometryCreator.cpp b/source/Irrlicht/CGeometryCreator.cpp index fd830631..e190be92 100644 --- a/source/Irrlicht/CGeometryCreator.cpp +++ b/source/Irrlicht/CGeometryCreator.cpp @@ -481,10 +481,12 @@ IMesh* CGeometryCreator::createSphereMesh(f32 radius, u32 polyCountX, u32 polyCo if (polyCountY < 2) polyCountY = 2; if (polyCountX * polyCountY > 32767) // prevent u16 overflow + { if (polyCountX > polyCountY) // prevent u16 overflow polyCountX = 32767/polyCountY-1; else polyCountY = 32767/(polyCountX+1); + } u32 polyCountXPitch = polyCountX+1; // get to same vertex on next level buffer->Vertices.set_used((polyCountXPitch * polyCountY) + 2); diff --git a/source/Irrlicht/CMS3DMeshFileLoader.cpp b/source/Irrlicht/CMS3DMeshFileLoader.cpp index 4952355c..c314d142 100644 --- a/source/Irrlicht/CMS3DMeshFileLoader.cpp +++ b/source/Irrlicht/CMS3DMeshFileLoader.cpp @@ -581,10 +581,12 @@ core::stringc CMS3DMeshFileLoader::stripPathFromString(const core::stringc& inSt if (backSlash>slashIndex) slashIndex=backSlash; if (slashIndex==-1)//no slashes found + { if (returnPath) return core::stringc(); //no path to return else return inString; + } if (returnPath) return inString.subString(0, slashIndex + 1); diff --git a/source/Irrlicht/COpenGLSLMaterialRenderer.h b/source/Irrlicht/COpenGLSLMaterialRenderer.h index b47d155d..9abca1c2 100644 --- a/source/Irrlicht/COpenGLSLMaterialRenderer.h +++ b/source/Irrlicht/COpenGLSLMaterialRenderer.h @@ -50,7 +50,7 @@ public: //! Constructor COpenGLSLMaterialRenderer( - video::COpenGLDriver* driver, + COpenGLDriver* driver, s32& outMaterialTypeNr, const c8* vertexShaderProgram, const c8* vertexShaderEntryPointName, @@ -59,14 +59,14 @@ public: const c8* pixelShaderEntryPointName, E_PIXEL_SHADER_TYPE psCompileTarget, IShaderConstantSetCallBack* callback, - video::IMaterialRenderer* baseMaterial, + IMaterialRenderer* baseMaterial, s32 userData); //! Destructor virtual ~COpenGLSLMaterialRenderer(); - virtual void OnSetMaterial(const video::SMaterial& material, const video::SMaterial& lastMaterial, - bool resetAllRenderstates, video::IMaterialRendererServices* services); + virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, + bool resetAllRenderstates, IMaterialRendererServices* services); virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype); @@ -100,7 +100,7 @@ protected: bool createShader(GLenum shaderType, const char* shader); bool linkProgram(); - video::COpenGLDriver* Driver; + COpenGLDriver* Driver; IShaderConstantSetCallBack* CallBack; IMaterialRenderer* BaseMaterial; diff --git a/source/Irrlicht/COpenGLShaderMaterialRenderer.h b/source/Irrlicht/COpenGLShaderMaterialRenderer.h index c79b982e..16776fb9 100644 --- a/source/Irrlicht/COpenGLShaderMaterialRenderer.h +++ b/source/Irrlicht/COpenGLShaderMaterialRenderer.h @@ -43,15 +43,15 @@ class COpenGLShaderMaterialRenderer : public IMaterialRenderer public: //! Constructor - COpenGLShaderMaterialRenderer(video::COpenGLDriver* driver, + COpenGLShaderMaterialRenderer(COpenGLDriver* driver, s32& outMaterialTypeNr, const c8* vertexShaderProgram, const c8* pixelShaderProgram, IShaderConstantSetCallBack* callback, IMaterialRenderer* baseMaterial, s32 userData); //! Destructor virtual ~COpenGLShaderMaterialRenderer(); - virtual void OnSetMaterial(const video::SMaterial& material, const video::SMaterial& lastMaterial, - bool resetAllRenderstates, video::IMaterialRendererServices* services); + virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, + bool resetAllRenderstates, IMaterialRendererServices* services); virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype); @@ -74,7 +74,7 @@ protected: bool createPixelShader(const c8* pxsh); bool createVertexShader(const char* vtxsh); - video::COpenGLDriver* Driver; + COpenGLDriver* Driver; IShaderConstantSetCallBack* CallBack; IMaterialRenderer* BaseMaterial; diff --git a/source/Irrlicht/CSceneNodeAnimatorFlyCircle.cpp b/source/Irrlicht/CSceneNodeAnimatorFlyCircle.cpp index c55a8ca7..975c7fcf 100644 --- a/source/Irrlicht/CSceneNodeAnimatorFlyCircle.cpp +++ b/source/Irrlicht/CSceneNodeAnimatorFlyCircle.cpp @@ -16,16 +16,20 @@ CSceneNodeAnimatorFlyCircle::CSceneNodeAnimatorFlyCircle(u32 time, const core::v #ifdef _DEBUG setDebugName("CSceneNodeAnimatorFlyCircle"); #endif - Direction.normalize(); + init(); } - -//! destructor -CSceneNodeAnimatorFlyCircle::~CSceneNodeAnimatorFlyCircle() +void CSceneNodeAnimatorFlyCircle::init() { -} + Direction.normalize(); + if (Direction.Y != 0) + VecV = core::vector3df(50,0,0).crossProduct(Direction).normalize(); + else + VecV = core::vector3df(0,50,0).crossProduct(Direction).normalize(); + VecU = VecV.crossProduct(Direction).normalize(); +} //! animates a scene node @@ -36,10 +40,7 @@ void CSceneNodeAnimatorFlyCircle::animateNode(ISceneNode* node, u32 timeMs) const f32 t = (timeMs-StartTime) * Speed; - core::vector3df circle(Radius * sinf(t), 0, Radius * cosf(t)); - circle = circle.crossProduct ( Direction ); - - node->setPosition(Center + circle); + node->setPosition(Center + Radius * ((VecU*cosf(t)) + (VecV*sinf(t)))); } @@ -60,15 +61,16 @@ void CSceneNodeAnimatorFlyCircle::deserializeAttributes(io::IAttributes* in, io: Radius = in->getAttributeAsFloat("Radius"); Speed = in->getAttributeAsFloat("Speed"); Direction = in->getAttributeAsVector3d("Direction"); + StartTime = 0; if (Direction.equals(core::vector3df(0,0,0))) Direction.set(0,1,0); // irrlicht 1.1 backwards compatibility else Direction.normalize(); + init(); } - } // end namespace scene } // end namespace irr diff --git a/source/Irrlicht/CSceneNodeAnimatorFlyCircle.h b/source/Irrlicht/CSceneNodeAnimatorFlyCircle.h index a9113eb2..6a16b5d4 100644 --- a/source/Irrlicht/CSceneNodeAnimatorFlyCircle.h +++ b/source/Irrlicht/CSceneNodeAnimatorFlyCircle.h @@ -16,11 +16,9 @@ namespace scene public: //! constructor - CSceneNodeAnimatorFlyCircle(u32 time, const core::vector3df& center, f32 radius, f32 speed, - const core::vector3df& direction); - - //! destructor - virtual ~CSceneNodeAnimatorFlyCircle(); + CSceneNodeAnimatorFlyCircle(u32 time, + const core::vector3df& center, f32 radius, + f32 speed, const core::vector3df& direction); //! animates a scene node virtual void animateNode(ISceneNode* node, u32 timeMs); @@ -35,9 +33,16 @@ namespace scene virtual ESCENE_NODE_ANIMATOR_TYPE getType() const { return ESNAT_FLY_CIRCLE; } private: + // do some initial calculations + void init(); + // circle center core::vector3df Center; + // up-vector, normal to the circle's plane core::vector3df Direction; + // Two helper vectors + core::vector3df VecU; + core::vector3df VecV; f32 Radius; f32 Speed; u32 StartTime; diff --git a/source/Irrlicht/CXMeshFileLoader.cpp b/source/Irrlicht/CXMeshFileLoader.cpp index fd298205..3bd49e24 100644 --- a/source/Irrlicht/CXMeshFileLoader.cpp +++ b/source/Irrlicht/CXMeshFileLoader.cpp @@ -2083,10 +2083,12 @@ core::stringc CXMeshFileLoader::stripPathFromString(core::stringc string, bool r if (backSlash>slashIndex) slashIndex=backSlash; if (slashIndex==-1)//no slashes found + { if (returnPath) return core::stringc(); //no path to return else return string; + } if (returnPath) return string.subString(0, slashIndex + 1);