Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eae01b2
commit 8b4eefd
Showing
43 changed files
with
5,782 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
- write local mesh matrix for splitted objects | ||
|
||
remove calculateMeshNameWithBlockIndex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
/* | ||
Copyright (c) 2009 NetAllied Systems GmbH | ||
This file is part of dae23ds. | ||
Licensed under the MIT Open Source License, | ||
for details please see LICENSE file or the website | ||
http://www.opensource.org/licenses/mit-license.php | ||
*/ | ||
|
||
#ifndef __DAE23DS_BASEWRITER_H__ | ||
#define __DAE23DS_BASEWRITER_H__ | ||
|
||
#include "DAE23dsPrerequisites.h" | ||
#include "DAE23dsWriter.h" | ||
|
||
|
||
namespace DAE23ds | ||
{ | ||
|
||
static const char FILENAME[] = "MAXSCENE"; | ||
|
||
class BaseWriter | ||
{ | ||
public: | ||
|
||
private: | ||
Writer* mWriter; | ||
|
||
public: | ||
BaseWriter( Writer* writer3ds); | ||
|
||
virtual ~BaseWriter(); | ||
|
||
static void reportError(const String& method, const String& message, Writer::Severity severity); | ||
|
||
const Writer::GeometryUniqueIdInstanceGeometryInfoMap& getGeometryUniqueIdInstanceGeometryInfoMap(); | ||
|
||
void addInstanceGeometryInstanceGeometryInfoPair(const COLLADAFW::UniqueId& geoId, const Writer::InstanceGeometryInfo& instanceGeoInfo); | ||
|
||
void addInstanceGeometryObjectId( const Writer::InstanceGeometryIdentifier& instanceGeometryIdentifier, const Writer::ObjectId& objectId ); | ||
|
||
const Writer::ObjectIdList& getInstanceGeometryObjectIds( const Writer::InstanceGeometryIdentifier& instanceGeometryIdentifier ); | ||
|
||
const Writer::UniqueIdFWMaterialMap& getUniqueIdFWMaterialMap() { return mWriter->getUniqueIdFWMaterialMap(); } | ||
|
||
const COLLADAFW::Material* getFWMaterialByUniqueId(const COLLADAFW::UniqueId& materialUniqueId); | ||
|
||
const Writer::UniqueIdFWImageMap& getUniqueIdFWImageMap() { return mWriter->getUniqueIdFWImageMap(); } | ||
|
||
const Writer::UniqueIdFWEffectMap& getUniqueIdFWEffectMap() { return mWriter->getUniqueIdFWEffectMap(); } | ||
|
||
const COLLADAFW::Effect* getFWEffectByUniqueId(const COLLADAFW::UniqueId& effectUniqueId); | ||
|
||
void addUniqueIdMaterialNumberPair( const COLLADAFW::UniqueId& materialUniqueId, MaterialNumber materialNumber ); | ||
|
||
MaterialNumber getMaterialNumberByUniqueId( const COLLADAFW::UniqueId& materialUniqueId ); | ||
|
||
const String& getFileNameByGeometryMaterialBinding(const Writer::GeometryMaterialBinding& binding) const; | ||
|
||
void addGeometryMaterialBindingFileNamePair(const Writer::GeometryMaterialBinding& binding, const String& fileName); | ||
|
||
size_t getAndIncreaseMeshOccurence(const COLLADAFW::UniqueId& meshUniqueId); | ||
|
||
const COLLADABU::URI& getInputFile() const { return mWriter->getInputFile(); } | ||
|
||
const COLLADABU::URI& getOutputFile() const { return mWriter->getOutputFile(); } | ||
|
||
Common::Buffer& getBuffer() { return mWriter->getBuffer(); } | ||
|
||
/** The chunk length of all object block and material blocks.*/ | ||
ChunkLength getObjectAndMaterialBlockLength() const { return mWriter->getObjectAndMaterialBlockLength(); } | ||
|
||
/** The chunk length of all object block and material blocks.*/ | ||
void setObjectAndMaterialBlockLength(ChunkLength val) { mWriter->setObjectAndMaterialBlockLength(val); } | ||
|
||
void addToObjectAndMaterialBlockLength(ChunkLength val); | ||
|
||
void addMeshData( const Writer::MeshData& meshData ); | ||
|
||
const Writer::MeshData& getMeshData( const COLLADAFW::UniqueId& meshUniqueId ) const; | ||
|
||
Writer::UniqueIdNodeMap& getUniqueIdNodeMap() { return mWriter->getUniqueIdNodeMap(); } | ||
|
||
/** The Object Id of the next object that will be exported.*/ | ||
Writer::ObjectId getNextObjectId() const { return mWriter->getNextObjectId(); } | ||
|
||
/** Returns and increases the Object Id of the next object that will be exported.*/ | ||
Writer::ObjectId getAndIncreaseNextObjectId() const; | ||
|
||
/** The Object Id of the next object that will be exported.*/ | ||
MaterialNumber getNextMaterialNumber() const { return mWriter->getNextMaterialNumber(); } | ||
|
||
/** Returns and increases the Object Id of the next object that will be exported.*/ | ||
MaterialNumber getAndIncreaseNextMaterialNumber() const; | ||
|
||
/** If true, all the transformations will be applied to meshes and the scene graph will not contain any meshes.*/ | ||
bool getApplyTransformationsToMeshes() const { return mWriter->getApplyTransformationsToMeshes(); } | ||
|
||
|
||
|
||
private: | ||
|
||
/** Disable default copy ctor. */ | ||
BaseWriter( const BaseWriter& pre ); | ||
|
||
/** Disable default assignment operator. */ | ||
const BaseWriter& operator= ( const BaseWriter& pre ); | ||
|
||
}; | ||
|
||
|
||
// do not use in threads!!!!! | ||
template<size_t MAX_LENGTH> | ||
const char* calculateNameWithIndex( ChunkLength index, const String& name ) | ||
{ | ||
// we do not support to big meshes here | ||
assert(index < 10000); | ||
static char buffer[MAX_LENGTH + 1]; | ||
size_t basePartLength = min( name.length(), MAX_LENGTH - 4); | ||
char* p = buffer; | ||
memcpy( p, name.c_str(), basePartLength); | ||
p += basePartLength; | ||
if ( index < 1000) *(p++) = '0'; | ||
if ( index < 100) *(p++) = '0'; | ||
if ( index < 10) *(p++) = '0'; | ||
p += Common::itoa( index, p, 10); | ||
*(p++) = 0; | ||
return buffer; | ||
} | ||
|
||
|
||
template<class T> | ||
T min(T a, T b) | ||
{ | ||
return (a<b) ? a : b; | ||
} | ||
|
||
|
||
ChunkLength getNodeNameLength( const COLLADAFW::Node* node ); | ||
|
||
|
||
} // namespace DAE23ds | ||
|
||
#endif // __DAE23DS_BASEWRITER_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
Copyright (c) 2009 NetAllied Systems GmbH | ||
This file is part of dae23ds. | ||
Licensed under the MIT Open Source License, | ||
for details please see LICENSE file or the website | ||
http://www.opensource.org/licenses/mit-license.php | ||
*/ | ||
|
||
#ifndef __DAE23DS_BITSET_H__ | ||
#define __DAE23DS_BITSET_H__ | ||
|
||
#include "DAE23dsPrerequisites.h" | ||
|
||
|
||
namespace DAE23ds | ||
{ | ||
|
||
/** Fixed size bit set.*/ | ||
class BitSet | ||
{ | ||
private: | ||
|
||
/** The buffer that contains the bits.*/ | ||
char* mBuffer; | ||
|
||
/** The number of bits.*/ | ||
size_t mBitCount; | ||
|
||
public: | ||
|
||
/** Constructor. | ||
@param bitCount number of bits*/ | ||
BitSet( size_t bitCount ); | ||
|
||
/** Constructor. | ||
@param bitCount number of bits | ||
@param defaultValue the value the bits should be set on construction*/ | ||
BitSet( size_t bitCount, bool defaultValue ); | ||
|
||
|
||
/** Destructor. */ | ||
virtual ~BitSet(); | ||
|
||
/** Sets the n'th bit. No check is performed if n is in [0...bitCount]*/ | ||
void setBit( size_t n, bool value); | ||
|
||
/** Returns the n'th bit. No check is performed if n is in [0...bitCount]*/ | ||
bool setBit( size_t n); | ||
|
||
private: | ||
|
||
/** Disable default copy ctor. */ | ||
BitSet( const BitSet& pre ); | ||
|
||
/** Disable default assignment operator. */ | ||
const BitSet& operator= ( const BitSet& pre ); | ||
|
||
}; | ||
|
||
} // namespace DAE23ds | ||
|
||
#endif // __DAE23DS_BITSET_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
/* | ||
Copyright (c) 2009 NetAllied Systems GmbH | ||
This file is part of dae23ds. | ||
Licensed under the MIT Open Source License, | ||
for details please see LICENSE file or the website | ||
http://www.opensource.org/licenses/mit-license.php | ||
*/ | ||
|
||
#ifndef __DAE23DS_CHUNKIDS_H__ | ||
#define __DAE23DS_CHUNKIDS_H__ | ||
|
||
#include "DAE23dsPrerequisites.h" | ||
|
||
|
||
namespace DAE23ds | ||
{ | ||
|
||
typedef unsigned short ChunkID; | ||
|
||
|
||
//>------ Primary chunk | ||
|
||
static const ChunkID MAIN3DS = 0x4D4D; | ||
|
||
//>------ Main Chunks | ||
|
||
static const ChunkID EDIT3DS = 0x3D3D; // this is the start of the editor config | ||
static const ChunkID MESH3DS_VERSION= 0x3D3E; // the mesh version | ||
static const ChunkID KEYF3DS = 0xB000; // this is the start of the keyframer config | ||
static const ChunkID M3D3DS_VERSION = 0x0002; // M3D_VERSION | ||
|
||
//>------ sub defines of EDIT3DS | ||
|
||
static const ChunkID EDIT_MATERIAL = 0xAFFF; | ||
static const ChunkID EDIT_MASTERSCALE = 0x0100; | ||
static const ChunkID EDIT_CONFIG2 = 0x3E3D; | ||
static const ChunkID EDIT_VIEW_P1 = 0x7012; | ||
static const ChunkID EDIT_VIEW_P2 = 0x7011; | ||
static const ChunkID EDIT_VIEW_P3 = 0x7020; | ||
static const ChunkID EDIT_VIEW1 = 0x7001; | ||
static const ChunkID EDIT_BACKGR = 0x1200; | ||
static const ChunkID EDIT_AMBIENT = 0x2100; | ||
static const ChunkID EDIT_OBJECT = 0x4000; | ||
|
||
static const ChunkID EDIT_UNKNW01 = 0x1100; | ||
static const ChunkID EDIT_UNKNW02 = 0x1201; | ||
static const ChunkID EDIT_UNKNW03 = 0x1300; | ||
static const ChunkID EDIT_UNKNW04 = 0x1400; | ||
static const ChunkID EDIT_UNKNW05 = 0x1420; | ||
static const ChunkID EDIT_UNKNW06 = 0x1450; | ||
static const ChunkID EDIT_UNKNW07 = 0x1500; | ||
static const ChunkID EDIT_UNKNW08 = 0x2200; | ||
static const ChunkID EDIT_UNKNW09 = 0x2201; | ||
static const ChunkID EDIT_UNKNW10 = 0x2210; | ||
static const ChunkID EDIT_UNKNW11 = 0x2300; | ||
static const ChunkID EDIT_UNKNW12 = 0x2302; | ||
static const ChunkID EDIT_UNKNW13 = 0x3000; | ||
static const ChunkID EDIT_UNKNW14 = 0xAFFF; | ||
|
||
//>------ sub defines of EDIT_OBJECT | ||
static const ChunkID OBJ_TRIMESH = 0x4100; | ||
static const ChunkID OBJ_LIGHT = 0x4600; | ||
static const ChunkID OBJ_CAMERA = 0x4700; | ||
|
||
static const ChunkID OBJ_UNKNWN01 = 0x4010; | ||
static const ChunkID OBJ_UNKNWN02 = 0x4012; //>>---- Could be shadow | ||
|
||
//>------ sub defines of OBJ_CAMERA | ||
static const ChunkID CAM_UNKNWN01 = 0x4710; | ||
static const ChunkID CAM_UNKNWN02 = 0x4720; | ||
|
||
//>------ sub defines of OBJ_LIGHT | ||
static const ChunkID LIT_OFF = 0x4620; | ||
static const ChunkID LIT_SPOT = 0x4610; | ||
static const ChunkID LIT_UNKNWN01 = 0x465A; | ||
|
||
//>------ sub defines of OBJ_TRIMESH | ||
static const ChunkID TRI_VERTEXL = 0x4110; | ||
static const ChunkID TRI_FACEL2 = 0x4111; | ||
static const ChunkID TRI_FACEL1 = 0x4120; | ||
static const ChunkID TRI_FACES_MAT = 0x4130; | ||
static const ChunkID TRI_SMOOTH = 0x4150; | ||
static const ChunkID TRI_LOCAL = 0x4160; | ||
static const ChunkID TRI_VISIBLE = 0x4165; | ||
|
||
|
||
//>>------ sub defs of EDIT_MATERIAL | ||
static const ChunkID MATERIAL_NAME = 0xA000; | ||
static const ChunkID MATERIAL_AMBIENT_COLOR = 0xA010; | ||
static const ChunkID MATERIAL_DIFFUSE_COLOR = 0xA020; | ||
static const ChunkID MATERIAL_SPECULAR_COLOR = 0xA030; | ||
|
||
|
||
//>>------ sub defs of KEYF3DS | ||
|
||
static const ChunkID KEYF_CURTIME = 0xB009; | ||
static const ChunkID KEYF_OBJDES = 0xB002; | ||
static const ChunkID KEYF_OBJHIERARCH = 0xB010; | ||
static const ChunkID KEYF_NODE_ID = 0xB030; | ||
static const ChunkID POS_TRACK_TAG = 0xB020; | ||
static const ChunkID ROT_TRACK_TAG = 0xB021; | ||
static const ChunkID SCL_TRACK_TAG = 0xB022; | ||
static const ChunkID PIVOT = 0xB013; | ||
static const ChunkID KEYF_HDR = 0xB00A; | ||
static const ChunkID KEYF_FRAMES = 0xB008; | ||
|
||
//>>------ these define the different color chunk types | ||
static const ChunkID COL_RGB = 0x0010; | ||
static const ChunkID COL_TRU = 0x0011; | ||
static const ChunkID COL_UNK = 0x0013; | ||
|
||
//>>------ defines for viewport chunks | ||
|
||
static const ChunkID TOP = 0x0001; | ||
static const ChunkID BOTTOM = 0x0002; | ||
static const ChunkID LEFT = 0x0003; | ||
static const ChunkID RIGHT = 0x0004; | ||
static const ChunkID FRONT = 0x0005; | ||
static const ChunkID BACK = 0x0006; | ||
static const ChunkID USER = 0x0007; | ||
static const ChunkID CAMERA = 0x0008; // 0xFFFF is the actual code read from file | ||
static const ChunkID LIGHT = 0x0009; | ||
static const ChunkID DISABLED = 0x0010; | ||
static const ChunkID BOGUS = 0x0011; | ||
|
||
} // namespace DAE23ds | ||
|
||
#endif // __DAE23DS_CHUNKIDS_H__ |
Oops, something went wrong.