Added: #1440 More superclass dummies

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent 143d8392f1
commit 543f729d42

@ -72,7 +72,7 @@ void CAnimatable::clean()
void CAnimatable::build(uint16 version) void CAnimatable::build(uint16 version)
{ {
CSceneClass:build(version); CSceneClass::build(version);
} }
void CAnimatable::disown() void CAnimatable::disown()

@ -48,6 +48,10 @@ namespace BUILTIN {
namespace { namespace {
// 0x0 - invalid, default to reftarget
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000000> CNullSuperClassDesc;
const CNullSuperClassDesc NullSuperClassDesc(&ReferenceTargetClassDesc);
// 0x9003 bezier float control, subclass under control???; control is under reftarget // 0x9003 bezier float control, subclass under control???; control is under reftarget
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00009003> CControlFloatSuperClassDesc; typedef CSuperClassDescUnknown<CReferenceTarget, 0x00009003> CControlFloatSuperClassDesc;
const CControlFloatSuperClassDesc ControlFloatSuperClassDesc(&ReferenceTargetClassDesc); const CControlFloatSuperClassDesc ControlFloatSuperClassDesc(&ReferenceTargetClassDesc);
@ -136,6 +140,38 @@ const CObjectSuperClassDesc ObjectSuperClassDesc(&ReferenceTargetClassDesc);
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000050> CHelperObjectSuperClassDesc; typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000050> CHelperObjectSuperClassDesc;
const CHelperObjectSuperClassDesc HelperObjectSuperClassDesc(&ReferenceTargetClassDesc); const CHelperObjectSuperClassDesc HelperObjectSuperClassDesc(&ReferenceTargetClassDesc);
// 0x10a0 filterkernel, under specialfx (example: area filter)
typedef CSuperClassDescUnknown<CReferenceTarget, 0x000010a0> CFilterKernelSuperClassDesc;
const CFilterKernelSuperClassDesc FilterKernelSuperClassDesc(&ReferenceTargetClassDesc);
// 0xf00 - renderer ,direct sub of reftarget
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000f00> CRendererSuperClassDesc;
const CRendererSuperClassDesc RendererSuperClassDesc(&ReferenceTargetClassDesc);
// 0x9005 - control point3 (also color), under control???
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00009005> CControlPoint3SuperClassDesc;
const CControlPoint3SuperClassDesc ControlPoint3SuperClassDesc(&ReferenceTargetClassDesc);
// 0x1010 - atmospheric, under special effects
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00001010> CAtmosphericSuperClassDesc;
const CAtmosphericSuperClassDesc AtmosphericSuperClassDesc(&ReferenceTargetClassDesc);
// 0x9011 - control master block 'block control', under control???
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00009011> CControlMasterBlockSuperClassDesc;
const CControlMasterBlockSuperClassDesc ControlMasterBlockSuperClassDesc(&ReferenceTargetClassDesc);
// 0xfffffe00 - grid reference, not sure where, probably directly under reftarget
typedef CSuperClassDescUnknown<CReferenceTarget, 0xfffffe00> CGridReferenceSuperClassDesc;
const CGridReferenceSuperClassDesc GridReferenceSuperClassDesc(&ReferenceTargetClassDesc);
// 0x1090 - render effect, possibly under special fx
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00001090> CRenderEffectSuperClassDesc;
const CRenderEffectSuperClassDesc RenderEffectSuperClassDesc(&ReferenceTargetClassDesc);
// 0x10d0 - shadow type, directly under ref target
typedef CSuperClassDescUnknown<CReferenceTarget, 0x000010d0> CShadowTypeSuperClassDesc;
const CShadowTypeSuperClassDesc ShadowTypeSuperClassDesc(&ReferenceTargetClassDesc);
} /* anonymous namespace */ } /* anonymous namespace */
CBuiltin::CBuiltin() CBuiltin::CBuiltin()
@ -151,6 +187,7 @@ CBuiltin::~CBuiltin()
void CBuiltin::registerClasses(CSceneClassRegistry *registry) void CBuiltin::registerClasses(CSceneClassRegistry *registry)
{ {
// available
registry->add(&AnimatableClassDesc); registry->add(&AnimatableClassDesc);
registry->add(&AnimatableSuperClassDesc); registry->add(&AnimatableSuperClassDesc);
registry->add(&ReferenceMakerClassDesc); registry->add(&ReferenceMakerClassDesc);
@ -158,6 +195,9 @@ void CBuiltin::registerClasses(CSceneClassRegistry *registry)
registry->add(&ReferenceTargetClassDesc); registry->add(&ReferenceTargetClassDesc);
registry->add(&ReferenceTargetSuperClassDesc); registry->add(&ReferenceTargetSuperClassDesc);
// invalid
registry->add(&NullSuperClassDesc);
// unimplemented // unimplemented
registry->add(&ControlFloatSuperClassDesc); registry->add(&ControlFloatSuperClassDesc);
registry->add(&ParamBlockSuperClassDesc); registry->add(&ParamBlockSuperClassDesc);
@ -181,6 +221,14 @@ void CBuiltin::registerClasses(CSceneClassRegistry *registry)
registry->add(&LayerSuperClassDesc); registry->add(&LayerSuperClassDesc);
registry->add(&ObjectSuperClassDesc); registry->add(&ObjectSuperClassDesc);
registry->add(&HelperObjectSuperClassDesc); registry->add(&HelperObjectSuperClassDesc);
registry->add(&FilterKernelSuperClassDesc);
registry->add(&RendererSuperClassDesc);
registry->add(&ControlPoint3SuperClassDesc);
registry->add(&AtmosphericSuperClassDesc);
registry->add(&ControlMasterBlockSuperClassDesc);
registry->add(&GridReferenceSuperClassDesc);
registry->add(&RenderEffectSuperClassDesc);
registry->add(&ShadowTypeSuperClassDesc);
} }
} /* namespace BUILTIN */ } /* namespace BUILTIN */

