I am writing a SVF file. My model has diffuse color and texture. When I set the color to material first; then set the texture to the same material, the color is overridden.
The codes look like that:
// Load texture from file
SUTextureRef tex = SU_INVALID;
SU_CALL(SUTextureCreateFromFile(&tex, "SU_Logo_Color.png", 1.0, 1.0));
// Create material
SUMaterialRef mat = SU_INVALID;
SU_CALL(SUMaterialCreate(&mat));
// Set color first
SUColor color;
color.red = static_cast<SUByte>(255);
color.green = static_cast<SUByte>(0);
color.blue = static_cast<SUByte>(255);
SUMaterialSetColor(mat, &color);
// Then set texture
SU_CALL(SUMaterialSetTexture(mat, tex));
SUMaterialSetType(mat, SUMaterialType_ColorizedTexture);
If I set the texture first and then set color, the color can be kept. Is it as designed?
In SketchUp application, if you assign a color to body and then assign a texture (with transparency); the color is still kept.