-
Notifications
You must be signed in to change notification settings - Fork 1
Geometry
Geometry is similar to Tessellator.Object
but is a higher level where it defines its own standard attributes. Geometry is commonly better to use then just a Tessellator.Object
because it gives you more options for creating geometry and a bunch of helper methods that set defaults for some attributes.
The geometry objects was primarily designed to be used with Tessellator.Model
so it would be best fit to do so as the predefined attributes are based of the ones that the default model shaders have.
###Usage
var tessellator = ...;
var geom = new Tessellator.Geometry(Constant.POLYGON);
geom.setColor("red");
goem.setVertex(0, 0, 0);
goem.setVertex(0, 0, 1);
goem.setVertex(0, 1, 1);
goem.setVertex(0, 1, 0);
geom.createObject(tessellator);
//you can ether render the create object.
geom.getObject().render(...);
//or you can add it to a model and that will configure everything for you.
model.add(geom);
###Constructor
-
Tessellator.Geometry(Constant type)
Constructs a newTessellaor.Geometry
object that will create geometry by the specified type. For example:Tessellator.QUAD
will configure this geometry object to create what are essentially rectangles with 4 vertices per object.Tessellator.TRIANGLE
will draw a bunch of triangles with 3 vertices per object. - ARGUMENT type: The way this geometry should interpret geometry as.
###Properties
This will create a low level counterpart of this geometry. A object will need to be created from this geometry in order for things to be rendered.
- ARGUMENT tessellator: The
Tessellator
context object that the ```Tessellator.Object will be created from. - ARGUMENT drawMode: The kind of attributes this geometry will configure for.
Tessellator.COLOR
is the default value. This constant usually should be used only with a ```Tessellator.Model. - ARGUMENT save: Passed to the created
Tessellator.Object
that will determine how the drivers optimize the attributes. - SEE:
Tessellator.Object
- RETURN: The created
Tessellator.Object
- NOTE:
.object
will be set with the createdTessellator.Object
- NOTE: If called again after initial creation, the previous
Tessellator.Object
is returned and no newTessellator.Object
is created. - NOTE:
.convert()
will be called before create theTessellator.Object
.
.getObject()
- RETURN: The
Tessellator.Object
that is associated with thisTessellator.Geometry
. If no object is avaliable,undefined
is returned. - SEE:
.createObject()
-
.dispose()
All the resources associated with this object will be deleted from memory including theTessellator.Object
liked to this geometry. The.diposed
function will be set and is this object is already disposed, there will be no effect. - NOTE: The
.disposable
property of the internalTessellator.Object
is ignored.
-
.addPositions(Array array)
This will add vertex positions to theposition
attribute. It will apply any matrix transformations difined by thisTessellator.Geometry
. - ARGUMENT array: The array of positions to be concatinated. If not a multiple of 3, the last remaining positions will be ignored.
-
.addPositions(...)
This will add vertex positions to theposition
attribute. It will apply any matrix transformations difined by thisTessellator.Geometry
. - ARGUMENTS: All arguments passed will be acted as an array and be concatenated to the position attribute. If not a multiple of 3, the last remaining positions will be ignored.
-
.setColor(Tessellator.vec4 vec)
When using the.setVertex()
function, colors will automatically be concatenated to the color attribute. - ARGUMENT vec: A (r, g, b, a) vector of the set color.
- SEE:
.setVertex()
-
.setVertex(...)
Similar to.setPositions()
it will call it with whatever arguments were passed. This will take into account the set color defined by.setColor()
and will automatically fill thecolor
attribute. - SEE:
.setPositions()
- SEE:
.setColor()
-
.generateTextureCoordinates(x, y)
Depending on the positions and the indices, thecolor
attribute will be automatically filled (if using a model and it has a texture bound). The coodinates will only be applied to modeTessellator.TRIANGLES
and it will follow this pattern: The first 3 indices will be set to: (0, 0), (x, 0), (x, y). The next 3 will be: (0, 0), (x, y), (0, y). It will repeat this pattern until the entire array is filled and finished.
-
source
Tessellator-
renderers
RendererAbstract
ModelRenderer
BufferedRenderer FullScreenRenderer -
shaders
Shader
Program
RenderMatrix -
geometry
Object
-