@ -72,7 +72,7 @@ void CReferenceMaker::clean()
void CReferenceMaker::build(uint16 version) void CReferenceMaker::build(uint16 version)
{ {
CAnimatable:build(version); CAnimatable::build(version);
} }
void CReferenceMaker::disown() void CReferenceMaker::disown()

@ -72,7 +72,7 @@ void CReferenceTarget::clean()
void CReferenceTarget::build(uint16 version) void CReferenceTarget::build(uint16 version)
{ {
CReferenceMaker:build(version); CReferenceMaker::build(version);
} }
void CReferenceTarget::disown() void CReferenceTarget::disown()

@ -32,6 +32,7 @@
// STL includes // STL includes
// NeL includes // NeL includes
#include <nel/misc/smart_ptr.h>
// Project includes // Project includes
#include "reference_maker.h" #include "reference_maker.h"
@ -44,9 +45,16 @@ namespace BUILTIN {
* \brief CReferenceTarget * \brief CReferenceTarget
* \date 2012-08-22 08:53GMT * \date 2012-08-22 08:53GMT
* \author Jan Boon (Kaetemi) * \author Jan Boon (Kaetemi)
* This is a dummy class * This class counts the reference. It is recommended to use CRefPtr<T>
* to refer to any pointers to classes inherited from this class.
* NOTE: CRefPtr<T> does not delete the class when references go to
* zero. When you remove a class from the scene, the class will be
* deleted if the reference count is zero. Otherwise, you are
* responsible for deleting it (for example, if you keep the class
* backed up in an undo stack for undeletion). You may use CSmartPtr<T>
* when the class is no longer owned by the scene container.
*/ */
class CReferenceTarget : public CReferenceMaker class CReferenceTarget : public CReferenceMaker, public NLMISC::CRefCount
{ {
public: public:
CReferenceTarget(); CReferenceTarget();

@ -209,7 +209,7 @@ void CSceneClass::toStringLocal(std::ostream &ostream, const std::string &pad) c
std::stringstream ss; std::stringstream ss;
ss << std::hex << std::setfill('0'); ss << std::hex << std::setfill('0');
ss << std::setw(4) << it->first; ss << std::setw(4) << it->first;
ostream << "\n" << pad << i << " 0x" << ss.str() << ": "; ostream << "\n" << pad << "Orphan[" << i << "] 0x" << ss.str() << ": ";
it->second->toString(ostream, padpad); it->second->toString(ostream, padpad);
++i; ++i;
} }
@ -217,9 +217,33 @@ void CSceneClass::toStringLocal(std::ostream &ostream, const std::string &pad) c
IStorageObject *CSceneClass::getChunk(uint16 id) IStorageObject *CSceneClass::getChunk(uint16 id)
{ {
if (m_OrphanedChunks.begin()->first == id)
{
return m_OrphanedChunks.begin()->second;
m_OrphanedChunks.pop_front();
}
else
{
for (TStorageObjectContainer::iterator it = m_OrphanedChunks.begin(), end = m_OrphanedChunks.end(); it != end; ++it)
{
if (it->first == id)
{
nlwarning("Try to get chunk with 0x%x id, but found 0x%x instead. Found the correct chunk at a different position. Unknown chunks, or chunks out of order", (uint32)id, (uint32)m_OrphanedChunks.begin()->first);
IStorageObject *result = it->second;
m_OrphanedChunks.erase(it);
return result;
}
}
}
nldebug("Chunk 0x%x not found, this is allowed, returning NULL", (uint32)id);
return NULL; return NULL;
} }
void CSceneClass::putChunk(uint16 id, IStorageObject *storageObject)
{
m_OrphanedChunks.insert(m_PutChunkInsert, TStorageObjectWithId(id, storageObject));
}
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////

@ -160,11 +160,15 @@ int main(int argc, char **argv)
| PIPELINE::MAX::PARSE_BUILTIN)); // parse the structure to readable data | PIPELINE::MAX::PARSE_BUILTIN)); // parse the structure to readable data
scene.clean(); // cleanup unused file structure scene.clean(); // cleanup unused file structure
// TEST -> // TEST ->
nldebug("BUILD");
scene.build(PIPELINE::MAX::VersionUnknown); scene.build(PIPELINE::MAX::VersionUnknown);
nldebug("DISOWN");
scene.disown(); scene.disown();
nldebug("PARSE");
scene.parse(PIPELINE::MAX::VersionUnknown, (PIPELINE::MAX::TParseLevel)( scene.parse(PIPELINE::MAX::VersionUnknown, (PIPELINE::MAX::TParseLevel)(
PIPELINE::MAX::PARSE_INTERNAL PIPELINE::MAX::PARSE_INTERNAL
| PIPELINE::MAX::PARSE_BUILTIN)); // parse the structure to readable data | PIPELINE::MAX::PARSE_BUILTIN)); // parse the structure to readable data
nldebug("CLEAN");
scene.clean(); // cleanup unused file structure scene.clean(); // cleanup unused file structure
// <- TEST // <- TEST
scene.toString(std::cout); scene.toString(std::cout);

Loading…
Cancel
Save