0

我似乎找不到解决方案,反正我基本上是在尝试使用带有 Flash 的 Away3d 引擎向 3D 模型添加新的动态纹理

   var myImage:BitmapData = new BitmapData(256, 256, true,0xFFFFFFFF);

   // i cant seem to reference this to my 3D model in the example: Myevent(enter frame):

   myModel.material = new TextureMaterial(new BitmapTexture(myImage))

我按照上述方法尝试了不同的方法,我检查了 away3d 文档,但找不到与我目前情况类似的东西:

我使用最新的 Away3d 库和 flash player 11 ......我所有的模型都可以正常工作并加载原始嵌入的 materialtTextures,我只是想将它们更改为我动态创建的位图或纹理

4

2 回答 2

2

看看这里:

https://github.com/away3d/away3d-tutorials-fp11/blob/master/tutorials/materials/basic_shading/src/Basic_Shading.as

他们使用 Away3D 的 Cast 实用程序类来创建 BitmapTexture 对象,他们还添加了一堆不同的纹理贴图——希望这会有所帮助

** 编辑 --- 本教程有效 **

添加

public bmt:BtiMapTexture;

....
private function initMaterials():void {
    this.bmt = new BitmapTexture(new BitmapData(256,256, true, 0x222277FF));
    sphereMaterial = new TextureMaterial(Cast.bitmapTexture(this.bmt));
    sphereMaterial.specularMap = Cast.bitmapTexture(this.bmt);
    sphereMaterial.lightPicker = lightPicker;
}

我有一个漂亮的蓝色球体

于 2012-11-29T14:21:24.693 回答
0

我的解决方案是:

var mesh:Mesh = 'the mesh for changing'
for each (var item:SubMesh in mesh.subMeshes) {
item.material = null;
}
mesh.material = new ColorMaterial(0xFF00FF); 
于 2013-10-20T15:30:47.383 回答