Sources/CcgDump/CgfUtils.cpp
// Attempts to load the material from the given material chunk to the "me" structure

Attempts to load the material from the given material chunk to the "me" structure
Attempts to load the material from the given material chunk to the " me " structure
MatChunkLoadErrorEnum LoadMatEntity (const CHUNK_HEADER& chunkHeader, const void* pChunkData, unsigned nChunkSize, MAT_ENTITY& me)
{
	memset(&me, 0, sizeof(MAT_ENTITY));
	switch (chunkHeader.ChunkVersion) 
	{
	case MTL_CHUNK_DESC_0746::VERSION:
	{
    const MTL_CHUNK_DESC_0746* pMatChunk = (const MTL_CHUNK_DESC_0746*)pChunkData;
    me.m_New = 2;
    strcpy(me.name, pMatChunk->name);
    switch (pMatChunk->MtlType)
    {
      case MTL_STANDARD:
				{
        me.IsStdMat = true;
        me.col_d = pMatChunk->std.col_d;
        me.col_a = pMatChunk->std.col_a;
        me.col_s = pMatChunk->std.col_s;
        me.specLevel = pMatChunk->std.specLevel;
        me.specShininess = pMatChunk->std.specShininess*100;
        me.opacity = pMatChunk->std.opacity;
        me.selfIllum = pMatChunk->std.selfIllum;
        me.flags = pMatChunk->std.flags;
        me.Dyn_Bounce = pMatChunk->std.Dyn_Bounce;
        me.Dyn_StaticFriction = pMatChunk->std.Dyn_StaticFriction;
        me.Dyn_SlidingFriction = pMatChunk->std.Dyn_SlidingFriction;
        me.map_a = pMatChunk->std.tex_a;
        me.map_d = pMatChunk->std.tex_d;
        me.map_o = pMatChunk->std.tex_o;
        me.map_b = pMatChunk->std.tex_b;
        me.map_s = pMatChunk->std.tex_s;
        me.map_g = pMatChunk->std.tex_g;
        me.map_detail = pMatChunk->std.tex_fl;
        me.map_e = pMatChunk->std.tex_rl;
        me.map_subsurf = pMatChunk->std.tex_subsurf;
        me.map_displ = pMatChunk->std.tex_det;
        me.nChildren = pMatChunk->multi.nChildren;
				me.alpharef = pMatChunk->alphaTest;
				}        
        return MCLE_Success;
			default:
				return MCLE_IgnoredType;
    }
	}
	break;
	case MTL_CHUNK_DESC_0745::VERSION:
  {
    const MTL_CHUNK_DESC_0745* pMatChunk = (const MTL_CHUNK_DESC_0745*)pChunkData;
    me.m_New = 1;
    strcpy(me.name, pMatChunk->name);
    switch (pMatChunk->MtlType)
    {
      case MTL_STANDARD:
        me.IsStdMat = true;
        me.col_d = pMatChunk->std.col_d;
        me.col_a = pMatChunk->std.col_a;
        me.col_s = pMatChunk->std.col_s;
        me.specLevel = pMatChunk->std.specLevel;
        me.specShininess = pMatChunk->std.specShininess*100;
        me.opacity = pMatChunk->std.opacity;
        me.selfIllum = pMatChunk->std.selfIllum;
        me.flags = pMatChunk->std.flags;
        me.Dyn_Bounce = pMatChunk->std.Dyn_Bounce;
        me.Dyn_StaticFriction = pMatChunk->std.Dyn_StaticFriction;
        me.Dyn_SlidingFriction = pMatChunk->std.Dyn_SlidingFriction;
				me.map_a = pMatChunk->std.tex_a;
        me.map_d = pMatChunk->std.tex_d;
        me.map_o = pMatChunk->std.tex_o;
        me.map_b = pMatChunk->std.tex_b;
        me.map_s = pMatChunk->std.tex_s;
        me.map_g = pMatChunk->std.tex_g;
        me.map_detail = pMatChunk->std.tex_c;
        me.map_e = pMatChunk->std.tex_rl;
        me.map_subsurf = pMatChunk->std.tex_subsurf;
        me.map_displ = pMatChunk->std.tex_det;
        me.nChildren = pMatChunk->multi.nChildren;
        return MCLE_Success;
			default:
				return MCLE_IgnoredType;
    }
  }
	break;
	default:
		return MCLE_UnknownVersion;
  }
}
MatChunkLoadErrorEnum LoadMatEntity ( const CHUNK_HEADER & chunkHeader , const void * pChunkData , unsigned nChunkSize , MAT_ENTITY & me ) { memset ( & me , 0 , sizeof ( MAT_ENTITY ) ) ; switch ( chunkHeader . ChunkVersion ) { case MTL_CHUNK_DESC_0746 :: VERSION : { const MTL_CHUNK_DESC_0746 * pMatChunk = ( const MTL_CHUNK_DESC_0746 * ) pChunkData ; me . m_New = 2 ; strcpy ( me . name , pMatChunk -> name ) ; switch ( pMatChunk -> MtlType ) { case MTL_STANDARD : { me . IsStdMat = true ; me . col_d = pMatChunk -> std . col_d ; me . col_a = pMatChunk -> std . col_a ; me . col_s = pMatChunk -> std . col_s ; me . specLevel = pMatChunk -> std . specLevel ; me . specShininess = pMatChunk -> std . specShininess * 100 ; me . opacity = pMatChunk -> std . opacity ; me . selfIllum = pMatChunk -> std . selfIllum ; me . flags = pMatChunk -> std . flags ; me . Dyn_Bounce = pMatChunk -> std . Dyn_Bounce ; me . Dyn_StaticFriction = pMatChunk -> std . Dyn_StaticFriction ; me . Dyn_SlidingFriction = pMatChunk -> std . Dyn_SlidingFriction ; me . map_a = pMatChunk -> std . tex_a ; me . map_d = pMatChunk -> std . tex_d ; me . map_o = pMatChunk -> std . tex_o ; me . map_b = pMatChunk -> std . tex_b ; me . map_s = pMatChunk -> std . tex_s ; me . map_g = pMatChunk -> std . tex_g ; me . map_detail = pMatChunk -> std . tex_fl ; me . map_e = pMatChunk -> std . tex_rl ; me . map_subsurf = pMatChunk -> std . tex_subsurf ; me . map_displ = pMatChunk -> std . tex_det ; me . nChildren = pMatChunk -> multi . nChildren ; me . alpharef = pMatChunk -> alphaTest ; } return MCLE_Success ; default : return MCLE_IgnoredType ; } } break ; case MTL_CHUNK_DESC_0745 :: VERSION : { const MTL_CHUNK_DESC_0745 * pMatChunk = ( const MTL_CHUNK_DESC_0745 * ) pChunkData ; me . m_New = 1 ; strcpy ( me . name , pMatChunk -> name ) ; switch ( pMatChunk -> MtlType ) { case MTL_STANDARD : me . IsStdMat = true ; me . col_d = pMatChunk -> std . col_d ; me . col_a = pMatChunk -> std . col_a ; me . col_s = pMatChunk -> std . col_s ; me . specLevel = pMatChunk -> std . specLevel ; me . specShininess = pMatChunk -> std . specShininess * 100 ; me . opacity = pMatChunk -> std . opacity ; me . selfIllum = pMatChunk -> std . selfIllum ; me . flags = pMatChunk -> std . flags ; me . Dyn_Bounce = pMatChunk -> std . Dyn_Bounce ; me . Dyn_StaticFriction = pMatChunk -> std . Dyn_StaticFriction ; me . Dyn_SlidingFriction = pMatChunk -> std . Dyn_SlidingFriction ; me . map_a = pMatChunk -> std . tex_a ; me . map_d = pMatChunk -> std . tex_d ; me . map_o = pMatChunk -> std . tex_o ; me . map_b = pMatChunk -> std . tex_b ; me . map_s = pMatChunk -> std . tex_s ; me . map_g = pMatChunk -> std . tex_g ; me . map_detail = pMatChunk -> std . tex_c ; me . map_e = pMatChunk -> std . tex_rl ; me . map_subsurf = pMatChunk -> std . tex_subsurf ; me . map_displ = pMatChunk -> std . tex_det ; me . nChildren = pMatChunk -> multi . nChildren ; return MCLE_Success ; default : return MCLE_IgnoredType ; } } break ; default : return MCLE_UnknownVersion ; } }
Attempts to load the material from the given material chunk to the "me" structure
Attempts to load the material from the given material chunk to the " me " structure
//me.col_a.g=0;
 //me.col_a.b=0;
 /* //Timur[10/24/2001] 
        strcpy(me.map_a, pMatChunk->std.tex_a.name);
        strcpy(me.map_d, pMatChunk->std.tex_d.name);
        strcpy(me.map_o, pMatChunk->std.tex_o.name);
        strcpy(me.map_b, pMatChunk->std.tex_b.name);
        strcpy(me.map_s, pMatChunk->std.tex_s.name);
        strcpy(me.map_g, pMatChunk->std.tex_g.name);
        strcpy(me.map_c, pMatChunk->std.tex_c.name);
        strcpy(me.map_e, pMatChunk->std.tex_rl.name);
        strcpy(me.map_rr, pMatChunk->std.tex_rr.name);
        strcpy(me.map_det, pMatChunk->std.tex_det.name);
        */ //me.col_a.g=0;
 //me.col_a.b=0;
