|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.threed.jpct.Interact2D
Interact2D offers some static methods for interacting with objects in camera-space. Its main purpose is to allow object-picking with the mouse (or with whatever). Everything within here has to be called after calling World.renderScene(...), because the current visibility list is required.
Field Summary | |
static int |
EXCLUDE_NOT_SELECTABLE
Constant for pickPolygon(...) to exclude unselectable objects from picking. |
static int |
EXCLUDE_TRANSPARENT
Constant for pickPolygon(...) to exclude transparent objects from picking. |
Method Summary | |
static int |
getObjectID(int[] res)
Gets the ID of a picked object out of the result array. |
static int |
getPolygonID(int[] res)
Gets the ID of a picked polygon out of the result array. |
static int[] |
pickPolygon(VisList visList,
SimpleVector dr)
Picks the polygon that is closest to the camera (and belongs to a "selectable" object) and lies in the given direction. |
static int[] |
pickPolygon(VisList visList,
SimpleVector dr,
int exclude)
Picks the polygon that is closest to the camera (and belongs to a "selectable" object) and lies in the given direction. |
static int[] |
pickPolygon(VisList visList,
SimpleVector rp1,
SimpleVector rp2)
Picks the polygon that is closest to the camera (and belongs to a "selectable" object) and that is hit by the ray casted from some position vector into the scene. |
static int[] |
pickPolygon(VisList visList,
SimpleVector rp1,
SimpleVector rp2,
int exclude)
Picks the polygon that is closest to the camera (and belongs to a "selectable" object) and that is hit by the ray casted from some position vector into the scene. |
static SimpleVector |
project3D2D(Camera camera,
FrameBuffer buffer,
SimpleVector vertex)
Projects a vertex from world space into screen space. |
static SimpleVector |
project3D2D(Camera camera,
FrameBuffer buffer,
SimpleVector vertex,
SimpleVector toFill)
Projects a vertex from world space into screen space. |
static SimpleVector |
projectCenter3D2D(Camera camera,
FrameBuffer buffer,
Object3D obj)
Gets the center of the object in screen-coordinates (2D) by transforming and projecting it from 3D objectspace into 2D screenspace. |
static SimpleVector |
projectCenter3D2D(FrameBuffer buffer,
Object3D obj)
Gets the center of the object in screen-coordinates (2D) by transforming and projecting it from 3D objectspace into 2D screenspace. |
static SimpleVector |
reproject2D3D(Camera camera,
FrameBuffer buffer,
int x,
int y)
Reprojects a 2D vector (a screen/framebuffer coordinate in most cases) back into 3D (camera space). |
static SimpleVector |
reproject2D3D(Camera camera,
FrameBuffer buffer,
int x,
int y,
float z)
Reprojects a 2D vector (a screen/framebuffer coordinate in most cases) back into 3D with a given z (in 3D). |
static SimpleVector |
reproject2D3D(Camera camera,
FrameBuffer buffer,
int x,
int y,
float z,
SimpleVector toFill)
Reprojects a 2D vector (a screen/framebuffer coordinate in most cases) back into 3D with a given z (in 3D). |
static SimpleVector |
reproject2D3D(Camera camera,
FrameBuffer buffer,
int x,
int y,
SimpleVector toFill)
Reprojects a 2D vector (a screen/framebuffer coordinate in most cases) back into 3D (camera space). |
static SimpleVector |
reproject2D3DWS(Camera camera,
FrameBuffer buffer,
int x,
int y)
Reprojects a 2D vector (a screen/framebuffer coordinate in most cases) back into 3D (world space). |
static SimpleVector |
reproject2D3DWS(Camera camera,
FrameBuffer buffer,
int x,
int y,
float z)
Reprojects a 2D vector (a screen/framebuffer coordinate in most cases) back into 3D (world space). |
static SimpleVector |
reproject2D3DWS(Camera camera,
FrameBuffer buffer,
int x,
int y,
float z,
SimpleVector toFill)
Reprojects a 2D vector (a screen/framebuffer coordinate in most cases) back into 3D (world space). |
static SimpleVector |
reproject2D3DWS(Camera camera,
FrameBuffer buffer,
int x,
int y,
SimpleVector toFill)
Reprojects a 2D vector (a screen/framebuffer coordinate in most cases) back into 3D (world space). |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int EXCLUDE_TRANSPARENT
public static final int EXCLUDE_NOT_SELECTABLE
Method Detail |
public static SimpleVector reproject2D3D(Camera camera, FrameBuffer buffer, int x, int y)
camera
- the camera used to render the scenebuffer
- the framebuffer containing the rendered imagex
- the x position in 2Dy
- the y position in 2D
public static SimpleVector reproject2D3D(Camera camera, FrameBuffer buffer, int x, int y, SimpleVector toFill)
camera
- the camera used to render the scenebuffer
- the framebuffer containing the rendered imagex
- the x position in 2Dy
- the y position in 2DtoFill
- a SimpleVector that will be filled with the result
public static SimpleVector reproject2D3DWS(Camera camera, FrameBuffer buffer, int x, int y)
camera
- the camera used to render the scenebuffer
- the framebuffer containing the rendered imagex
- the x position in 2Dy
- the y position in 2D
public static SimpleVector reproject2D3DWS(Camera camera, FrameBuffer buffer, int x, int y, SimpleVector toFill)
camera
- the camera used to render the scenebuffer
- the framebuffer containing the rendered imagex
- the x position in 2Dy
- the y position in 2DtoFill
- a SimpleVector that will be filled with the result
public static SimpleVector reproject2D3DWS(Camera camera, FrameBuffer buffer, int x, int y, float z)
camera
- the camera used to render the scenebuffer
- the framebuffer containing the rendered imagex
- the x position in 2Dy
- the y position in 2Dz
- the z position in camera space
public static SimpleVector reproject2D3DWS(Camera camera, FrameBuffer buffer, int x, int y, float z, SimpleVector toFill)
camera
- the camera used to render the scenebuffer
- the framebuffer containing the rendered imagex
- the x position in 2Dy
- the y position in 2Dz
- the z position in camera spacetoFill
- a SimpleVector that will be filled with the result
public static SimpleVector reproject2D3D(Camera camera, FrameBuffer buffer, int x, int y, float z)
camera
- the camera used to render the scenebuffer
- the framebuffer containing the rendered imagex
- the x position in 2Dy
- the y position in 2Dz
- the z position of the "picking plane" (in 3D)
public static SimpleVector reproject2D3D(Camera camera, FrameBuffer buffer, int x, int y, float z, SimpleVector toFill)
camera
- the camera used to render the scenebuffer
- the framebuffer containing the rendered imagex
- the x position in 2Dy
- the y position in 2Dz
- the z position of the "picking plane" (in 3D)toFill
- a SimpleVector that will be filled with the result
public static SimpleVector project3D2D(Camera camera, FrameBuffer buffer, SimpleVector vertex)
camera
- the Camera used for the projectionbuffer
- the Framebuffervertex
- the vertex in world space
public static SimpleVector project3D2D(Camera camera, FrameBuffer buffer, SimpleVector vertex, SimpleVector toFill)
camera
- the Camera used for the projectionbuffer
- the Framebuffervertex
- the vertex in world spacetoFill
- the SimpleVector that will be filled with the result
public static SimpleVector projectCenter3D2D(FrameBuffer buffer, Object3D obj)
buffer
- the framebuffer the object will be (or has been) rendered intoobj
- the object itself
public static SimpleVector projectCenter3D2D(Camera camera, FrameBuffer buffer, Object3D obj)
camera
- the camera that represents the worldspace->cameraspace
transformation. The frontbuffer matrix of the camera will be
used. If the camera is null, the one from the object's World
will be used instead.buffer
- the framebuffer the object will be (or has been) rendered intoobj
- the object itself
public static int getObjectID(int[] res)
res
- the result array of a "pick" as returned by pickPolygon()
pickPolygon(com.threed.jpct.VisList, com.threed.jpct.SimpleVector)
,
pickPolygon(com.threed.jpct.VisList, com.threed.jpct.SimpleVector,
com.threed.jpct.SimpleVector)
public static int getPolygonID(int[] res)
res
- the result array of a "pick" as returned by pickPolygon()
pickPolygon(com.threed.jpct.VisList, com.threed.jpct.SimpleVector)
,
pickPolygon(com.threed.jpct.VisList, com.threed.jpct.SimpleVector,
com.threed.jpct.SimpleVector)
public static int[] pickPolygon(VisList visList, SimpleVector dr)
visList
- the visibility listdr
- the direction vector (as returned by reproject2D3D())
public static int[] pickPolygon(VisList visList, SimpleVector dr, int exclude)
visList
- the visibility listdr
- the direction vector (as returned by reproject2D3D())exclude
- a flag that indicates what to exclude from picking. 0 means no
exclusion. Values can be combined by OR.
EXCLUDE_TRANSPARENT
,
EXCLUDE_NOT_SELECTABLE
public static int[] pickPolygon(VisList visList, SimpleVector rp1, SimpleVector rp2)
visList
- the visibility listrp1
- the origin of the ray casted into the scene (in camera-space)rp2
- a point within the casted ray (any point will do)
public static int[] pickPolygon(VisList visList, SimpleVector rp1, SimpleVector rp2, int exclude)
visList
- the visibility listrp1
- the origin of the ray casted into the scene (in camera-space)rp2
- a point within the casted ray (any point will do)exclude
- a flag that indicates what to exclude from picking. 0 means no
exclusion. Values can be combined by OR.
EXCLUDE_TRANSPARENT
,
EXCLUDE_NOT_SELECTABLE
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |