Hramm
unread,Sep 29, 2008, 2:14:38 AM9/29/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to away3d.dev
Hi.
At the weekend decided to take away3d.loaders.Max3DS and faced with
the problem.
Object loaded but it has not applied materials.
Began to understand the source and found the following site:
private function buildMaterials():void
{
for each (_materialData in materialLibrary)
{
//overridden by the material property in constructor
if (material)
_materialData.material = material;
//overridden by materials passed in contructor
if (_materialData.material)
continue;
switch (_materialData.materialType)
{
case MaterialData.TEXTURE_MATERIAL:
materialLibrary.loadRequired = true;
break;
case MaterialData.SHADING_MATERIAL:
_materialData.material = new
ShadingColorMaterial({ambient:_materialData.ambientColor,
diffuse:_materialData.diffuseColor,
specular:_materialData.specularColor});
break;
case MaterialData.WIREFRAME_MATERIAL:
_materialData.material = new WireColorMaterial();
break;
}
}
}
Now look at the line
_materialData.material = new ShadingColorMaterial ((ambient:
_materialData.ambientColor, diffuse: _materialData.diffuseColor,
specular: _materialData.specularColor));
If you look at designer ShadingColorMaterial we'll see
public function ShadingColorMaterial (color: * = null, init: Object =
null)
(
If (color == null)
color = "random";
color = Cast.trycolor (color);
super (init);
ambient = ini.getColor ( "ambient", color);
diffuse = ini.getColor ( "diffuse", color);
specular = ini.getColor ( "specular", color);
alpha = ini.getNumber ( "alpha", 1);
cache = ini.getBoolean ( "cache", false);
)
Thus violated the order of settings in the designer.
If the substitute
_materialData.material = new ShadingColorMaterial (0, (ambient:
_materialData.ambientColor, diffuse: _materialData.diffuseColor,
specular: _materialData.specularColor));
ShadingColorMaterial it will be properly initialized.
But it still did not help ....
The code sample taken from SVN on the date of the letter ...
What could be the problem???
Thanks in advance.
Roman.