112 if (asset_name !=
NULL) {
117 ::lstrcpy (filename.
Get_Buffer (::lstrlen (asset_name) + 5), asset_name);
122 char *suffix = ::strchr (filename,
'.');
123 if (suffix !=
NULL) {
136static inline bool Check_Is_Transform_Identity(
const Matrix3D& m)
138 const float zero=0.0f;
139 const float one=1.0f;
142 ((
unsigned&)m[0][0]^(
unsigned&)one) |
143 ((
unsigned&)m[0][1]^(
unsigned&)zero) |
144 ((
unsigned&)m[0][2]^(
unsigned&)zero) |
145 ((
unsigned&)m[0][3]^(
unsigned&)zero) |
146 ((
unsigned&)m[1][0]^(
unsigned&)zero) |
147 ((
unsigned&)m[1][1]^(
unsigned&)one) |
148 ((
unsigned&)m[1][2]^(
unsigned&)zero) |
149 ((
unsigned&)m[1][3]^(
unsigned&)zero) |
150 ((
unsigned&)m[2][0]^(
unsigned&)zero) |
151 ((
unsigned&)m[2][1]^(
unsigned&)zero) |
152 ((
unsigned&)m[2][2]^(
unsigned&)one) |
153 ((
unsigned&)m[2][3]^(
unsigned&)zero);
334 float width_factor = viewport.
Width() / (vpr_max.
X - vpr_min.
X);
335 float height_factor = viewport.
Height() / (vpr_max.
Y - vpr_min.
Y);
338 float dist = (sphere.
Center - cam).Length();
341 radius = sphere.
Radius / dist;
345 return WWMATH_PI * radius * radius * width_factor * height_factor;
390#ifdef GET_CONTAINER_INLINE
535 if (stricmp(robj->
Get_Name(),name) == 0) {
548 const char * subobjname = strchr(robj->
Get_Name(),
'.');
549 if (subobjname ==
NULL) {
553 subobjname = subobjname+1;
556 if (stricmp(subobjname,name) == 0) {
605 int remove_count = 0;
606 for (
int i = count-1; i >= 0; i--) {
679 float cost = (polycount != 0)? polycount : 0.000001f;
800 Scene->Add_Render_Object(
this);
823 Scene->Remove_Render_Object(
this);
832 Scene->Remove_Render_Object(
this);
907#ifdef ALLOW_TEMPORARIES
1058 for (
int index = 0; index < subobj_count; index ++) {
1062 if (psub_obj !=
NULL) {
1073 return (file_list.
Count () > 0);
1101 for (
int index = 0; index < subobj_count; index ++) {
1107 if (sub_obj !=
NULL) {
1120 return (texture_file_list.
Count () > 0);
1144 if (textures_only ==
false) {
1149 const char *model_name =
Get_Name ();
1156 if (phtree !=
NULL) {
1157 const char *htree_name = phtree->
Get_Name ();
1158 if (::lstrcmpi (htree_name, model_name) != 0) {
1171 if (base_model_name !=
NULL) {
1200 virtual uint32 Chunk_ID(
void)
const;
1206 RENDOBJFACTORY_CHUNKID_VARIABLES = 0x00555040,
1207 RENDOBJFACTORY_VARIABLE_OBJPOINTER = 0x00,
1208 RENDOBJFACTORY_VARIABLE_NAME,
1209 RENDOBJFACTORY_VARIABLE_TRANSFORM
1215uint32 RenderObjPersistFactoryClass::Chunk_ID(
void)
const
1222 RenderObjClass * old_obj =
NULL;
1229 case RENDOBJFACTORY_CHUNKID_VARIABLES:
1242 WWDEBUG_SAY((
"Unhandled Chunk: 0x%X File: %s Line: %d\r\n",__FILE__,__LINE__));
1249 if (strlen(name) == 0) {
1250 static int count = 0;
1251 if ( ++count < 10 ) {
1252 WWDEBUG_SAY((
"RenderObjPersistFactory attempted to load an un-named render object!\r\n"));
1253 WWDEBUG_SAY((
"Replacing it with a NULL render object!\r\n"));
1255 strcpy(name,
"NULL");
1260 if (new_obj ==
NULL) {
1261 static int count = 0;
1262 if ( ++count < 10 ) {
1263 WWDEBUG_SAY((
"RenderObjPersistFactory failed to create object: %s!!\r\n",name));
1264 WWDEBUG_SAY((
"Either the asset for this object is gone or you tried to save a procedural object.\r\n"));
1265 WWDEBUG_SAY((
"Replacing it with a NULL render object!\r\n"));
1267 strcpy(name,
"NULL");
1282 RenderObjClass * robj = (RenderObjClass *)obj;
1283 const char * name = robj->
Get_Name();
1286 csave.
Begin_Chunk(RENDOBJFACTORY_CHUNKID_VARIABLES);
1299 return _RenderObjPersistFactory;
#define WRITE_MICRO_CHUNK(csave, id, var)
#define READ_MICRO_CHUNK_STRING(cload, id, var, size)
#define WRITE_MICRO_CHUNK_STRING(csave, id, var)
#define READ_MICRO_CHUNK(cload, id, var)
void Get_View_Plane(Vector2 &set_min, Vector2 &set_max) const
void Get_Viewport(Vector2 &set_min, Vector2 &set_max) const
uint32 Cur_Micro_Chunk_ID()
bool Begin_Chunk(uint32 id)
CastResultStruct * Result
bool Add(T const &object)
WWINLINE const char * Get_Name(void) const
bool Intersect_Sphere(SphereClass &Sphere, IntersectionResultClass *FinalResult)
bool Intersect_Sphere_Quick(SphereClass &Sphere, IntersectionResultClass *FinalResult)
Vector3 * IntersectionNormal
RenderObjClass * IntersectedRenderObject
enum IntersectionResultClass::INTERSECTION_TYPE IntersectionType
void Set(const Vector3 &p0, const Vector3 &p1)
void Compute_Point(float t, Vector3 *set) const
void mulVector3(const Vector3 &in, Vector3 &out) const
PersistFactoryClass(void)
static void Add_Cost(float cost)
WWINLINE void Release_Ref(void) const
virtual float Get_Screen_Size(CameraClass &camera)
virtual int Is_Hidden(void) const
virtual int Is_Animation_Hidden(void) const
virtual bool Intersect_Sphere_Quick(IntersectionClass *Intersection, IntersectionResultClass *Final_Result)
virtual RenderObjClass * Get_Sub_Object_On_Bone(int index, int boneindex) const
Vector3 Get_Position(void) const
virtual void Set_Transform(const Matrix3D &m)
virtual void Get_Obj_Space_Bounding_Sphere(SphereClass &sphere) const
virtual int Get_Num_Sub_Objects_On_Bone(int boneindex) const
virtual int Is_Translucent(void) const
void Validate_Cached_Bounding_Volumes(void) const
virtual void Set_Translucent(int onoff)
virtual int Is_Additive(void) const
virtual void Set_Position(const Vector3 &v)
virtual const SphereClass & Get_Bounding_Sphere(void) const
AABoxClass CachedBoundingBox
virtual bool Build_Dependency_List(DynamicVectorClass< StringClass > &file_list, bool recursive=true)
virtual void Notify_Added(SceneClass *scene)
virtual int Remove_Sub_Objects_From_Bone(int boneindex)
virtual void Update_Sub_Object_Transforms(void)
virtual SceneClass * Get_Scene(void)
RenderObjClass * Container
virtual void Get_Obj_Space_Bounding_Box(AABoxClass &box) const
virtual void Update_Cached_Bounding_Volumes(void) const
void Invalidate_Cached_Bounding_Volumes(void) const
virtual void Set_Collision_Type(int type)
virtual float Get_Cost(void) const
virtual bool Intersect_Sphere(IntersectionClass *Intersection, IntersectionResultClass *Final_Result)
virtual void Update_Sub_Object_Bits(void)
RenderObjClass & operator=(const RenderObjClass &)
virtual const HTreeClass * Get_HTree(void) const
virtual const char * Get_Base_Model_Name(void) const
virtual int Add_Sub_Object_To_Bone(RenderObjClass *subobj, int bone_index)
virtual const PersistFactoryClass & Get_Factory(void) const
static const float AT_MAX_LOD
virtual void Set_Hidden(int onoff)
RenderHookClass * RenderHook
virtual void Set_Force_Visible(int onoff)
virtual void Set_Alpha(int onoff)
bool Are_Sub_Object_Transforms_Dirty(void)
virtual bool Save(ChunkSaveClass &csave)
virtual void Add_Dependencies_To_List(DynamicVectorClass< StringClass > &file_list, bool textures_only=false)
virtual void Notify_Removed(SceneClass *scene)
virtual void Set_Container(RenderObjClass *con)
virtual const char * Get_Name(void) const
const Matrix3D & Get_Transform(void) const
virtual void Validate_Transform(void) const
virtual int Calculate_Cost_Value_Arrays(float screen_area, float *values, float *costs) const
virtual float Get_Native_Screen_Size(void) const
virtual bool Load(ChunkLoadClass &cload)
virtual int Get_Num_Sub_Objects(void) const
virtual bool Build_Texture_List(DynamicVectorClass< StringClass > &texture_file_list, bool recursive=true)
virtual int Is_Alpha(void) const
virtual RenderObjClass * Get_Sub_Object_By_Name(const char *name, int *index=NULL) const
virtual void Remove(void)
virtual bool Cast_Ray(RayCollisionTestClass &raytest)
virtual void Prepare_LOD(CameraClass &camera)
virtual int Is_Force_Visible(void) const
RenderObjClass * Get_Container(void) const
virtual int Get_Bone_Index(const char *bonename)
virtual void Set_Native_Screen_Size(float screensize)
virtual RenderObjClass * Get_Sub_Object(int index) const
virtual int Get_Collision_Type(void) const
virtual void Add(SceneClass *scene)
virtual int Get_Num_Polys(void) const
virtual bool Intersect(IntersectionClass *Intersection, IntersectionResultClass *Final_Result)
virtual void Set_Animation_Hidden(int onoff)
virtual int Remove_Sub_Object(RenderObjClass *robj)
virtual void Set_Additive(int onoff)
SphereClass CachedBoundingSphere
static const float AT_MIN_LOD
static void Register_Pointer(void *old_pointer, void *new_pointer)
TCHAR * Get_Buffer(int new_length)
WWINLINE void Set(float x, float y, float z)
virtual RenderObjClass * Create_Render_Obj(const char *name)
static WW3DAssetManager * Get_Instance(void)
StringClass Filename_From_Asset_Name(const char *asset_name)
@ WW3D_PERSIST_CHUNKID_RENDEROBJ