Packagealternativa.engine3d.display
Classpublic class View
InheritanceView Inheritance flash.display.Sprite

Camera viewport. It is necessary to assign viewport to camera to show 3D scene.



Public Properties
 PropertyDefined by
  camera : Camera3D
Current camera.
View
  height : Number
Viewport height in pixels.
View
  interactive : Boolean
View's mouse interactivity.
View
  width : Number
Viewport width in pixels.
View
Public Methods
 MethodDefined by
  
View(camera:Camera3D = null, width:Number = 0, height:Number = 0)
Create camera viewport instance.
View
  
get3DCoords(viewPoint:Point, depth:Number, result:Point3D = null):Point3D
The method returns coordinates of a point in coordinate system of a camera which is connected to the view.
View
  
getObjectsUnderPoint(viewPoint:Point):Array
The method returns an array of objects under the specified point of a view.
View
  
getObjectUnderPoint(viewPoint:Point):Object
Returns an object under the specified point of a view.
View
  
Projects a point from global coordinate system to a view.
View
  
projectViewPointToPlane(viewPoint:Point, planeNormal:Point3D, planeOffset:Number, result:Point3D = null):Point3D
Projects a 2d point of the viewport on a 3d plane.
View
Property detail
cameraproperty
camera:Camera3D  [read-write]

Current camera.

Implementation
    public function get camera():Camera3D
    public function set camera(value:Camera3D):void
heightproperty 
height:Number  [read-write]

Viewport height in pixels.

Implementation
    public function get height():Number
    public function set height(value:Number):void
interactiveproperty 
interactive:Boolean  [read-write]

View's mouse interactivity. When the property is set to true, rendered objects can recieve mouse events.

The default value is false.

Implementation
    public function get interactive():Boolean
    public function set interactive(value:Boolean):void
widthproperty 
width:Number  [read-write]

Viewport width in pixels.

Implementation
    public function get width():Number
    public function set width(value:Number):void
Constructor detail
View()constructor
public function View(camera:Camera3D = null, width:Number = 0, height:Number = 0)

Create camera viewport instance.

Parameters
camera:Camera3D (default = null)camera that has to provide image
 
width:Number (default = 0)viewport width
 
height:Number (default = 0)viewport height
Method detail
get3DCoords()method
public function get3DCoords(viewPoint:Point, depth:Number, result:Point3D = null):Point3D

The method returns coordinates of a point in coordinate system of a camera which is connected to the view. In perspective projection mode a point on the line, which goes through the camera's origin and the specified point on the camera's focal plane, is returned. In orthographic mode the method returns a point on the line, which is perpendicular to the camera's focal plane and goes through the specified point on the focal plane.

Parameters
viewPoint:Pointcoordinates of a point on the view
 
depth:Numberdepth of the point in a camera — Z-coordinate in camera's coordinate system
 
result:Point3D (default = null)the result will be written in this parameter. If value of null is specified, then a new instance of Point3D will be created.

Returns
Point3Dcoordinates of a point in coordinate system of a camera, connected to the view, or null if there's no camera
getObjectsUnderPoint()method 
public override function getObjectsUnderPoint(viewPoint:Point):Array

The method returns an array of objects under the specified point of a view.

Parameters
viewPoint:PointCoordinates of a point on a view. The upper-left corner of a view has coordinates (0, 0).

Returns
Arrayan array of objects under the specified point of a view. Objects can be either a face (Face) or a sprite (Sprite3D).
getObjectUnderPoint()method 
public function getObjectUnderPoint(viewPoint:Point):Object

Returns an object under the specified point of a view.

Parameters
viewPoint:PointCoordinates of a point on a view. The upper-left corner of a view has coordinates (0, 0).

Returns
Objectthe nearest object under specified point on a view. The object can be either a face (Face) or a sprite (Sprite3D). If there are no objects under the point or the view isn't on stage, the method returns null.
projectPoint()method 
public function projectPoint(point:Point3D):Point3D

Projects a point from global coordinate system to a view.

Parameters
point:Point3Dcoordinates of a point in global coordinate system

Returns
Point3Dan instance of Point3D class, which contains coordinates of projected point on a view and z-coordinate of the point in camera's coordinate system. If the view has no camera assigned or the assigned camera is not in a scene, the method returns null.
projectViewPointToPlane()method 
public function projectViewPointToPlane(viewPoint:Point, planeNormal:Point3D, planeOffset:Number, result:Point3D = null):Point3D

Projects a 2d point of the viewport on a 3d plane.

Parameters
viewPoint:Pointcoordinates of a point on the view
 
planeNormal:Point3Da normal of the plane in global coordinate system
 
planeOffset:Numberoffset of the plane in global coordinate system
 
result:Point3D (default = null)the result will be stored in this parameter. If value of null is specified, the method will create a new instance of Point3D and return it as the result.

Returns
Point3Dan instance of Point3D given as the result parameter, or a new instance if the parameter is null. If the line of sight is parallel to the specified plane, the result contains NaNs. If the view doesn't have a camera, or the camera isn't on a scene, the method returns null.