Package org.sunflow.core
Class Geometry
- java.lang.Object
-
- org.sunflow.core.Geometry
-
- All Implemented Interfaces:
RenderObject
public class Geometry extends java.lang.Object implements RenderObject
This class represent a geometric object in its native object space. These object are not rendered directly, they must be instanced viaInstance. This class performs all the bookkeeping needed for on-demand tesselation and acceleration structure building.
-
-
Field Summary
Fields Modifier and Type Field Description private AccelerationStructureaccelprivate java.lang.Stringacceltypeprivate intbuiltAccelprivate intbuiltTessprivate PrimitiveListprimitivesprivate Tesselatabletesselatable
-
Constructor Summary
Constructors Constructor Description Geometry(PrimitiveList primitives)Create a geometry from the specified primitive aggregate.Geometry(Tesselatable tesselatable)Create a geometry from the specified tesselatable object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidbuild()(package private) PrimitiveListgetBakingPrimitives()(package private) intgetNumPrimitives()(package private) PrimitiveListgetPrimitiveList()(package private) BoundingBoxgetWorldBounds(Matrix4 o2w)(package private) voidintersect(Ray r, IntersectionState state)(package private) voidprepareShadingState(ShadingState state)private voidtesselate()booleanupdate(ParameterList pl, SunflowAPI api)Update this object given a list of parameters.
-
-
-
Field Detail
-
tesselatable
private Tesselatable tesselatable
-
primitives
private PrimitiveList primitives
-
accel
private AccelerationStructure accel
-
builtAccel
private int builtAccel
-
builtTess
private int builtTess
-
acceltype
private java.lang.String acceltype
-
-
Constructor Detail
-
Geometry
public Geometry(Tesselatable tesselatable)
Create a geometry from the specified tesselatable object. The actual renderable primitives will be generated on demand.- Parameters:
tesselatable- tesselation object
-
Geometry
public Geometry(PrimitiveList primitives)
Create a geometry from the specified primitive aggregate. The acceleration structure for this object will be built on demand.- Parameters:
primitives- primitive list object
-
-
Method Detail
-
update
public boolean update(ParameterList pl, SunflowAPI api)
Description copied from interface:RenderObjectUpdate this object given a list of parameters. This method is guarenteed to be called at least once on every object, but it should correctly handle empty parameter lists. This means that the object should be in a valid state from the time it is constructed. This method should also return true or false depending on whether the update was succesfull or not.- Specified by:
updatein interfaceRenderObject- Parameters:
pl- list of parameters to read fromapi- reference to the current scene- Returns:
trueif the update is succesfull,falseotherwise
-
getNumPrimitives
int getNumPrimitives()
-
getWorldBounds
BoundingBox getWorldBounds(Matrix4 o2w)
-
intersect
void intersect(Ray r, IntersectionState state)
-
tesselate
private void tesselate()
-
build
private void build()
-
prepareShadingState
void prepareShadingState(ShadingState state)
-
getBakingPrimitives
PrimitiveList getBakingPrimitives()
-
getPrimitiveList
PrimitiveList getPrimitiveList()
-
-