Package com.ijurnove.cpu3d
Class Shape3d
java.lang.Object
com.ijurnove.cpu3d.Shape3d
- All Implemented Interfaces:
Rotatable,Scalable,Translatable
Shape3ds represent a three-dimensional shape with a texture and a material.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncenter()Calculates and returns the center of thisShape3das aPoint3d.copy()Returns a newShape3dthat is a copy of this one with new references.voidInverts all surface and point normals of thisShape3d, essentially flipping it inside out.Returns theMaterialof thisShape3d.intgetShapeFlag(ShapeFlag flag) Returns the value of a specifiedShapeFlag.Returns the texture of thisShape3das aBufferedImage.Triangle[]Returns thisShape3d'sTrianglearray.protected voidprotected voidprotected voidprotected voidrotate(int axis, double theta) voidRotates this object about a given point on a specified axis.voidScales this object by a given amount from a point.voidsetMaterial(Material material) Sets theMaterialof thisShape3d.voidSets the parent of thisShape3dto a givenScene.voidsetShapeFlag(ShapeFlag flag, int value) Sets the value of a specifiedShapeFlagto a given value.voidsetTexture(BufferedImage texture) Sets the texture of thisShape3dto a givenBufferedImage.voidtranslate(double x, double y, double z) Shifts this object's X, Y, and Z position by the given values.Vector3d[]Returns aVector3darray consisting of every unique point normal in thisShape3d.Point3d[]Returns aPoint3darray consisting of every unique vertex in thisShape3d.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.ijurnove.cpu3d.Translatable
translate
-
Constructor Details
-
Shape3d
Constructs aShape3dwith a specifiedMesh,Material, and a texture represented by aBufferedImage.- Parameters:
mesh- the specified Meshtexture- the specified texturematerial- the specified Material
-
Shape3d
Constructs aShape3dwith the givenTriangle[], without a texture orMaterial.
-
-
Method Details
-
getShapeFlag
Returns the value of a specifiedShapeFlag.
Refer toShapeFlagto see what each one does.- Parameters:
flag- the specified ShapeFlag- Returns:
- the value of the ShapeFlag
-
setShapeFlag
Sets the value of a specifiedShapeFlagto a given value.
Refer toShapeFlagto see what each one does.- Parameters:
flag- the specified ShapeFlagvalue- the new value
-
copy
Returns a newShape3dthat is a copy of this one with new references.- Returns:
- an identical Shape3d
-
getTriangles
Returns thisShape3d'sTrianglearray.- Returns:
- the Triangle[] of this Shape3d
-
getTexture
Returns the texture of thisShape3das aBufferedImage.- Returns:
- the texture of this Shape3d
-
getMaterial
Returns theMaterialof thisShape3d.- Returns:
- the Material of this Shape3d
-
setParent
Sets the parent of thisShape3dto a givenScene.- Parameters:
parent- the specified parent Scene
-
setTexture
Sets the texture of thisShape3dto a givenBufferedImage.- Parameters:
texture- the specified BufferedImage
-
setMaterial
Sets theMaterialof thisShape3d.- Parameters:
material- the Material to set
-
flipNormals
public void flipNormals()Inverts all surface and point normals of thisShape3d, essentially flipping it inside out. -
scale
Description copied from interface:ScalableScales this object by a given amount from a point. -
rotate
protected void rotate(int axis, double theta) -
rotate
Description copied from interface:RotatableRotates this object about a given point on a specified axis. 0 corresponds to the X axis, 1 corresponds to the Y axis, and 2 corresponds to the Z axis. -
translate
public void translate(double x, double y, double z) Description copied from interface:TranslatableShifts this object's X, Y, and Z position by the given values.- Specified by:
translatein interfaceTranslatable- Parameters:
x- how far the object should be translated along the X axisy- how far the object should be translated along the Y axisz- how far the object should be translated along the Z axis
-
uniqueVertices
Returns aPoint3darray consisting of every unique vertex in thisShape3d.- Returns:
- a list of every unique vertex
-
uniquePointNormals
Returns aVector3darray consisting of every unique point normal in thisShape3d.- Returns:
- a list of every unique point normal
-
perspProjectionForPointShadowMap
-
perspProjection
-
orthoProjection
-
center
Calculates and returns the center of thisShape3das aPoint3d.- Returns:
- the center of this Shape3d
-