Added: #1440 Basic export of a TriObject to obj

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent 58d57d3304
commit 6e8e6ab86a

@ -52,6 +52,60 @@ CBaseObject::~CBaseObject()
}
const ucstring CBaseObject::DisplayName = ucstring("BaseObject");
const char *CBaseObject::InternalName = "BaseObject";
// const char *CBaseObject::InternalNameUnknown = "BaseObjectUnknown";
const NLMISC::CClassId CBaseObject::ClassId = NLMISC::CClassId(0x71c8167a, 0x5a9f57b2); /* Not official, please correct */
const TSClassId CBaseObject::SuperClassId = CReferenceTarget::SuperClassId;
const CBaseObjectClassDesc BaseObjectClassDesc(&DllPluginDescBuiltin);
// const CBaseObjectSuperClassDesc BaseObjectSuperClassDesc(&BaseObjectClassDesc);
void CBaseObject::parse(uint16 version)
{
CReferenceTarget::parse(version);
}
void CBaseObject::clean()
{
CReferenceTarget::clean();
}
void CBaseObject::build(uint16 version)
{
CReferenceTarget::build(version);
}
void CBaseObject::disown()
{
CReferenceTarget::disown();
}
void CBaseObject::init()
{
CReferenceTarget::init();
}
bool CBaseObject::inherits(const NLMISC::CClassId classId) const
{
if (classId == classDesc()->classId()) return true;
return CReferenceTarget::inherits(classId);
}
const ISceneClassDesc *CBaseObject::classDesc() const
{
return &BaseObjectClassDesc;
}
void CBaseObject::toStringLocal(std::ostream &ostream, const std::string &pad) const
{
CReferenceTarget::toStringLocal(ostream, pad);
}
IStorageObject *CBaseObject::createChunkById(uint16 id, bool container)
{
return CReferenceTarget::createChunkById(id, container);
}
} /* namespace BUILTIN */
} /* namespace MAX */
} /* namespace PIPELINE */

@ -52,8 +52,34 @@ public:
CBaseObject(CScene *scene);
virtual ~CBaseObject();
// class desc
static const ucstring DisplayName;
static const char *InternalName;
// static const char *InternalNameUnknown;
static const NLMISC::CClassId ClassId;
static const TSClassId SuperClassId;
// inherited
virtual void parse(uint16 version);
virtual void clean();
virtual void build(uint16 version);
virtual void disown();
virtual void init();
virtual bool inherits(const NLMISC::CClassId classId) const;
virtual const ISceneClassDesc *classDesc() const;
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "") const;
protected:
// inherited
virtual IStorageObject *createChunkById(uint16 id, bool container);
}; /* class CBaseObject */
typedef CSceneClassDesc<CBaseObject> CBaseObjectClassDesc;
extern const CBaseObjectClassDesc BaseObjectClassDesc;
// typedef CSuperClassDesc<CBaseObject> CBaseObjectSuperClassDesc;
// extern const CBaseObjectSuperClassDesc BaseObjectSuperClassDesc;
} /* namespace BUILTIN */
} /* namespace MAX */
} /* namespace PIPELINE */

