|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.byu.phun.PropertyContainer edu.byu.phun.Win3D
public class Win3D
This creates an instance of a 3D window on the
screen. Initially the window is empty. The
programmer can add(Obj3D)
any of the Obj3D
objects to
this window to have them displayed as part of the
window's scene.
Field Summary | |
---|---|
static java.awt.Frame |
myFrame
This is the Java AWT Frame that is used to contain the 3D window. |
Constructor Summary | |
---|---|
Win3D(java.lang.String title)
Creates a new window for display of 3D graphics. |
|
Win3D(java.lang.String title,
int left,
int top,
int width,
int height)
Creates a new window for display of 3D graphics at a particular size and location. |
Method Summary | |
---|---|
void |
add(Obj3D obj)
This will add a new object to the scene being viewed by the camera. |
Color |
getAmbientLight()
This will return the current settings for ambient light. |
Color |
getBackground()
This will return the current background color of the object. |
Color |
getLightAColor()
Returns the color of light A, one of the directional light sources. |
Color |
getLightBColor()
Returns the color of light B, one of the directional light sources. |
Point3d |
getLookAt()
This returns the point that the camera is currently looking at. |
Point3d |
getLookFrom()
This returns the point where the camera is looking from. |
GroupObj |
getSceneObject()
Returns the object that contains the scene being displayed. |
void |
pause(int milliseconds)
This will cause the program to wait for a certain number of milliseconds. |
void |
remove(java.lang.String name)
This will look for an object that has the specified name and will remove it from the scene. |
void |
setAmbientLight(Color color)
This will set the ambient light using a Color object. |
void |
setAmbientLight(double red,
double green,
double blue)
Ambient light is a fiction used to provide fill lighting in a scene. |
void |
setBackground(Color color)
This will set the background color for the 3D window. |
void |
setBackground(double red,
double green,
double blue)
This will set the background color to be displayed in the window behind all other objects in the window. |
void |
setLightAColor(Color color)
This will set the color of one of the directional light sources. |
void |
setLightAColor(double red,
double green,
double blue)
This will set the color of one of the directional light sources. |
void |
setLightBColor(Color color)
This will set the color of one of the directional light sources. |
void |
setLightBColor(double red,
double green,
double blue)
This will set the color of one of the directional light sources. |
void |
setLookAt(double x,
double y,
double z)
This will set the point that the camera for the window is looking at. |
void |
setLookAt(Point3d atPoint)
This will set the point that the camera for the window is looking at. |
void |
setLookFrom(double x,
double y,
double z)
This will set the point where the camera is positioned in 3 space. |
void |
setLookFrom(Point3d from)
This will set the point where the camera is positioned in 3 space. |
void |
setSceneObject(GroupObj newScene)
This will change the scene. |
Methods inherited from class edu.byu.phun.PropertyContainer |
---|
getPropertyC, getPropertyD, getPropertyP, getPropertyS, propertyIsColor, propertyIsDouble, propertyIsPoint, propertyIsSettable, propertyIsString, propertyNames, setProperty, setProperty |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.awt.Frame myFrame
Constructor Detail |
---|
public Win3D(java.lang.String title)
title
- the title in the window's header bar.public Win3D(java.lang.String title, int left, int top, int width, int height)
title
- the title in the window's header bar.left
- the location of the left side of the window.top
- the location of the top of the window.width
- the width of the window.height
- the height of the window.Method Detail |
---|
public GroupObj getSceneObject()
public void setSceneObject(GroupObj newScene)
newScene
- the new scene to be displayed.public void setAmbientLight(double red, double green, double blue)
Setting the ambient light to black (0,0,0) would be like deep space where there are no reflecting surroundings. Setting the ambient light to white (1,1,1) would be like being outside or in a brightly lit room.
red
- the red component 0.0-no light, 1.0-maximum light.green
- the green component 0.0-no light, 1.0-maximum light.blue
- the blue component 0.0-no light, 1.0-maximum light.public void setAmbientLight(Color color)
color
- the color to which ambient light should be set.setAmbientLight(double, double, double)
public Color getAmbientLight()
public void setLightAColor(double red, double green, double blue)
red
- - red component of the light 0.0-1.0green
- - green component of the light 0.0-1.0blue
- - blue component of the light 0.0-1.0public void setLightAColor(Color color)
color
- the color of the light.public Color getLightAColor()
public void setLightBColor(double red, double green, double blue)
red
- - red component of the light 0.0-1.0green
- - green component of the light 0.0-1.0blue
- - blue component of the light 0.0-1.0public void setLightBColor(Color color)
color
- the color of the light.public Color getLightBColor()
public void setBackground(double red, double green, double blue)
red
- - the red component 0.0-1.0green
- - the green component 0.0-1.0blue
- - the blue component 0.0-1.0public void setBackground(Color color)
color
- the new background colorpublic Color getBackground()
public void setLookAt(double x, double y, double z)
x
- X coordinate.y
- Y coordinate.z
- Z coordinate.public void setLookAt(Point3d atPoint)
atPoint
- the new look at point.public void setLookFrom(double x, double y, double z)
x
- X coordinate.y
- Y coordinate.z
- Z coordinate.public void setLookFrom(Point3d from)
from
- the new look from point.public Point3d getLookAt()
public Point3d getLookFrom()
public void add(Obj3D obj)
obj
- the object to be added.public void remove(java.lang.String name)
name
- the name of the object to be removed. This is case
sensitive.public void pause(int milliseconds)
milliseconds
- the number of thousandths of a second
that the program is to be paused.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |