三、cameras
1. Camera3D类:继承自CameraObject3D类,creates a camera that views the area around a target object
(1)属性
target :DisplayObject3D:目标
goto :Number3D:指定camera要去的位置
(2)方法
transformView( transform:Matrix3D=null ):world space--->camera space
hover( type:Number, mouseX:Number, mouseY:Number ):void:用户移动鼠标时移动camera
2. FreeCamera3D类::继承自CameraObject3D类。creates a camera that views the area in the direction the camera is aimed
(1)方法
transformView( transform:Matrix3D=null ):void
四、scenes
1. Scene3D类:继承自SceneObject3D类。create a scene where all objects are rendered in the same container
(1)方法:
renderObjects( sort:Boolean ):void
2. FlexScene3D类:继承自Scene3D类。
private var containerList : Array;
private var spriteList : Dictionary;
3. MovieScene3D类:继承自Scene3D类。create a scene where each object is rendered in its own container(注意与Scene3D类的不同)
(1)方法:
addChild( child :DisplayObject3D, name :String=null ):DisplayObject3D
getSprite(child:DisplayObject3D):Sprite
renderObjects( sort:Boolean ):void
五、events
1. FileLoadEvent类:继承自event类。represents events that are dispatched when files are loaded
public class FileLoadEvent extends Event
{
public static var LOAD_COMPLETE :String = "loadComplete"; //加载完毕
public static var LOAD_ERROR :String = "loadError"; //加载错误
public static var COLLADA_MATERIALS_DONE:String = "colladaMaterialsDone";
//collada材质加载完毕
public var file:String;
public function FileLoadEvent( type:String, p_file:String="", bubbles:Boolean=false, cancelable:Boolean=false )
{
super( type, bubbles, cancelable );
file = p_file;
}
}
六、materials
1. BitmapMaterial类:继承自MaterialObject3D类。creates a texture from a BitmapData object
(1)属性
AUTO_MIP_MAPPING :Boolean = true;:是否mipmap
MIP_MAP_DEPTH :Number = 8:mipmap等级
get texture():* //texture object
set texture( asset:* ):void
(2)方法
createBitmap( asset:* ):BitmapData:创建位图
correctBitmap( bitmap :BitmapData, dispose :Boolean ):BitmapData:CORRECT BITMAP FOR MIP MAPPING
extendBitmapEdges( bmp:BitmapData, originalWidth:Number, originalHeight:Number ):
2. ColorMaterial类:继承自MaterialObject3D类。creates a solid color material
public function ColorMaterial( color:Number=0xFF00FF, alpha:Number = 100, initObject:Object=null )
{
super( initObject );
this.fillColor = color; //填充颜色
this.fillAlpha = alpha; //
}
3. WireframeMaterial类:继承自MaterialObject3D类。creates a wireframe material, where only the outlines of the faces are drawn.
public function WireframeMaterial( color:Number=0xFF00FF, alpha:Number=100, initObject:Object=null )
{
super( initObject );
this.lineColor = color; //线颜色
this.lineAlpha = alpha; //
this.doubleSided = true;
}
4. BitmapAssetMaterial类:继承自BitmapMaterial类。creates a texture from a Bitmap library symbol
createBitmap( asset:* ):BitmapData
5. BitmapFileMaterial类:继承自BitmapMaterial类。creates a texture by loading a bitmap from an external file.
(1)属性
var url :String = "":The URL that has been requested.
loaded :Boolean:纹理是否已被加载
callback :Function:上张图片被加载完的回调
LOADING_COLOR :int = MaterialObject3D.DEFAULT_COLOR;:加载完成前材质的颜色
(2)方法
public function BitmapFileMaterial( url :String, initObject :Object=null )
{
super( url, initObject );
this.url = url;
this.loaded = false;
// Loading color
this.fillAlpha = 1;
this.fillColor = LOADING_COLOR;
}
BitmapFileMaterial类就是将外部图片文件加载进flash Bitmap library。
6. MaterialsList类:材质列表
(1)属性
materialsByName :Dictionary:以name索引的材质列表
get numMaterials():int:孩子的数目
【内部使用】
_materials :Dictionary
_materialsTotal :int
(2)方法:
addMaterial( material:MaterialObject3D, name:String=null ):MaterialObject3D
removeMaterial( material:MaterialObject3D ):MaterialObject3D
getMaterialByName( name:String ):MaterialObject3D
removeMaterialByName( name:String ):MaterialObject3D
clone():MaterialsList
7. MovieMaterial类:继承自BitmapMaterial类。creates a texture from an existing MovieClip instance
该纹理可以是动画的和/或者透明的。MovieClip实例的当前的缩放和颜色值将会被使用,但旋转则会被舍弃。
MovieClip的内容需要放在注册点(the registration point)的左上角
(1)属性
movie :MovieClip:用作纹理的MovieClip
movieTransparent :Boolean:MovieClip是否透明,默认为false(这样很快)
get animated():Boolean:纹理是否是动画
set animated( status:Boolean ):void
(2)方法
updateBitmap():void:更新动画的MovieClip的bitmap
createBitmap( asset:* ):BitmapData
updateAnimatedBitmaps():void:更新所有的动画MovieMaterial实例的bitmap
8. VideoStreamMaterial类:继承自MovieMaterial类。creates a texture from an existing Video instance and is for use with a Video and NetStream objects with an RTMP stream. The texture can be animated and/or transparent.
(1)属性
stream:NetStream:用作纹理的NetStream
video:Video:用做纹理的Video
(2)方法
initMaterial ( video:Video, stream:NetStream ):void
createBitmap( asset:* ):BitmapData
updateBitmap ():void
onStreamStatus ( event:NetStatusEvent ):void:当NetStream对象状态改变时执行
9. MovieAssetMaterial类:继承自MovieMaterial类。creates a texture from a MovieClip library symbol
七、objects
1.Plane类:继承自Mesh3D类。create and display flat rectangle objects
长方形可以划分为更小的segment。这通常用来减少线性采样贴图的失真
在透视的方向上切分平面可以改善这个问题
(1)属性
segmentsW :Number:水平方向的segment数
segmentsH :Number:垂直方向的segment数
DEFAULT_SIZE :Number = 500:默认大小(若无纹理)
DEFAULT_SCALE :Number = 1:默认缩放(若无纹理)
DEFAULT_SEGMENTS :Number = 1:gridX的默认值
(2)方法
Plane( material:MaterialObject3D=null, width:Number=0, height:Number=0, segmentsW:Number=0, segmentsH:Number=0, initObject:Object=null ):
特别说明一下参数width:
[optional] - Desired width or scaling factor if there's bitmap texture in material and no height is supplied.
参数width一般是宽度。但如果有纹理并且没指定height参数,则参数width是缩放因子
buildPlane( width:Number, height:Number ):void:构建平面(1个格子2个三角形)
2. PaperPlane类:继承自Mesh3D类。Paper planes are useful for testing, when you want to know the direction an object is facing.