@ -48,6 +48,10 @@
#include "track_view_node.h"
#include "base_object.h"
#include "object.h"
#include "geom_object.h"
// using namespace std;
// using namespace NLMISC;
@ -132,19 +136,19 @@ const COSModifierSuperClassDesc OSModifierSuperClassDesc(&ReferenceTargetClassDe
// 0x9010 - master point controller
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00009010> CMasterPointControllerSuperClassDesc;
const CMasterPointControllerSuperClassDesc MasterPointControllerSuperClassDesc(&ReferenceTargetClassDesc, "MasterPointControllerSuperClassUnknown");
/*
// 0x10 - geom object
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000010> CGeomObjectSuperClassDesc;
const CGeomObjectSuperClassDesc GeomObjectSuperClassDesc(&ReferenceTargetClassDesc, "GeomObjectSuperClassUnknown");
*/
// 0x10f0 - layer, under reftarget directly
typedef CSuperClassDescUnknown<CReferenceTarget, 0x000010f0> CLayerSuperClassDesc;
const CLayerSuperClassDesc LayerSuperClassDesc(&ReferenceTargetClassDesc, "LayerSuperClassUnknown");
/*
// 0x60 - object???, under base object
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000060> CObjectSuperClassDesc;
const CObjectSuperClassDesc ObjectSuperClassDesc(&ReferenceTargetClassDesc, "ObjectSuperClassUnknown");
*/
// 0x50 helperobject, under object...
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000050> CHelperObjectSuperClassDesc;
const CHelperObjectSuperClassDesc HelperObjectSuperClassDesc(&ReferenceTargetClassDesc, "HelperObjectSuperClassUnknown");
@ -228,8 +232,8 @@ void CBuiltin::registerClasses(CSceneClassRegistry *registry)
// node (inh ReferenceTarget)
registry->add(&NodeSuperClassDesc);
registry->add(&NodeClassDesc);
{
registry->add(&NodeClassDesc);
registry->add(&NodeImplClassDesc);
registry->add(&RootNodeClassDesc);
}
@ -237,6 +241,17 @@ void CBuiltin::registerClasses(CSceneClassRegistry *registry)
// tvnode (inh ReferenceTarget)
registry->add(&TrackViewNodeClassDesc);
// object (inh ReferenceMaker)
registry->add(&BaseObjectClassDesc);
{
registry->add(&ObjectSuperClassDesc);
registry->add(&ObjectClassDesc);
{
registry->add(&GeomObjectSuperClassDesc);
registry->add(&GeomObjectClassDesc);
}
}
// unimplemented
registry->add(&ControlFloatSuperClassDesc);
registry->add(&ParamBlockSuperClassDesc);
@ -256,9 +271,9 @@ void CBuiltin::registerClasses(CSceneClassRegistry *registry)
registry->add(&ControlTransformSuperClassDesc);
registry->add(&OSModifierSuperClassDesc);
registry->add(&MasterPointControllerSuperClassDesc);
registry->add(&GeomObjectSuperClassDesc);
//registry->add(&GeomObjectSuperClassDesc);
registry->add(&LayerSuperClassDesc);
registry->add(&ObjectSuperClassDesc);
//registry->add(&ObjectSuperClassDesc);
registry->add(&HelperObjectSuperClassDesc);
registry->add(&FilterKernelSuperClassDesc);
registry->add(&RendererSuperClassDesc);

@ -1,9 +1,9 @@
/**
* \file geom_object.cpp
* \brief CGeomObject
* \brief CGeomGeomObject
* \date 2012-08-22 08:58GMT
* \author Jan Boon (Kaetemi)
* CGeomObject
* CGeomGeomObject
*/
/*
@ -34,15 +34,18 @@
// #include <nel/misc/debug.h>
// Project includes
#include "storage/geom_buffers.h"
using namespace std;
// using namespace std;
// using namespace NLMISC;
namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CGeomObject::CGeomObject()
#define PMB_GEOM_BUFFERS_CHUNK_ID 0x08fe
CGeomObject::CGeomObject(CScene *scene) : CObject(scene)
{
}
@ -52,6 +55,65 @@ CGeomObject::~CGeomObject()
}
const ucstring CGeomObject::DisplayName = ucstring("GeomObject");
const char *CGeomObject::InternalName = "GeomObject";
const char *CGeomObject::InternalNameUnknown = "GeomObjectUnknown";
const NLMISC::CClassId CGeomObject::ClassId = NLMISC::CClassId(0x37097c44, 0x38aa3f24); /* Not official, please correct */
const TSClassId CGeomObject::SuperClassId = 0x00000010;
const CGeomObjectClassDesc GeomObjectClassDesc(&DllPluginDescBuiltin);
const CGeomObjectSuperClassDesc GeomObjectSuperClassDesc(&GeomObjectClassDesc);
void CGeomObject::parse(uint16 version)
{
CObject::parse(version);
}
void CGeomObject::clean()
{
CObject::clean();
}
void CGeomObject::build(uint16 version)
{
CObject::build(version);
}
void CGeomObject::disown()
{
CObject::disown();
}
void CGeomObject::init()
{
CObject::init();
}
bool CGeomObject::inherits(const NLMISC::CClassId classId) const
{
if (classId == classDesc()->classId()) return true;
return CObject::inherits(classId);
}
const ISceneClassDesc *CGeomObject::classDesc() const
{
return &GeomObjectClassDesc;
}
void CGeomObject::toStringLocal(std::ostream &ostream, const std::string &pad) const
{
CObject::toStringLocal(ostream, pad);
}
IStorageObject *CGeomObject::createChunkById(uint16 id, bool container)
{
switch (id)
{
case PMB_GEOM_BUFFERS_CHUNK_ID:
return new STORAGE::CGeomBuffers();
}
return CObject::createChunkById(id, container);
}
} /* namespace BUILTIN */
} /* namespace MAX */
} /* namespace PIPELINE */

