125static unsigned MeshDebugIdCount;
136#if (OPTIMIZE_PLANEEQ_RAM)
137#define COMPUTE_NORMALS
271 return Model->Contains(obj_point);
326 return Model->Get_Name();
344 Model->Set_Name(name);
361 return Model->W3dAttributes;
379 return Model->Get_User_Text();
398 if (
Model->MatInfo) {
399 Model->MatInfo->Add_Ref();
400 return Model->MatInfo;
440 if (
scale==1.0f)
return;
445 Model->Make_Geometry_Unique();
477 Model->Make_Geometry_Unique();
503 Model->get_deformed_vertices(dst_vert,dst_norm,
Container->Get_HTree());
562 temp_apt.Delete_All(
false);
563 Model->Generate_Rigid_APT(localbox, temp_apt);
565 if (temp_apt.Count() > 0) {
569 DecalMesh->Create_Decal(generator, localbox, temp_apt);
574 WWDEBUG_SAY((
"PERFORMANCE WARNING: Decal being applied to a SKIN mesh!\r\n"));
579 int vertex_count =
Model->Get_Vertex_Count();
580 if (_TempVertexBuffer.Count() < vertex_count) _TempVertexBuffer.Resize(vertex_count);
581 Vector3 *dst_vert = &(_TempVertexBuffer[0]);
585 temp_apt.Delete_All(
false);
590 Model->Generate_Skin_APT(worldbox, temp_apt, dst_vert);
593 if (temp_apt.Count() > 0) {
597 DecalMesh->Create_Decal(generator, worldbox, temp_apt, &_TempVertexBuffer);
638 int num_passes=
Model->Get_Pass_Count();
640 int poly_count=
Model->Get_Polygon_Count();
641 return num_passes*poly_count;
669 unsigned int sort_level = (
unsigned int)
Model->Get_Sort_Level();
695 bool rendered_something =
false;
700 if (
Model->PolygonRendererList.Is_Empty()) {
701 Model->Register_For_Rendering();
740 render_base_passes =
true;
743 if (render_base_passes) {
755 rendered_something =
true;
778 rendered_something =
true;
798 Vector3 cam_space_sphere_center;
827 float oldOpacity=-1.0f;
873 if (oldEmissive.
X >= 0)
886 temp_apt.Delete_All(
false);
896 view_dir = -view_dir;
898 if (
Model->Has_Cull_Tree()) {
899 Model->Generate_Rigid_APT(localbox,view_dir,temp_apt);
901 Model->Generate_Rigid_APT(view_dir,temp_apt);
904 if (temp_apt.Count() > 0) {
914 int min_v =
Model->Get_Vertex_Count();
923 for (
int i=0; i < temp_apt.Count(); i++)
925 unsigned v0 = polys[temp_apt[i]].
I;
926 unsigned v1 = polys[temp_apt[i]].
J;
927 unsigned v2 = polys[temp_apt[i]].
K;
929 indices[i*3 + 0] = (
unsigned short)v0;
930 indices[i*3 + 1] = (
unsigned short)v1;
931 indices[i*3 + 2] = (
unsigned short)v2;
950 int vertex_offset =
Model->PolygonRendererList.Peek_Head()->Get_Vertex_Offset();
1004 if (oldEmissive.
X >= 0)
1042 Model->Get_Vertex_Count(),
1043 Model->Get_Polygon_Array(),
1044 Model->Get_Polygon_Count(),
1048 int vertex_count =
Model->Get_Vertex_Count();
1049 if (_TempVertexBuffer.Count() < vertex_count) _TempVertexBuffer.Resize(vertex_count);
1050 Vector3 *dst_vert = &(_TempVertexBuffer[0]);
1055 Model->Get_Vertex_Count(),
1056 Model->Get_Polygon_Array(),
1057 Model->Get_Polygon_Count(),
1074 Model->Replace_Texture(texture,new_texture);
1095 Model->Replace_VertexMaterial(vmat,new_vmat);
1120 if (
Model->Num_Refs()==1 && !force_meshmdl_clone)
return;
1153 WWDEBUG_SAY((
"MeshClass::Load - Failed to allocate model\r\n"));
1179 int is_additive = 0;
1180 if (
Model->Has_Shader_Array(0)) {
1181 for (
int i=0; i<
Model->Get_Polygon_Count(); i++) {
1247 bool hit =
Model->Cast_Ray(objray);
1319 bool hit =
Model->Cast_OBBox(localtest);
1360 return Model->Intersect_OBBox(local_test);
1387 return Model->Intersect_OBBox(local_test);
1406 Model->Get_Bounding_Sphere(&sphere);
1429 Model->Get_Bounding_Box(&box);
1450 Model->Generate_Culling_Tree();
1476 if (material !=
NULL) {
1481 for (
int index = 0; index < material->
Texture_Count (); index ++) {
1487 if (texture !=
NULL) {
1519#ifdef ALLOW_TEMPORARIES
1554 for (
int i = 0; i < num_obj; i++) {
1567 return (
Model->Get_Sort_Level());
1575 Model->Set_Sort_Level(level);
1583 int prcount =
Model->PolygonRendererList.Count();
1589 if ((
Model->MatInfo !=
NULL) && (
Model->MatInfo->Texture_Count() > 0)) {
1590 return Model->MatInfo->Texture_Count();
Color scale(const Color &a, const Color &b)
#define W3D_MESH_FLAG_COLLISION_TYPE_SHIFT
#define W3D_MESH_FLAG_HIDDEN
#define W3D_MESH_FLAG_COLLISION_TYPE_MASK
WWINLINE void Init(const Vector3 ¢er, const Vector3 &extent)
const FrustumClass & Get_Frustum(void) const
void Transform_To_View_Space(Vector3 &dest, const Vector3 &ws_point) const
static OverlapType Overlap_Test(const AAPlaneClass &plane, const Vector3 &point)
CastResultStruct * Result
RenderObjClass * CollidedRenderObj
void Add_Visible_Material_Pass(MaterialPassClass *pass, MeshClass *mesh)
virtual void Add_Delayed_Visible_Material_Pass(MaterialPassClass *pass, MeshClass *mesh)=0
DX8TextureCategoryClass * Get_Texture_Category()
void Render(int base_vertex_offset)
static void Add_Mesh(MeshClass *mesh)
void Add_Render_Task(DX8PolygonRendererClass *p_renderer, MeshClass *p_mesh)
static void Set_World_Identity()
static void Set_Light_Environment(LightEnvironmentClass *light_env)
Set the light environment. This is a lighting model which used up to four directional lights to produ...
static void Set_Index_Buffer(const IndexBufferClass *ib, unsigned short index_base_offset)
static void Draw_Triangles(unsigned buffer_type, unsigned short start_index, unsigned short polygon_count, unsigned short min_vertex_index, unsigned short vertex_count)
static void Set_Transform(D3DTRANSFORMSTATETYPE transform, const Matrix4x4 &m)
DecalSystemClass * Peek_Decal_System(void)
bool Is_Applied_To_Translucent_Meshes(void)
unsigned short * Get_Index_Array()
bool Add(T const &object)
const Vector3 & Get_Dir() const
const Vector3 & Get_P0() const
TextureClass * Peek_Texture(int index)
int Texture_Count(void) const
VertexMaterialClass * Peek_Material(void) const
virtual void Install_Materials(void) const
MW: Had to make this virtual so app can perform direct/custom D3D setup.
OBBoxClass * Get_Cull_Volume(void) const
bool Is_Enabled_On_Translucent_Meshes(void)
virtual void UnInstall_Materials(void) const
static bool Is_Per_Polygon_Culling_Enabled(void)
static WWINLINE void Inverse_Transform_Vector(const Matrix3D &tm, const Vector3 &in, Vector3 *out)
static const Matrix3D Identity
Vector3 Rotate_Vector(const Vector3 &vect) const
void mulVector3(const Vector3 &in, Vector3 &out) const
void Get_Orthogonal_Inverse(Matrix3D &set_inverse) const
static WWINLINE void Transform_Vector(const Matrix3D &tm, const Vector3 &in, Vector3 *out)
WWINLINE Vector3 Get_Translation(void) const
void Get_Inverse(Matrix3D &set_inverse) const
void Obj_Look_At(const Vector3 &p, const Vector3 &t, float roll)
WWINLINE Vector3 Get_Z_Vector(void) const
DecalMeshClass * DecalMesh
virtual void Render(RenderInfoClass &rinfo)
virtual void Get_Obj_Space_Bounding_Sphere(SphereClass &sphere) const
virtual RenderObjClass * Clone(void) const
void Replace_Texture(TextureClass *texture, TextureClass *new_texture)
float m_materialPassEmissiveOverride
WW3DErrorType Load_W3D(ChunkLoadClass &cload)
void Generate_Culling_Tree(void)
virtual void Delete_Decal(uint32 decal_id)
void Render_Material_Pass(MaterialPassClass *pass, IndexBufferClass *ib)
bool Contains(const Vector3 &point)
void Make_Unique(bool force_meshmdl_clone=false)
static bool Legacy_Meshes_Fogged
virtual bool Cast_Ray(RayCollisionTestClass &raytest)
virtual bool Intersect_OBBox(OBBoxIntersectionTestClass &boxtest)
int Get_Draw_Call_Count(void) const
void Get_Deformed_Vertices(Vector3 *dst_vert, Vector3 *dst_norm)
virtual int Get_Num_Polys(void) const
virtual void Create_Decal(DecalGeneratorClass *generator)
virtual void Set_Name(const char *name)
MeshModelClass * Get_Model(void)
virtual const char * Get_Name(void) const
void Set_Lighting_Environment(LightEnvironmentClass *light_env)
virtual void Special_Render(SpecialRenderInfoClass &rinfo)
virtual void Scale(float scale)
virtual int Get_Sort_Level(void) const
MeshClass & operator=(const MeshClass &)
virtual MaterialInfoClass * Get_Material_Info(void)
void Replace_VertexMaterial(VertexMaterialClass *vmat, VertexMaterialClass *new_vmat)
virtual void Get_Obj_Space_Bounding_Box(AABoxClass &box) const
virtual void Update_Cached_Bounding_Volumes(void) const
virtual void Add_Dependencies_To_List(DynamicVectorClass< StringClass > &file_list, bool textures_only=false)
virtual bool Cast_OBBox(OBBoxCollisionTestClass &boxtest)
bool IsDisabledByDebugger
virtual bool Intersect_AABox(AABoxIntersectionTestClass &boxtest)
float m_materialPassAlphaOverride
virtual void Set_Sort_Level(int level)
virtual bool Cast_AABox(AABoxCollisionTestClass &boxtest)
LightEnvironmentClass * LightEnvironment
MeshClass * NextVisibleSkin
const char * Get_User_Text(void) const
uint32 Get_W3D_Flags(void)
void Set_Flag(FlagsType flag, bool onoff)
ObjectType * Peek_Obj(void)
static void Transform(const Matrix3D &tm, const OBBoxClass &in, OBBoxClass *out)
const OBBoxClass & Get_Bounding_Volume(void) const
WWINLINE void Release_Ref(void) const
MaterialPassClass * Peek_Additional_Pass(int i)
RINFO_OVERRIDE_FLAGS & Current_Override_Flags(void)
@ RINFO_OVERRIDE_ADDITIONAL_PASSES_ONLY
@ RINFO_OVERRIDE_SHADOW_RENDERING
int Additional_Pass_Count(void)
float materialPassAlphaOverride
LightEnvironmentClass * light_environment
float materialPassEmissiveOverride
virtual int Is_Hidden(void) const
virtual int Is_Animation_Hidden(void) const
virtual int Is_Translucent(void) const
void Validate_Cached_Bounding_Volumes(void) const
virtual int Is_Not_Hidden_At_All(void)
virtual void Set_Translucent(int onoff)
virtual void Update_Obj_Space_Bounding_Volumes(void)
virtual const SphereClass & Get_Bounding_Sphere(void) const
AABoxClass CachedBoundingBox
RenderObjClass * Container
void Invalidate_Cached_Bounding_Volumes(void) const
virtual void Set_Collision_Type(int type)
virtual const AABoxClass & Get_Bounding_Box(void) const
RenderObjClass & operator=(const RenderObjClass &)
virtual int Class_ID(void) const
virtual void Set_Hidden(int onoff)
virtual void Set_Alpha(int onoff)
virtual void Add_Dependencies_To_List(DynamicVectorClass< StringClass > &file_list, bool textures_only=false)
const Matrix3D & Get_Transform(void) const
virtual int Get_Num_Sub_Objects(void) const
virtual int Is_Alpha(void) const
RenderObjClass * Get_Container(void) const
virtual RenderObjClass * Get_Sub_Object(int index) const
virtual int Get_Collision_Type(void) const
virtual void Set_Additive(int onoff)
SphereClass CachedBoundingSphere
SrcBlendFuncType Get_Src_Blend_Func(void) const
DstBlendFuncType Get_Dst_Blend_Func(void) const
AlphaTestType Get_Alpha_Test(void) const
VisRasterizerClass * VisRasterizer
const StringClass & Get_Full_Path(void) const
WWINLINE void Set(float x, float y, float z)
void Set_Emissive(const Vector3 &color)
void Get_Emissive(Vector3 *set_color) const
float Get_Opacity(void) const
void Set_Opacity(float o)
void Enable_Two_Sided_Rendering(bool onoff)
void Set_Model_Transform(const Matrix3D &model)
bool Render_Triangles(const Vector3 *verts, int vcount, const TriIndex *tris, int tcount, const AABoxClass &bounds)
static void Add_To_Static_Sort_List(RenderObjClass *robj, unsigned int sort_level)
static bool Are_Static_Sort_Lists_Enabled(void)
static float Get_Decal_Rejection_Distance(void)
static bool Are_Decals_Enabled(void)
static bool Is_Sorting_Enabled(void)
static float Max(float a, float b)
static float Min(float a, float b)
int IndexBufferExceptionFunc(void)
MultiListIterator< DX8PolygonRendererClass > DX8PolygonRendererListIterator
DX8MeshRendererClass TheDX8MeshRenderer
@ BUFFER_TYPE_DYNAMIC_DX8
@ BUFFER_TYPE_DYNAMIC_SORTING
void Set_MeshModel_Flag(RenderObjClass *robj, int flag, int onoff)
#define REF_PTR_RELEASE(x)
#define REF_PTR_SET(dst, src)
#define WWMEMLOG(category)