Clipping on grid plane?

199 views
Skip to first unread message

Moley

unread,
Nov 15, 2009, 7:15:46 AM11/15/09
to away3d.dev
Hey Ive been trying to do an isometric grid in away3d but for some
reason the lines on my grid are being clipped not sure how I can fix
it..

package {
import away3d.cameras.HoverCamera3D;
import away3d.cameras.lenses.OrthogonalLens;
import away3d.containers.View3D;
import away3d.core.base.Object3D;
import away3d.core.clip.*;
import away3d.core.math.Number3D;
import away3d.lights.DirectionalLight3D;
import away3d.primitives.GridPlane;

import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.display.StageQuality;

import flash.events.Event;

public class Mingle extends View3D {
private var _running:Boolean = false;

private var planeX:GridPlane;
public function get running():Boolean { return _running; }
public function set running(value:Boolean):void { if (value)
{ start(); } else { stop(); } }

public function start():void {
if (!_running) {
_running = true;
stage.addEventListener
(Event.ENTER_FRAME, oef);
}
}

public function stop():void {
if (_running) {
_running = false;
stage.removeEventListener
(Event.ENTER_FRAME, oef);
}
}

public function addObject(object3d:Object3D):void { scene.addChild
(object3d); }

private function oef(e:Event):void { render(); }

private function center(e:Event = null):void {
x = stage.stageWidth *.5;
y = stage.stageHeight *.5;
clipping.minX = -x;
clipping.minY = -y;
clipping.maxX = stage.stageWidth;
clipping.maxY = stage.stageHeight;
}

private function init(e:Event):void {
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.quality = StageQuality.LOW;
removeEventListener(Event.ADDED_TO_STAGE, init);

//clipping = new FrustumClipping({minZ:10});

camera = new HoverCamera3D({zoom:10});
camera.lens = new OrthogonalLens();
camera.position = new Number3D(1000, 1000,
1000);
camera.lookAt(new Number3D(0, 0, 0));


var light:DirectionalLight3D = new
DirectionalLight3D();
light.position = new Number3D(1000,
1000, 1000);
light.color = 0xFFFFFF;
light.specular = 0;
light.diffuse = 0.5;
light.ambient = 0.25;

scene.addChild(light);

planeX = new GridPlane({width:5000,height:5000,segmentsW:
10,segmentsH:10,material:"#black"});
scene.addChild(planeX);

stage.addEventListener(Event.RESIZE, center);
center();
running = true;
}

public function Mingle() {

super();
addEventListener(Event.ADDED_TO_STAGE, init);
}

}
}

Peter Kapelyan

unread,
Nov 15, 2009, 1:49:34 PM11/15/09
to away3...@googlegroups.com
I don't think clipping works on any lines yet, it's still not implemented. :/
One thing you can try is maybe:

planeX.quarterFaces();

If once doesn't work - try that twice in a row. If it doesn't work or help at all, my apologies.

-Pete
--
___________________

Actionscript 3.0 Flash 3D Graphics Engine

HTTP://AWAY3D.COM

Moley

unread,
Nov 15, 2009, 5:17:55 PM11/15/09
to away3d.dev
ahh so im not completely insane

unfortunatly that didnt work but thanks for the prompt reply

Li

unread,
Nov 15, 2009, 8:09:57 PM11/15/09
to away3...@googlegroups.com
 leaaving, on a jet plane...
813.gif

Rob Bateman

unread,
Nov 16, 2009, 6:50:30 PM11/16/09
to away3...@googlegroups.com
umm, have you tried using WirePlane instead of GridPlane? part of the problem with clipping and GridPlane is that it's segments run the length of the plane object, so are quite long and susceptible to being clipping using the standard rectangleCliping class. and as peter rightly pointed out, FrustumClipping works on triangles only :(

WirePlane creates a mesh of segments so splits the geometry up more, and clipping is not such a problem. But obviuosly, with any increase in geometry, it will take longer to render than GridPlane. so if GridPlane is giving you clipping problems, better to use WirePlane instead!

Rob


On Mon, Nov 16, 2009 at 1:09 AM, Li <paleb...@gmail.com> wrote:
 leaaving, on a jet plane...



--
Rob Bateman
Flash Development & Consultancy

rob.b...@gmail.com
www.infiniteturtles.co.uk
www.away3d.com
813.gif

Moley

unread,
Nov 16, 2009, 11:30:39 PM11/16/09
to away3d.dev
Hey Rob

Wireplane works fantastically with ortho lens.. gridplane does not..

You do make an interesting point about rendering... I was wondering if
someone could chime in on what would be best.

Im going to be editing material of each face of the 'grid' like a
tileset.

What would be best to lose the ortho lens and use grid plane,
keep/lose ortho and use wiremesh

or just stack a whole bunch of planes together?

I mention the latter as I havent done much with editing materials of
faces in a mesh.. so maybe it might be easier in the long run.

On Nov 17, 10:50 am, Rob Bateman <rob.bate...@gmail.com> wrote:
> umm, have you tried using WirePlane instead of GridPlane? part of the
> problem with clipping and GridPlane is that it's segments run the length of
> the plane object, so are quite long and susceptible to being clipping using
> the standard rectangleCliping class. and as peter rightly pointed out,
> FrustumClipping works on triangles only :(
>
> WirePlane creates a mesh of segments so splits the geometry up more, and
> clipping is not such a problem. But obviuosly, with any increase in
> geometry, it will take longer to render than GridPlane. so if GridPlane is
> giving you clipping problems, better to use WirePlane instead!
>
> Rob
>
> On Mon, Nov 16, 2009 at 1:09 AM, Li <paleblue...@gmail.com> wrote:
> > [?] leaaving, on a jet plane...
>
> --
> Rob Bateman
> Flash Development & Consultancy
>
> rob.bate...@gmail.comwww.infiniteturtles.co.ukwww.away3d.com
>
>  813.gif
> < 1KViewDownload
Reply all
Reply to author
Forward
0 new messages