topical media & game development
#graphic-player-10-cube-be-nascom-flash10-tests-widgets-SimpleShadeCube.ax
#graphic-player-10-cube-be-nascom-flash10-tests-widgets-SimpleShadeCube.ax
[swf]
[flash]
flex
package be.nascom.flash10_tests.widgets{
import be.nascom.util.MathFunctions;
import flash.display.Sprite;
An extremely simple implementation of a rotating 3d cube menu
uses only rudimentary 3d features (rotateX, rotateY) with very cheap flat shading
public class @ax-graphic-player-10-cube-be-nascom-flash10-tests-widgets-SimpleShadeCube extends SimpleCube{
public function @ax-graphic-player-10-cube-be-nascom-flash10-tests-widgets-SimpleShadeCube(materials:Array){
super(materials);
}
override protected function zSort():void{
var pair:SimpleCubeSortPair;
for each(pair in _sort_pairs){
//if(pair.side==null)return;
pair.z=pair.side.material.transform.getRelativeMatrix3D(parent).position.z;
//trace(pair.z);
//CubeSimpleShadeMaterial(pair.side.material).updateShader(MathFunctions.normalize(pair.z,-100,100));
//ISimpleShaderMaterial(pair.side.material).updateShader(MathFunctions.normalize(pair.z,-100,100));
ISimpleShaderMaterial(pair.side.material).updateShader(MathFunctions.normalize(pair.z,-100,100));
removeChild(pair.side);
}
_sort_pairs.sortOn("z", Array.NUMERIC | Array.DESCENDING);
var i:uint=0;
for(i=0;i<6;i++){
addChild(SimpleCubeSortPair(_sort_pairs[i]).side);
}
}
}
}
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.