public interface JCGLArrayObjectBuilderType
Modifier and Type | Method and Description |
---|---|
Optional<JCGLArrayVertexAttributeType> |
getAttributeAt(int index) |
int |
getMaximumVertexAttributes() |
void |
reset()
Clear all and any configured parameters specified so far.
|
default void |
setAttributeFloatingPoint(int index,
JCGLArrayBufferUsableType a,
int elements,
JCGLScalarType type,
int stride,
long offset,
boolean normalized) |
void |
setAttributeFloatingPointWithDivisor(int index,
JCGLArrayBufferUsableType a,
int elements,
JCGLScalarType type,
int stride,
long offset,
boolean normalized,
int divisor)
Configure the attribute
index to retrieve data from a . |
default void |
setAttributeIntegral(int index,
JCGLArrayBufferUsableType a,
int elements,
JCGLScalarIntegralType type,
int stride,
long offset) |
void |
setAttributeIntegralWithDivisor(int index,
JCGLArrayBufferUsableType a,
int elements,
JCGLScalarIntegralType type,
int stride,
long offset,
int divisor)
Configure the attribute
index to retrieve data from a . |
void |
setIndexBuffer(JCGLIndexBufferUsableType i)
Set the index buffer that will be bound by default.
|
void |
setNoIndexBuffer()
Indicate that no index buffer will be bound by default.
|
void |
setStrictChecking(boolean enabled)
Enable or disable strict checking for the builder.
|
Optional<JCGLArrayVertexAttributeType> getAttributeAt(int index)
index
- The attribute index in the range [0,
getMaximumVertexAttributes() - 1]
int getMaximumVertexAttributes()
>= 16
.void setAttributeFloatingPointWithDivisor(int index, JCGLArrayBufferUsableType a, int elements, JCGLScalarType type, int stride, long offset, boolean normalized, int divisor) throws JCGLExceptionDeleted, JCGLExceptionAttributeAlreadyAssigned
Configure the attribute index
to retrieve data from a
.
The data is assumed to be elements
values of type type
,
occuring every stride
bytes in the buffer, starting at offset
. The data will be converted to floating point values when delivered
to a shading program. If normalized == true
, then values of
integral types will be treated as normalized fixed-point values when
the conversion takes place. Otherwise, they will be directly converted to
floating point (so, for example, an unsigned byte value of 255
will
become 255.0
as opposed to the 1.0
value it would become if
treated as normalized fixed-point).
As a concrete example, if an buffer contains vertices with the following type:
struct vertex { vec3 position; vec2 uv; vec3 normal; }
Attribute 0
, the position
field, has an initial offset
of 0
, and has 3
elements of type JCGLScalarType.TYPE_FLOAT
.
Attribute 1
, the uv
field, has an initial offset of
3 * (sizeof float) == 3 * 4 == 12
bytes, and has 2
elements
of type JCGLScalarType.TYPE_FLOAT
.
Attribute 2
, the normal
field, has an initial offset of
(3 + 2) * (sizeof float) == 5 * 4 == 20
bytes, and has 3
elements of type JCGLScalarType.TYPE_FLOAT
.
If the vertex
type has no padding, then the stride
value
is equal to the size of the type, which is (3 + 2 + 3) * (sizeof
float) == 8 * 4 == 32
bytes.
The divisor specifies the rate at which generic vertex attributes
advance when rendering multiple instances of primitives in a single draw
call. If divisor
is zero, the attribute at slot index advances
once per vertex. If divisor
is non-zero, the attribute advances
once per divisor
instances of the set(s) of vertices being
rendered.
index
- The attributea
- The array bufferelements
- The number of elementstype
- The type of elementsoffset
- The offset from the start of the bufferstride
- The number of bytes to step forward at each vertexnormalized
- true
iff the data should be treated as
normalized fixed-point values when converting to
floating pointdivisor
- The attribute divisorJCGLExceptionDeleted
- Iff the array buffer has
already been deletedJCGLExceptionAttributeAlreadyAssigned
- Iff strict checking is
enabled and the given
attribute has already been
assigneddefault void setAttributeFloatingPoint(int index, JCGLArrayBufferUsableType a, int elements, JCGLScalarType type, int stride, long offset, boolean normalized) throws JCGLExceptionDeleted, JCGLExceptionAttributeAlreadyAssigned
index
- The attributea
- The array bufferelements
- The number of elementstype
- The type of elementsoffset
- The offset from the start of the bufferstride
- The number of bytes to step forward at each vertexnormalized
- true
iff the data should be treated as
normalized fixed-point values when converting to
floating pointJCGLExceptionAttributeAlreadyAssigned
- Iff strict checking is
enabled and the given
attribute has already been
assignedJCGLExceptionDeleted
- Iff the array buffer has
already been deletedsetAttributeFloatingPointWithDivisor(int, JCGLArrayBufferUsableType,
int, JCGLScalarType, int, long, boolean, int)
void setAttributeIntegralWithDivisor(int index, JCGLArrayBufferUsableType a, int elements, JCGLScalarIntegralType type, int stride, long offset, int divisor) throws JCGLExceptionDeleted, JCGLExceptionAttributeAlreadyAssigned
Configure the attribute index
to retrieve data from a
.
The data is assumed to be elements
values of type type
,
occuring every stride
bytes in the buffer, starting at offset
.
The data is assumed to be of an integral type and will not be converted to floating-point prior to being delivered to a shading program.
index
- The attributea
- The array bufferelements
- The number of elementstype
- The type of elementsoffset
- The offset from the start of the bufferstride
- The number of bytes to step forward at each vertexdivisor
- The attribute divisorJCGLExceptionAttributeAlreadyAssigned
- Iff strict checking is
enabled and the given
attribute has already been
assignedJCGLExceptionDeleted
- Iff the array buffer has
already been deletedsetAttributeFloatingPoint(int, JCGLArrayBufferUsableType, int,
JCGLScalarType, int, long, boolean)
default void setAttributeIntegral(int index, JCGLArrayBufferUsableType a, int elements, JCGLScalarIntegralType type, int stride, long offset) throws JCGLExceptionDeleted, JCGLExceptionAttributeAlreadyAssigned
index
- The attributea
- The array bufferelements
- The number of elementstype
- The type of elementsoffset
- The offset from the start of the bufferstride
- The number of bytes to step forward at each vertexJCGLExceptionAttributeAlreadyAssigned
- Iff strict checking is
enabled and the given
attribute has already been
assignedJCGLExceptionDeleted
- Iff the array buffer has
already been deletedsetAttributeIntegralWithDivisor(int, JCGLArrayBufferUsableType, int,
JCGLScalarIntegralType, int, long, int)
void setStrictChecking(boolean enabled)
enabled
- true
iff strict checking should be enabledvoid setIndexBuffer(JCGLIndexBufferUsableType i) throws JCGLExceptionDeleted
Set the index buffer that will be bound by default.
i
- The index bufferJCGLExceptionDeleted
- Iff the index buffer has already been deletedvoid setNoIndexBuffer()
Indicate that no index buffer will be bound by default.
void reset()
Copyright © 2017 <code@io7m.com> http://io7m.com