aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/source/Irrlicht/CMY3DMeshFileLoader.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CMY3DMeshFileLoader.h')
-rw-r--r--libraries/irrlicht-1.8/source/Irrlicht/CMY3DMeshFileLoader.h131
1 files changed, 131 insertions, 0 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CMY3DMeshFileLoader.h b/libraries/irrlicht-1.8/source/Irrlicht/CMY3DMeshFileLoader.h
new file mode 100644
index 0000000..716478d
--- /dev/null
+++ b/libraries/irrlicht-1.8/source/Irrlicht/CMY3DMeshFileLoader.h
@@ -0,0 +1,131 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4//
5// This file was originally written by ZDimitor.
6// I (Nikolaus Gebhardt) did some few changes to this:
7// - replaced logging calls to their os:: counterparts
8// - removed some logging calls
9// - removed setTexture path and replaced it with the directory of the mesh
10// - added EAMT_MY3D file type
11// - fixed a memory leak when decompressing RLE data.
12// - cleaned multi character constant problems with gcc
13// - removed octree child scene node generation because irrlicht is now able to draw
14// scene nodes with transparent and sold materials in them at the same time. (see changes.txt)
15// Thanks a lot to ZDimitor for his work on this and that he gave me
16// his permission to add it into Irrlicht.
17
18//--------------------------------------------------------------------------------
19// This tool created by ZDimitor everyone can use it as wants
20//--------------------------------------------------------------------------------
21
22#ifndef __CMY3D_MESH_FILE_LOADER_H_INCLUDED__
23#define __CMY3D_MESH_FILE_LOADER_H_INCLUDED__
24
25
26#ifdef _MSC_VER
27#if _MSC_VER > 1000
28#pragma once
29#endif // _MSC_VER > 1000
30#endif
31
32
33#include "IMeshLoader.h"
34#include "SMesh.h"
35#include "SMeshBufferLightMap.h"
36#include "IFileSystem.h"
37#include "IVideoDriver.h"
38#include "irrString.h"
39#include "ISceneManager.h"
40
41namespace irr
42{
43namespace scene
44{
45
46// byte-align structures
47#include "irrpack.h"
48
49struct SMyColor
50{ SMyColor () {;}
51 SMyColor (s32 __R, s32 __G, s32 __B, s32 __A)
52 : R(__R), G(__G), B(__B), A(__A) {}
53 s32 R, G, B, A;
54} PACK_STRUCT;
55
56// material header
57struct SMyMaterialHeader
58{ c8 Name[256]; // material name
59 u32 Index;
60 SMyColor AmbientColor;
61 SMyColor DiffuseColor;
62 SMyColor EmissiveColor;
63 SMyColor SpecularColor;
64 f32 Shininess;
65 f32 Transparency;
66 u32 TextureCount; // texture count
67} PACK_STRUCT;
68
69// Default alignment
70#include "irrunpack.h"
71
72class CMY3DMeshFileLoader : public IMeshLoader
73{
74public:
75 CMY3DMeshFileLoader(ISceneManager *scmgr, io::IFileSystem* fs);
76 virtual ~CMY3DMeshFileLoader();
77
78 virtual bool isALoadableFileExtension(const io::path& filename) const;
79
80 virtual IAnimatedMesh* createMesh(io::IReadFile* file);
81
82 //! getting access to the nodes (with transparent material), creating
83 //! while loading .my3d file
84 const core::array<ISceneNode*>& getChildNodes() const;
85
86private:
87
88 video::ITexture* readEmbeddedLightmap(io::IReadFile* file, char* namebuf);
89
90 scene::ISceneManager* SceneManager;
91 io::IFileSystem* FileSystem;
92
93 struct SMyMaterialEntry
94 {
95 SMyMaterialEntry ()
96 : Texture1FileName("null"), Texture2FileName("null"),
97 Texture1(0), Texture2(0), MaterialType(video::EMT_SOLID) {}
98
99 SMyMaterialHeader Header;
100 core::stringc Texture1FileName;
101 core::stringc Texture2FileName;
102 video::ITexture *Texture1;
103 video::ITexture *Texture2;
104 video::E_MATERIAL_TYPE MaterialType;
105 };
106
107 struct SMyMeshBufferEntry
108 {
109 SMyMeshBufferEntry() : MaterialIndex(-1), MeshBuffer(0) {}
110 SMyMeshBufferEntry(s32 mi, SMeshBufferLightMap* mb)
111 : MaterialIndex(mi), MeshBuffer(mb) {}
112
113 s32 MaterialIndex;
114 SMeshBufferLightMap* MeshBuffer;
115 };
116
117 SMyMaterialEntry* getMaterialEntryByIndex (u32 matInd);
118 SMeshBufferLightMap* getMeshBufferByMaterialIndex(u32 matInd);
119
120 core::array<SMyMaterialEntry> MaterialEntry;
121 core::array<SMyMeshBufferEntry> MeshBufferEntry;
122
123 core::array<ISceneNode*> ChildNodes;
124};
125
126
127} // end namespace scene
128} // end namespace irr
129
130
131#endif // __CMY3D_MESH_FILE_LOADER_H_INCLUDED__