@ -1,9 +1,9 @@
/**
* \file geom_object.h
* \brief CGeomObject
* \brief CGeomGeomObject
* \date 2012-08-22 08:58GMT
* \author Jan Boon (Kaetemi)
* CGeomObject
* CGeomGeomObject
*/
/*
@ -34,30 +34,52 @@
// NeL includes
// Project includes
#include "object.h"
namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
/**
* \brief CGeomObject
* \brief CGeomGeomObject
* \date 2012-08-22 08:58GMT
* \author Jan Boon (Kaetemi)
* CGeomObject
* CGeomGeomObject
*/
class CGeomObject
class CGeomObject : public CObject
{
protected:
// pointers
// ...
// instances
// ...
public:
CGeomObject();
CGeomObject(CScene *scene);
virtual ~CGeomObject();
// class desc
static const ucstring DisplayName;
static const char *InternalName;
static const char *InternalNameUnknown;
static const NLMISC::CClassId ClassId;
static const TSClassId SuperClassId;
// inherited
virtual void parse(uint16 version);
virtual void clean();
virtual void build(uint16 version);
virtual void disown();
virtual void init();
virtual bool inherits(const NLMISC::CClassId classId) const;
virtual const ISceneClassDesc *classDesc() const;
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "") const;
protected:
// inherited
virtual IStorageObject *createChunkById(uint16 id, bool container);
}; /* class CGeomObject */
typedef CSceneClassDesc<CGeomObject> CGeomObjectClassDesc;
extern const CGeomObjectClassDesc GeomObjectClassDesc;
typedef CSuperClassDesc<CGeomObject> CGeomObjectSuperClassDesc;
extern const CGeomObjectSuperClassDesc GeomObjectSuperClassDesc;
} /* namespace BUILTIN */
} /* namespace MAX */
} /* namespace PIPELINE */

@ -156,6 +156,19 @@ const ucstring &INode::userName() const
return v;
}
INode *INode::find(const ucstring &userName) const
{
ucstring unl = NLMISC::toLower(userName);
for (std::set<NLMISC::CRefPtr<INode> >::iterator it = m_Children.begin(), end = m_Children.end(); it != end; ++it)
{
INode *node = (*it);
nlassert(node);
if (NLMISC::toLower(node->userName()) == unl)
return node;
}
return NULL;
}
void INode::dumpNodes(std::ostream &ostream, const std::string &pad) const
{
ostream << "<ptr=0x";

@ -75,6 +75,7 @@ public:
virtual void addChild(INode *node);
virtual void removeChild(INode *node); // does not delete
virtual const ucstring &userName() const;
INode *find(const ucstring &userName) const;
// dump
void dumpNodes(std::ostream &ostream, const std::string &pad = "") const;

@ -52,6 +52,60 @@ CObject::~CObject()
}
const ucstring CObject::DisplayName = ucstring("Object");
const char *CObject::InternalName = "Object";
const char *CObject::InternalNameUnknown = "ObjectUnknown";
const NLMISC::CClassId CObject::ClassId = NLMISC::CClassId(0x14021ed1, 0x33837a80); /* Not official, please correct */
const TSClassId CObject::SuperClassId = 0x00000060;
const CObjectClassDesc ObjectClassDesc(&DllPluginDescBuiltin);
const CObjectSuperClassDesc ObjectSuperClassDesc(&ObjectClassDesc);
void CObject::parse(uint16 version)
{
CBaseObject::parse(version);
}
void CObject::clean()
{
CBaseObject::clean();
}
void CObject::build(uint16 version)
{
CBaseObject::build(version);
}
void CObject::disown()
{
CBaseObject::disown();
}
void CObject::init()
{
CBaseObject::init();
}
bool CObject::inherits(const NLMISC::CClassId classId) const
{
if (classId == classDesc()->classId()) return true;
return CBaseObject::inherits(classId);
}
const ISceneClassDesc *CObject::classDesc() const
{
return &ObjectClassDesc;
}
void CObject::toStringLocal(std::ostream &ostream, const std::string &pad) const
{
CBaseObject::toStringLocal(ostream, pad);
}
IStorageObject *CObject::createChunkById(uint16 id, bool container)
{
return CBaseObject::createChunkById(id, container);
}
} /* namespace BUILTIN */
} /* namespace MAX */
} /* namespace PIPELINE */

