Commit 9c9beede authored by hybrid's avatar hybrid

Added texture support for collada meshes. Fixed const parameters in MeshManipulator.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@827 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 21efe402
This diff is collapsed.
...@@ -31,6 +31,7 @@ enum ECOLLADA_PARAM_NAME ...@@ -31,6 +31,7 @@ enum ECOLLADA_PARAM_NAME
ECPN_DIFFUSE, ECPN_DIFFUSE,
ECPN_SPECULAR, ECPN_SPECULAR,
ECPN_SHININESS, ECPN_SHININESS,
ECPN_TRANSPARENCY,
ECPN_YFOV, ECPN_YFOV,
ECPN_ZNEAR, ECPN_ZNEAR,
ECPN_ZFAR, ECPN_ZFAR,
...@@ -71,6 +72,8 @@ enum ECOLLADA_INPUT_SEMANTIC ...@@ -71,6 +72,8 @@ enum ECOLLADA_INPUT_SEMANTIC
ECIS_TEXCOORD, ECIS_TEXCOORD,
ECIS_UV, ECIS_UV,
ECIS_TANGENT, ECIS_TANGENT,
ECIS_IMAGE,
ECIS_TEXTURE,
ECIS_COUNT ECIS_COUNT
}; };
...@@ -87,6 +90,22 @@ struct SColladaInput ...@@ -87,6 +90,22 @@ struct SColladaInput
core::stringc Source; core::stringc Source;
}; };
//! Collada images
struct SColladaImage
{
core::stringc Filename;
core::stringc Id;
};
//! Collada texture
struct SColladaTexture
{
video::ITexture* Texture;
core::stringc Id;
};
//! Collada material //! Collada material
struct SColladaMaterial struct SColladaMaterial
{ {
...@@ -196,6 +215,12 @@ private: ...@@ -196,6 +215,12 @@ private:
//! reads a <camera> element and stores it as prefab //! reads a <camera> element and stores it as prefab
void readCameraPrefab(io::IXMLReaderUTF8* reader); void readCameraPrefab(io::IXMLReaderUTF8* reader);
//! reads a <image> element and stores it in the image section
void readImage(io::IXMLReaderUTF8* reader);
//! reads a <texture> element and stores it in the texture section
void readTexture(io::IXMLReaderUTF8* reader);
//! reads a <material> element and stores it in the material section //! reads a <material> element and stores it in the material section
void readMaterial(io::IXMLReaderUTF8* reader); void readMaterial(io::IXMLReaderUTF8* reader);
...@@ -214,7 +239,7 @@ private: ...@@ -214,7 +239,7 @@ private:
void findNextNoneWhiteSpace(const c8** p); void findNextNoneWhiteSpace(const c8** p);
//! reads floats from inside of xml element until end of xml element //! reads floats from inside of xml element until end of xml element
void readFloatsInsideElement(io::IXMLReaderUTF8* reader, f32* floats, s32 count); void readFloatsInsideElement(io::IXMLReaderUTF8* reader, f32* floats, u32 count);
//! clears all loaded data //! clears all loaded data
void clearData(); void clearData();
...@@ -225,7 +250,7 @@ private: ...@@ -225,7 +250,7 @@ private:
//! returns a collada parameter or none if not found //! returns a collada parameter or none if not found
SColladaParam* getColladaParameter(ECOLLADA_PARAM_NAME name); SColladaParam* getColladaParameter(ECOLLADA_PARAM_NAME name);
//! parses all collada inuts inside an element and stores them in Inputs. Reads //! parses all collada inputs inside an element and stores them in Inputs. Reads
//! until first tag which is not an input tag or the end of the parent is reached //! until first tag which is not an input tag or the end of the parent is reached
void readColladaInputs(io::IXMLReaderUTF8* reader, const core::stringc& parentName); void readColladaInputs(io::IXMLReaderUTF8* reader, const core::stringc& parentName);
...@@ -256,6 +281,8 @@ private: ...@@ -256,6 +281,8 @@ private:
core::array<IColladaPrefab*> Prefabs; core::array<IColladaPrefab*> Prefabs;
core::array<SColladaParam> Parameters; core::array<SColladaParam> Parameters;
core::array<SColladaImage> Images;
core::array<SColladaTexture> Textures;
core::array<SColladaMaterial> Materials; core::array<SColladaMaterial> Materials;
core::array<SColladaInput> Inputs; core::array<SColladaInput> Inputs;
......
...@@ -803,8 +803,8 @@ void CMeshManipulator::calculateTangents( ...@@ -803,8 +803,8 @@ void CMeshManipulator::calculateTangents(
core::vector3df& normal, core::vector3df& normal,
core::vector3df& tangent, core::vector3df& tangent,
core::vector3df& binormal, core::vector3df& binormal,
core::vector3df& vt1, core::vector3df& vt2, core::vector3df& vt3, // vertices const core::vector3df& vt1, const core::vector3df& vt2, const core::vector3df& vt3, // vertices
core::vector2df& tc1, core::vector2df& tc2, core::vector2df& tc3) // texture coords const core::vector2df& tc1, const core::vector2df& tc2, const core::vector2df& tc3) // texture coords
{ {
// choose one of them: // choose one of them:
//#define USE_NVIDIA_GLH_VERSION // use version used by nvidia in glh headers //#define USE_NVIDIA_GLH_VERSION // use version used by nvidia in glh headers
......
...@@ -98,8 +98,8 @@ private: ...@@ -98,8 +98,8 @@ private:
static void calculateTangents(core::vector3df& normal, static void calculateTangents(core::vector3df& normal,
core::vector3df& tangent, core::vector3df& tangent,
core::vector3df& binormal, core::vector3df& binormal,
core::vector3df& vt1, core::vector3df& vt2, core::vector3df& vt3, const core::vector3df& vt1, const core::vector3df& vt2, const core::vector3df& vt3,
core::vector2df& tc1, core::vector2df& tc2, core::vector2df& tc3); const core::vector2df& tc1, const core::vector2df& tc2, const core::vector2df& tc3);
}; };
} // end namespace scene } // end namespace scene
......
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