71 ::memset (&m_Info, 0,
sizeof (m_Info));
72 ::memset (&m_MiscInfo, 0,
sizeof (m_MiscInfo));
86 ::memset (&m_Info, 0,
sizeof (m_Info));
87 ::memset (&m_MiscInfo, 0,
sizeof (m_MiscInfo));
104 ::memset (&m_Info, 0,
sizeof (m_Info));
105 ::memset (&m_MiscInfo, 0,
sizeof (m_MiscInfo));
120 if (m_pName !=
NULL) {
142 if (m_pName !=
NULL) {
152 ::memcpy (&m_Info, &src.m_Info, sizeof (m_Info));
153 ::memcpy (&m_MiscInfo, &src.m_MiscInfo, sizeof (m_MiscInfo));
154 m_Version = src.m_Version;
157 for (index = 0; index < src.m_SubobjectList.
Count (); index ++) {
166 m_SubobjectList.Add (new_info);
183 for (
int index = 0; index < m_SubobjectList.Count (); index ++) {
191 m_SubobjectList.Delete_All ();
205 if (pmodel !=
NULL) {
216 WWDEBUG_SAY ((
"Unable to load aggregate %s.\r\n", m_Info.BaseModelName));
242 (mesh_path[index][0] != 0) && (parent_model !=
NULL);
247 if (bone_path[index][0] == 0) {
255 for (
int subobj_index = 0; (subobj_index < subobj_count) && (sub_obj ==
NULL); subobj_index ++) {
259 if (::lstrcmpi (ptemp_obj->
Get_Name (), mesh_path[index]) == 0) {
270 parent_model = sub_obj;
286 for (
int index = 0; index < m_SubobjectList.Count (); index ++) {
288 if (psubobj_info !=
NULL) {
292 if (prender_obj !=
NULL) {
326 if ((prender_obj ==
NULL) &&
349 if (passet_name !=
NULL) {
353 ::GetCurrentDirectory (
sizeof (path), path);
356 if (path[::lstrlen(path)-1] !=
'\\') {
357 ::lstrcat (path,
"\\");
361 ::lstrcat (path, passet_name);
362 ::lstrcat (path,
".w3d");
365 if (::GetFileAttributes (path) != 0xFFFFFFFF) {
387 orig_model_name = (orig_model_name ==
NULL) ? base_model.
Get_Name () : orig_model_name;
390 ::lstrcpy (m_Info.BaseModelName, orig_model_name);
391 m_Info.SubobjectCount = 0;
392 m_MiscInfo.OriginalClassID = base_model.
Class_ID ();
393 m_MiscInfo.Flags = 0;
430 for (
int bone_index = 0; bone_index < bone_count; bone_index ++) {
434 DynamicVectorClass <RenderObjClass *> orig_node_list;
439 if (psubobj !=
NULL) {
440 orig_node_list.
Add (psubobj);
445 DynamicVectorClass <RenderObjClass *> node_list;
450 if (psubobj !=
NULL) {
451 node_list.
Add (psubobj);
455 int node_count = node_list.
Count ();
456 if (node_count > 0) {
460 for (
int node_index = 0; node_index < node_count; node_index ++) {
465 const char *prototype_name = psubobject->
Get_Name ();
466 if (psubobject !=
NULL &&
471 ::lstrcpy (subobj_info.
BoneName, pbone_name);
473 m_Info.SubobjectCount ++;
478 ((
RenderObjClass &)original_model).Add_Sub_Object_To_Bone (prender_obj, pbone_name);
485 for (index = 0; index < orig_node_list.
Count (); index ++) {
491 for (index = 0; index < node_list.
Count (); index ++) {
508 const char *passet_name,
509 DynamicVectorClass <RenderObjClass *> &node_list
517 for (
int node_index = 0; (node_index < node_list.
Count ()) && (retval ==
false); node_index ++) {
521 if (prender_obj !=
NULL &&
522 ::lstrcmpi (prender_obj->
Get_Name (), passet_name) == 0) {
557 if (chunk_load.
Read (&header, sizeof (header)) ==
sizeof (header)) {
559 WWDEBUG_SAY((
"Obsolete texture replacement chunk encountered in aggregate: %s\r\n",m_pName));
593 if (chunk_load.
Read (&header, sizeof (header)) ==
sizeof (header)) {
596 m_pName = ::_strdup (header.
Name);
619 ::memset (&m_Info, 0,
sizeof (m_Info));
620 if (chunk_load.
Read (&m_Info, sizeof (m_Info)) ==
sizeof (m_Info)) {
626 for (
UINT isubobject = 0;
627 (isubobject < m_Info.SubobjectCount) && (ret_val ==
WW3D_ERROR_OK);
652 if (chunk_load.
Read (&subobj_info, sizeof (subobj_info)) ==
sizeof (subobj_info)) {
679 m_SubobjectList.Add (pnew_entry);
695 ::memset (&m_MiscInfo, 0,
sizeof (m_MiscInfo));
696 if (chunk_load.
Read (&m_MiscInfo, sizeof (m_MiscInfo)) ==
sizeof (m_MiscInfo)) {
754 ::lstrcpyn (header.
Name, m_pName, sizeof (header.
Name));
755 header.
Name[
sizeof (header.
Name) - 1] = 0;
758 if (chunk_save.
Write (&header, sizeof (header)) ==
sizeof (header)) {
786 if (chunk_save.
Write (&m_Info, sizeof (m_Info)) ==
sizeof (m_Info)) {
791 for (
int isubobject = 0;
792 (isubobject < m_SubobjectList.Count ()) && (ret_val ==
WW3D_ERROR_OK);
796 ret_val =
Save_Subobject (chunk_save, m_SubobjectList[isubobject]);
849 if (chunk_save.
Write (&m_MiscInfo, sizeof (m_MiscInfo)) ==
sizeof (m_MiscInfo)) {
876 if (pdefinition !=
NULL) {
#define W3D_CURRENT_AGGREGATE_VERSION
const int MESH_PATH_ENTRIES
const int W3D_AGGREGATE_FORCE_SUB_OBJ_LOD
const int MESH_PATH_ENTRY_LEN
@ W3D_CHUNK_AGGREGATE_INFO
@ W3D_CHUNK_TEXTURE_REPLACER_INFO
@ W3D_CHUNK_AGGREGATE_CLASS_INFO
@ W3D_CHUNK_AGGREGATE_HEADER
const char *const EMPTY_STRING
AggregateLoaderClass _AggregateLoader
const AggregateDefClass & operator=(const AggregateDefClass &src)
virtual WW3DErrorType Read_Header(ChunkLoadClass &chunk_load)
virtual WW3DErrorType Save_Class_Info(ChunkSaveClass &chunk_save)
virtual RenderObjClass * Create_Render_Object(const char *passet_name)
virtual WW3DErrorType Save_Subobject(ChunkSaveClass &chunk_save, W3dAggregateSubobjectStruct *psubobject)
const char * Get_Name(void) const
virtual void Attach_Subobjects(RenderObjClass &base_model)
virtual void Free_Subobject_List(void)
virtual bool Load_Assets(const char *asset_name)
virtual void Add_Subobject(const W3dAggregateSubobjectStruct &subobj_info)
virtual void Build_Subobject_List(RenderObjClass &original_model, RenderObjClass &model)
virtual WW3DErrorType Read_Class_Info(ChunkLoadClass &chunk_load)
virtual WW3DErrorType Save_Header(ChunkSaveClass &chunk_save)
void Set_Name(const char *pname)
void Initialize(RenderObjClass &base_model)
virtual RenderObjClass * Find_Subobject(RenderObjClass &model, const char mesh_path[MESH_PATH_ENTRIES][MESH_PATH_ENTRY_LEN], const char bone_path[MESH_PATH_ENTRIES][MESH_PATH_ENTRY_LEN])
virtual WW3DErrorType Load_W3D(ChunkLoadClass &chunk_load)
virtual ~AggregateDefClass(void)
virtual WW3DErrorType Save_Info(ChunkSaveClass &chunk_save)
virtual bool Is_Object_In_List(const char *passet_name, DynamicVectorClass< RenderObjClass * > &node_list)
virtual WW3DErrorType Save_W3D(ChunkSaveClass &chunk_save)
RenderObjClass * Create(void)
virtual WW3DErrorType Read_Info(ChunkLoadClass &chunk_load)
virtual WW3DErrorType Read_Subobject(ChunkLoadClass &chunk_load)
virtual PrototypeClass * Load_W3D(ChunkLoadClass &chunk_load)
uint32 Read(void *buf, uint32 nbytes)
uint32 Write(const void *buf, uint32 nbytes)
bool Begin_Chunk(uint32 id)
bool Add(T const &object)
WWINLINE void Release_Ref(void) const
virtual RenderObjClass * Get_Sub_Object_On_Bone(int index, int boneindex) const
virtual int Get_Num_Sub_Objects_On_Bone(int boneindex) const
int Is_Sub_Objects_Match_LOD_Enabled(void)
virtual void Set_Name(const char *name)
virtual void Set_Base_Model_Name(const char *name)
virtual const char * Get_Base_Model_Name(void) const
virtual int Add_Sub_Object_To_Bone(RenderObjClass *subobj, int bone_index)
void Set_Sub_Objects_Match_LOD(int onoff)
virtual int Get_Num_Bones(void)
virtual int Class_ID(void) const
virtual const char * Get_Bone_Name(int bone_index)
virtual const char * Get_Name(void) const
virtual RenderObjClass * Get_Sub_Object_By_Name(const char *name, int *index=NULL) const
virtual int Get_Bone_Index(const char *bonename)
virtual bool Load_3D_Assets(const char *filename)
virtual RenderObjClass * Create_Render_Obj(const char *name)
static WW3DAssetManager * Get_Instance(void)
#define REF_PTR_RELEASE(x)
char SubobjectName[W3D_NAME_LEN *2]
char BoneName[W3D_NAME_LEN *2]