@ -52,8 +52,34 @@ public:
CObject(CScene *scene);
virtual ~CObject();
// class desc
static const ucstring DisplayName;
static const char *InternalName;
static const char *InternalNameUnknown;
static const NLMISC::CClassId ClassId;
static const TSClassId SuperClassId;
// inherited
virtual void parse(uint16 version);
virtual void clean();
virtual void build(uint16 version);
virtual void disown();
virtual void init();
virtual bool inherits(const NLMISC::CClassId classId) const;
virtual const ISceneClassDesc *classDesc() const;
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "") const;
protected:
// inherited
virtual IStorageObject *createChunkById(uint16 id, bool container);
}; /* class CObject */
typedef CSceneClassDesc<CObject> CObjectClassDesc;
extern const CObjectClassDesc ObjectClassDesc;
typedef CSuperClassDesc<CObject> CObjectSuperClassDesc;
extern const CObjectSuperClassDesc ObjectSuperClassDesc;
} /* namespace BUILTIN */
} /* namespace MAX */
} /* namespace PIPELINE */

@ -85,7 +85,7 @@ public:
/// Initialize a new instance of this chunk
void init();
// public
// public // TODO: Simplify using templates and returning a specialized storage object, auto-converted to the requested type.
/// Gets a pointer to an appdata chunk buffer. Returns NULL if it does not exist. Size is returned in the size parameter.
const uint8 *read(NLMISC::CClassId classId, TSClassId superClassId, uint32 subId, uint32 &size) const;
/// Locks a pointer to an appdata chunk buffer for writing to with specified capacity. May return NULL if this chunk is unparsable or no memory can be allocated.

