I just noticed that if I move sphere little bit away from camera
flickering stops. So I think there is something wrong with my
clipping.

On 21 joulu, 18:57, xcx <[email protected]> wrote:
> Code as promised.
>
> Main.as
> package
> {
>         import assets.LoadingIcon;
>         import flash.display.Sprite;
>         import flash.events.Event;
>         import flash.text.TextField;
>         import loaders.BranchLoader;
>         import loaders.TextLoader;
>         import utils.Away3DUtils;
>         import away3d.containers.View3D;
>         import away3d.core.clip.FrustumClipping;
>         import away3d.cameras.lenses.PerspectiveLens;
>         import away3d.cameras.Camera3D;
>         import flash.geom.Vector3D;
>
>         [SWF(width="800", height="600", frameRate="60",
> backgroundColor="#000000", quality="high")]
>
>         public class Main extends Sprite
>         {
>                 private var m_fsm:StateMachine = null;
>                 private var m_loadingIcon:LoadingIcon = null;
>                 private var m_view:View3D = null;
>
>                 public function Main():void
>                 {
>                         if (stage) init();
>                         else addEventListener(Event.ADDED_TO_STAGE, init);
>                 }
>
>                 private function init(e:Event = null):void
>                 {
>                         removeEventListener(Event.ADDED_TO_STAGE, init);
>
>                         initAway3D();
>
>                         this.m_fsm = new StateMachine();
>                         this.m_loadingIcon = new LoadingIcon();
>
>                         this.m_fsm.state = StateMachine.INITED;
>                         addEventListener(Event.ENTER_FRAME, render);
>
>                         load();
>                 }
>
>                 private function initAway3D() : void
>                 {
>                         this.m_view = new View3D( { x:400, y:300 } );
>                         m_view.camera = new Camera3D( { distance:0 } );
>                         m_view.camera.lens = new PerspectiveLens();
>                         m_view.camera.position = new Vector3D(0, 0, -5);
>                         m_view.clipping = new FrustumClipping();
>                         m_view.clipping.minZ = 0.1;
>                         m_view.clipping.maxZ = 1000.0;
>                         Away3DUtils.setFov(m_view.camera, 80);
>                         this.addChild(m_view);
>                 }
>
>                 private function load() : void
>                 {
>                         this.m_fsm.state = StateMachine.LOADING;
>                         this.m_view.scene.addChild(m_loadingIcon);
>
>                         var bl:BranchLoader = new 
> BranchLoader(Config.APP_ROOT + "/assets/
> mainbranch.xml");
>                         bl.load();
>                 }
>
>                 private function render(e:Event):void
>                 {
>                         switch (this.m_fsm.state)
>                         {
>                                 case StateMachine.LOADING:
>                                 {
>                                         this.m_loadingIcon.animate();
>                                         m_view.render();
>                                 }
>                                 break;
>                         }
>                 }
>         }
>
> }
>
> LoadingIcon.as
> package assets
> {
>         import away3d.materials.MovieMaterial;
>         import away3d.primitives.Sphere;
>
>         public class LoadingIcon extends Sphere
>         {
>
>                 public function LoadingIcon()
>                 {
>                         this.radius = 2.0;
>                         this.bothsides = true;
>                         //this.segmentsH = 20;
>                         //this.segmentsW = 20;
>                         var m:MovieMaterial = new MovieMaterial(new 
> LoadingIconMaterial());
>                         this.material = m;
>                 }
>
>                 public function animate() : void
>                 {
>                         //this.rotationX += 0.25;
>                         this.rotationY += 2.0;
>                 }
>         }
>
> }
>
> LoadingIconMaterial.as
> package assets
> {
>         import flash.display.Graphics;
>         import flash.display.Sprite;
>         import flash.text.TextField;
>         import flash.text.TextFormat;
>         import flash.text.TextFormatAlign;
>
>         public class LoadingIconMaterial extends Sprite
>         {
>                 private var m_width:Number = 256;
>                 private var m_height:Number = 128;
>                 public function LoadingIconMaterial()
>                 {
>                         var tf:TextField = new TextField();
>                         tf.text = "Loading...Please Wait";
>                         this.addChild(tf);
>                         tf.x = 0;
>                         tf.y = m_height / 2.0 - (tf.textHeight / 2.0);
>                         tf.height = tf.textHeight + 5.0;
>                         tf.width = m_width;
>                         tf.selectable = false;
>
>                         var format:TextFormat = new TextFormat();
>                         format.color = 0x00FF00;
>                         format.align = TextFormatAlign.CENTER;
>                         tf.setTextFormat(format);
>
>                         var g:Graphics = this.graphics;
>                         g.beginFill(0xFFFFFF, 0.20);
>                         g.drawRect(0, 0, m_width, m_height);
>                         g.endFill();
>
>                         this.scaleX = 10;
>                         this.scaleY = 10;
>                 }
>
>         }
>
> }
>
> On 21 joulu, 14:38, xcx <[email protected]> wrote:
>
> > I'll post some code here later on (I have no access to it right now).
>
> > Increasing faces doesn't work. It only get worse since there is more
> > faces to flicker :). To me it seems that there is something fishy
> > about rendering order.
>
> > On 21 joulu, 14:29, sapphiriotic <[email protected]> wrote:
>
> > > hmm.. try increasing number of faces in a sphere? (if that's what i
> > > suppose it is)
>
> > > On Dec 21, 3:02 pm, Darcey Lloyd <[email protected]> wrote:
>
> > > > Not much to go on there, maybe if you show us your code people will / be
> > > > able to help more.
>
> > > > On 21 December 2010 11:15, xcx <[email protected]> wrote:
>
> > > > > And it says Loading but it doesn't really try to load anything :), but
> > > > > you should see some flickering on sphere.

Reply via email to