Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,9 +693,9 @@ void MeshMatDescClass::Post_Load_Process(bool lighting_enabled,MeshModelClass *
bool emissive_used=false;
bool opacity_used=false;

Vector3 mtl_diffuse;
Vector3 mtl_ambient;
Vector3 mtl_emissive;
Vector3 mtl_diffuse(0.0f,0.0f,0.0f);
Vector3 mtl_ambient(0.0f,0.0f,0.0f);
Vector3 mtl_emissive(0.0f,0.0f,0.0f);
float mtl_opacity = 1.0f;

VertexMaterialClass * prev_mtl = nullptr;
Expand All @@ -714,6 +714,11 @@ void MeshMatDescClass::Post_Load_Process(bool lighting_enabled,MeshModelClass *

for (int vidx=0; vidx<VertexCount; vidx++) {
mtl = Peek_Material(vidx,pass);
// TheSuperHackers @bugfix Cryo 01/09/2026 A material array can contain null entries.
if (mtl == nullptr) {
continue;
}

if (mtl != prev_mtl) {
prev_mtl = mtl;
mtl->Get_Diffuse(&mtl_diffuse);
Expand Down Expand Up @@ -770,6 +775,11 @@ void MeshMatDescClass::Post_Load_Process(bool lighting_enabled,MeshModelClass *
for (int vidx=0; vidx<VertexCount; vidx++) {

mtl = Peek_Material(vidx,pass);
// TheSuperHackers @bugfix Cryo 01/09/2026 Do not apply material colors through a null entry.
if (mtl == nullptr) {
continue;
}

if (mtl != prev_mtl) {
prev_mtl = mtl;
mtl->Get_Diffuse(&mtl_diffuse);
Expand Down
16 changes: 13 additions & 3 deletions GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,9 +695,9 @@ void MeshMatDescClass::Post_Load_Process(bool lighting_enabled,MeshModelClass *
bool emissive_used=false;
bool opacity_used=false;

Vector3 mtl_diffuse;
Vector3 mtl_ambient;
Vector3 mtl_emissive;
Vector3 mtl_diffuse(0.0f,0.0f,0.0f);
Vector3 mtl_ambient(0.0f,0.0f,0.0f);
Vector3 mtl_emissive(0.0f,0.0f,0.0f);
float mtl_opacity = 1.0f;

VertexMaterialClass * prev_mtl = nullptr;
Expand All @@ -716,6 +716,11 @@ void MeshMatDescClass::Post_Load_Process(bool lighting_enabled,MeshModelClass *

for (int vidx=0; vidx<VertexCount; vidx++) {
mtl = Peek_Material(vidx,pass);
// TheSuperHackers @bugfix Cryo 01/09/2026 A material array can contain null entries.
if (mtl == nullptr) {
continue;
}

if (mtl != prev_mtl) {
prev_mtl = mtl;
mtl->Get_Diffuse(&mtl_diffuse);
Expand Down Expand Up @@ -772,6 +777,11 @@ void MeshMatDescClass::Post_Load_Process(bool lighting_enabled,MeshModelClass *
for (int vidx=0; vidx<VertexCount; vidx++) {

mtl = Peek_Material(vidx,pass);
// TheSuperHackers @bugfix Cryo 01/09/2026 Do not apply material colors through a null entry.
if (mtl == nullptr) {
continue;
}

if (mtl != prev_mtl) {
prev_mtl = mtl;
mtl->Get_Diffuse(&mtl_diffuse);
Expand Down
Loading