@ -0,0 +1,144 @@
/**
* \file geom_buffers.cpp
* \brief CGeomBuffers
* \date 2012-08-25 07:55GMT
* \author Jan Boon (Kaetemi)
* CGeomBuffers
*/
/*
* Copyright (C) 2012 by authors
*
* This file is part of RYZOM CORE PIPELINE.
* RYZOM CORE PIPELINE is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* RYZOM CORE PIPELINE is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with RYZOM CORE PIPELINE. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include <nel/misc/types_nl.h>
#include "geom_buffers.h"
// STL includes
// NeL includes
// #include <nel/misc/debug.h>
// Project includes
#include "../../storage_array.h"
// using namespace std;
// using namespace NLMISC;
namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
namespace STORAGE {
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// Elevate warnings to errors in this file for stricter reading
#undef nlwarning
#define nlwarning nlerror
// Elevate debug to error in this file for debugging
// #undef nldebug
// #define nldebug nlerror
// Chunk identifiers
#define PMBS_GEOM_BUFFERS_TRI_A_VERTEX_CHUNK_ID 0x0914
#define PMBS_GEOM_BUFFERS_TRI_A_INDEX_CHUNK_ID 0x0912
#define PMBS_GEOM_BUFFERS_TRI_B_VERTEX_CHUNK_ID 0x0916
#define PMBS_GEOM_BUFFERS_TRI_B_INDEX_CHUNK_ID 0x0918
#define PMBS_GEOM_BUFFERS_TRI_C_VERTEX_CHUNK_ID 0x0938
#define PMBS_GEOM_BUFFERS_TRI_C_INDEX_CHUNK_ID 0x0942
#define PBMS_GEOM_BUFFERS_POLY_A_VERTEX_CHUNK_ID 0x0100
#define PBMS_GEOM_BUFFERS_POLY_A_INDEX_A_CHUNK_ID 0x010a
#define PBMS_GEOM_BUFFERS_POLY_A_INDEX_B_CHUNK_ID 0x011a
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
CGeomBuffers::CGeomBuffers()
{
}
CGeomBuffers::~CGeomBuffers()
{
}
std::string CGeomBuffers::className() const
{
return "GeomBuffers";
}
void CGeomBuffers::toString(std::ostream &ostream, const std::string &pad) const
{
CStorageContainer::toString(ostream, pad);
}
void CGeomBuffers::parse(uint16 version)
{
CStorageContainer::parse(version);
}
void CGeomBuffers::clean()
{
CStorageContainer::clean();
}
void CGeomBuffers::build(uint16 version)
{
CStorageContainer::build(version);
}
void CGeomBuffers::disown()
{
CStorageContainer::disown();
}
IStorageObject *CGeomBuffers::createChunkById(uint16 id, bool container)
{
switch (id)
{
case PMBS_GEOM_BUFFERS_TRI_A_VERTEX_CHUNK_ID:
case PMBS_GEOM_BUFFERS_TRI_B_VERTEX_CHUNK_ID:
case PMBS_GEOM_BUFFERS_TRI_C_VERTEX_CHUNK_ID:
case PBMS_GEOM_BUFFERS_POLY_A_VERTEX_CHUNK_ID:
nlassert(!container);
return new CStorageArray<float>();
case PMBS_GEOM_BUFFERS_TRI_A_INDEX_CHUNK_ID:
case PMBS_GEOM_BUFFERS_TRI_B_INDEX_CHUNK_ID:
case PMBS_GEOM_BUFFERS_TRI_C_INDEX_CHUNK_ID:
case PBMS_GEOM_BUFFERS_POLY_A_INDEX_A_CHUNK_ID:
case PBMS_GEOM_BUFFERS_POLY_A_INDEX_B_CHUNK_ID:
nlassert(!container);
return new CStorageArray<uint32>();
}
return CStorageContainer::createChunkById(id, container);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
} /* namespace STORAGE */
} /* namespace BUILTIN */
} /* namespace MAX */
} /* namespace PIPELINE */
/* end of file */

@ -0,0 +1,76 @@
/**
* \file geom_buffers.h
* \brief CGeomBuffers
* \date 2012-08-25 07:55GMT
* \author Jan Boon (Kaetemi)
* CGeomBuffers
*/
/*
* Copyright (C) 2012 by authors
*
* This file is part of RYZOM CORE PIPELINE.
* RYZOM CORE PIPELINE is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* RYZOM CORE PIPELINE is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with RYZOM CORE PIPELINE. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef PIPELINE_GEOM_BUFFERS_H
#define PIPELINE_GEOM_BUFFERS_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
// Project includes
#include "../../storage_object.h"
namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
namespace STORAGE {
/**
* \brief CGeomBuffers
* \date 2012-08-25 07:55GMT
* \author Jan Boon (Kaetemi)
* CGeomBuffers
*/
class CGeomBuffers : public CStorageContainer
{
public:
CGeomBuffers();
virtual ~CGeomBuffers();
// inherited
virtual std::string className() const;
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
virtual void parse(uint16 version);
virtual void clean();
virtual void build(uint16 version);
virtual void disown();
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
}; /* class CGeomBuffers */
} /* namespace STORAGE */
} /* namespace BUILTIN */
} /* namespace MAX */
} /* namespace PIPELINE */
#endif /* #ifndef PIPELINE_GEOM_BUFFERS_H */
/* end of file */

@ -93,7 +93,8 @@ void CStorageArray<T>::toString(std::ostream &ostream, const std::string &pad) c
for (typename TTypeArray::const_iterator it = Value.begin(), end = Value.end(); it != end; ++it)
{
std::string s = NLMISC::toString(*it);
ostream << "\n" << pad << i << ": " << s;
//ostream << "\n" << pad << i << ": " << s;
ostream << s << ", ";
++i;
}
ostream << " } ";

