纳金网
标题:
Flash3D学习——Sandy学习笔记 [15]
[打印本页]
作者:
.
时间:
2012-8-27 11:17
标题:
Flash3D学习——Sandy学习笔记 [15]
局部贴图,可以给每个面贴图。
代码:
package
{
import flash.display. * ;
import flash.events. * ;
import flash.ui. * ;
import flash.net.URLRequest;
import sandy.core.Scene3D;
import sandy.core.data. * ;
import sandy.core.scenegraph. * ;
import sandy.materials. * ;
import sandy.materials.attributes. * ;
import sandy.primitive. * ;
/**
* ...
* @author ever5u
*/
public class fuxi extends Sprite
{
private var scene:Scene3D;
private var camera:Camera3D;
private var box:Box;
private var app01:Appearance;
private var app02:Appearance;
private var app03:Appearance;
public function fuxi()
{
camera = new Camera3D( 300 , 300 );
camera.z = - 400;
var root:Group = createScene();
scene = new Scene3D( "scene" , this , camera , root );
addEventListener( Event.ENTER_FRAME , enterFrameHandler );
}
private function createScene():Group
{
var g:Group = new Group();
box = new Box( "box" , 100 , 100 , 100 , "quad");
// 第一套着色
var materialAttr01:MaterialAttributes = new MaterialAttributes(
new LightAttributes( ***e , 0.1)
);
var material01:Material = new ColorMaterial( 0xFFCC33 , 1 , materialAttr01 );
material01.lightingEnable = ***e;
app01 = new Appearance( material01 );
// 第二套着色
var materialAttr02:MaterialAttributes = new MaterialAttributes(
new LightAttributes( ***e , 0.1) , new LineAttributes(3 , 0xF43582 , 1)
);
var material02:Material = new ColorMaterial( 0xAAEE99 , 1 , materialAttr02 );
material02.lightingEnable = ***e;
app02 = new Appearance( material02 );
// 第三套着色
var materialAttr03:MaterialAttributes = new MaterialAttributes(
new LightAttributes( ***e , 0.1) , new OutlineAttributes(3 , 0xFC5858 , 1) , new LineAttributes(1 , 0x000000 , 1)
);
var material03:Material = new ColorMaterial( 0x9DCCEA , 1 , materialAttr03 );
material03.lightingEnable = ***e;
app03 = new Appearance( material03 );
//应用着色
//box.appearance = app01;
box.aPolygons[0].appearance = app01;
box.aPolygons[1].appearance = app02;
box.aPolygons[2].appearance = app03;
box.aPolygons[3].appearance = app02;
box.aPolygons[4].appearance = app01;
box.aPolygons[5].appearance = app03;
g.addChild(box);
return g;
}
private function enterFrameHandler( event : Event ) : void
{
box.rotateX = mouseX;
box.rotateY = mouseY;
scene.render();
}
}
}
效果:
http://www.blueidea.com/articleimg/2009/11/7221/Sandy_14.swf
作者:
她。
时间:
2012-11-2 09:26
作者:
.
时间:
2012-11-8 21:27
这是一个好帖子,大家快来围观!!
欢迎光临 纳金网 (http://old.narkii.com/club/)
Powered by Discuz! X2.5