@ -241,6 +241,16 @@ void CStorageContainer::disown()
}
}
IStorageObject *CStorageContainer::findStorageObject(uint16 id) const
{
for (TStorageObjectContainer::const_iterator it = m_Chunks.begin(), end = m_Chunks.end(); it != end; ++it)
{
if (it->first == id)
return it->second;
}
return NULL;
}
bool CStorageContainer::isContainer() const
{
return true;

@ -123,6 +123,7 @@ public:
public:
// read access
inline const TStorageObjectContainer &chunks() const { return m_Chunks; }
IStorageObject *findStorageObject(uint16 id) const;
public: // should be protected but that doesn't compile, nice c++!
// inherited

@ -12,6 +12,7 @@
#include <string.h>
#include <cstdio>
#include <iostream>
#include <fstream>
#include <vector>
#include <utility>
@ -33,12 +34,31 @@
#include "../max/builtin/scene_impl.h"
#include "../max/builtin/i_node.h"
//static const char *filename = "/srv/work/database/interfaces/anims_max/cp_fy_hof_species.max";
static const char *filename = "/home/kaetemi/source/minimax/GE_Acc_MikotoBaniere.max";
using namespace PIPELINE::MAX;
using namespace PIPELINE::MAX::BUILTIN;
static const char *filename = "/srv/work/database/interfaces/anims_max/cp_fy_hof_species.max";
//static const char *filename = "/home/kaetemi/source/minimax/GE_Acc_MikotoBaniere.max";
//static const char *filename = "/home/kaetemi/3dsMax/scenes/test2008.max";
//static const char *filename = "/home/kaetemi/3dsMax/scenes/teapot_test_scene.max";
static const char *streamname = "Scene";
void exportObj(const std::string &fileName, const CReferenceMaker *triObject)
{
triObject->toString(std::cout);
IStorageObject *bufferBlock = triObject->findStorageObject(0x08fe);
nlassert(bufferBlock->isContainer());
CStorageContainer *buffers = static_cast<CStorageContainer *>(bufferBlock);
CStorageArray<float> *vertexBuffer = static_cast<CStorageArray<float> *>(buffers->findStorageObject(0x0914));
CStorageArray<uint32> *indexBuffer = static_cast<CStorageArray<uint32> *>(buffers->findStorageObject(0x0912));
std::ofstream ofs(fileName.c_str());
for (uint i = 1; i < vertexBuffer->Value.size() - 1; i += 3)
ofs << "v " << vertexBuffer->Value[i] << " " << vertexBuffer->Value[i + 1] << " " << vertexBuffer->Value[i + 2] << "\n";
for (uint i = 1; i < indexBuffer->Value.size() - 1; i += 5)
ofs << "f " << (indexBuffer->Value[i] + 1) << " " << (indexBuffer->Value[i + 1] + 1) << " " << (indexBuffer->Value[i + 2] + 1) << "\n";
}
// int __stdcall WinMain(void *, void *, void *, int)
int main(int argc, char **argv)
{
@ -167,9 +187,9 @@ int main(int argc, char **argv)
nldebug("PARSE");
scene.parse(PIPELINE::MAX::VersionUnknown); // parse the structure to readable data
nldebug("CLEAN");
scene.clean(); // cleanup unused file structure
// scene.clean(); // cleanup unused file structure, don't clean up if we want direct access to chunks as well
// <- TEST
scene.toString(std::cout);
// scene.toString(std::cout);
std::cout << "\n";
//classDirectory3.build(PIPELINE::MAX::VersionUnknown);
//classDirectory3.disown();
@ -180,6 +200,9 @@ int main(int argc, char **argv)
scene.container()->scene()->rootNode()->dumpNodes(std::cout);
std::cout << "\n";
PIPELINE::MAX::BUILTIN::INode *node = scene.container()->scene()->rootNode()->find(ucstring("TR_HOF_civil01_gilet")); nlassert(node);
exportObj("tr_hof_civil01_gilet.obj", node->getReference(1)->getReference(1));
// TEST APP DATA
#define MAXSCRIPT_UTILITY_CLASS_ID (NLMISC::CClassId(0x04d64858, 0x16d1751d))

Loading…
Cancel
Save