Package gaia.cu9.ari.gaiaorbit.util.gdx
Class IntModelBatch
- java.lang.Object
-
- gaia.cu9.ari.gaiaorbit.util.gdx.IntModelBatch
-
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
public class IntModelBatch extends java.lang.Object implements com.badlogic.gdx.utils.Disposable
BatchesIntRenderable
instances, fetchesIntShader
s for them, sorts them and then renders them. Fetching the shaders is done using aIntShaderProvider
, which defaults toDefaultShaderProvider
. Sorting the renderables is done using aRenderableSorter
, which default toDefaultRenderableSorter
. The OpenGL context between thebegin(Camera)
andend()
call is maintained by theRenderContext
. To provide multipleIntRenderable
s at once aIntRenderableProvider
can be used, e.g. aIntModelInstance
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
IntModelBatch.RenderablePool
-
Field Summary
Fields Modifier and Type Field Description protected com.badlogic.gdx.graphics.Camera
camera
protected com.badlogic.gdx.graphics.g3d.utils.RenderContext
context
theRenderContext
protected com.badlogic.gdx.utils.Array<IntRenderable>
renderables
list of Renderables to be rendered in the current batchprotected IntModelBatch.RenderablePool
renderablesPool
protected IntShaderProvider
shaderProvider
theIntShaderProvider
, providesIntShader
instances for IntRenderablesprotected IntRenderableSorter
sorter
-
Constructor Summary
Constructors Constructor Description IntModelBatch()
Construct a ModelBatch with the default implementationIntModelBatch(com.badlogic.gdx.graphics.g3d.utils.RenderContext context)
Construct a ModelBatch, using this constructor makes you responsible for calling context.begin() and context.end() yourself.IntModelBatch(com.badlogic.gdx.graphics.g3d.utils.RenderContext context, IntRenderableSorter sorter)
Construct a ModelBatch, using this constructor makes you responsible for calling context.begin() and context.end() yourself.IntModelBatch(com.badlogic.gdx.graphics.g3d.utils.RenderContext context, IntShaderProvider shaderProvider)
Construct a ModelBatch, using this constructor makes you responsible for calling context.begin() and context.end() yourself.IntModelBatch(com.badlogic.gdx.graphics.g3d.utils.RenderContext context, IntShaderProvider shaderProvider, IntRenderableSorter sorter)
Construct a ModelBatch, using this constructor makes you responsible for calling context.begin() and context.end() yourself.IntModelBatch(IntShaderProvider shaderProvider, IntRenderableSorter sorter)
Construct a ModelBatchIntModelBatch(java.lang.String vertexShader, java.lang.String fragmentShader)
Construct a ModelBatch with the default implementation and the specified ubershader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
begin(com.badlogic.gdx.graphics.Camera cam)
Start rendering one or moreIntRenderable
s.void
dispose()
void
end()
End rendering one or moreIntRenderable
s.void
flush()
Flushes the batch, causing allIntRenderable
s in the batch to be rendered.com.badlogic.gdx.graphics.Camera
getCamera()
Provides access to the current camera in betweenbegin(Camera)
andend()
.IntRenderableSorter
getRenderableSorter()
com.badlogic.gdx.graphics.g3d.utils.RenderContext
getRenderContext()
IntShaderProvider
getShaderProvider()
boolean
ownsRenderContext()
Checks whether theRenderContext
returned bygetRenderContext()
is owned and managed by this ModelBatch.void
render(IntRenderable renderable)
Add a singleIntRenderable
to the batch.void
render(IntRenderableProvider renderableProvider)
CallsRenderableProvider.getRenderables(Array, Pool)
and adds all returnedIntRenderable
instances to the current batch to be rendered.void
render(IntRenderableProvider renderableProvider, com.badlogic.gdx.graphics.g3d.Environment environment)
CallsRenderableProvider.getRenderables(Array, Pool)
and adds all returnedIntRenderable
instances to the current batch to be rendered.void
render(IntRenderableProvider renderableProvider, com.badlogic.gdx.graphics.g3d.Environment environment, IntShader shader)
CallsIntRenderableProvider.getRenderables(Array, Pool)
and adds all returnedIntRenderable
instances to the current batch to be rendered.void
render(IntRenderableProvider renderableProvider, IntShader shader)
CallsRenderableProvider.getRenderables(Array, Pool)
and adds all returnedIntRenderable
instances to the current batch to be rendered.<T extends IntRenderableProvider>
voidrender(java.lang.Iterable<T> renderableProviders)
CallsRenderableProvider.getRenderables(Array, Pool)
and adds all returnedIntRenderable
instances to the current batch to be rendered.<T extends IntRenderableProvider>
voidrender(java.lang.Iterable<T> renderableProviders, com.badlogic.gdx.graphics.g3d.Environment environment)
CallsIntRenderableProvider.getRenderables(Array, Pool)
and adds all returnedIntRenderable
instances to the current batch to be rendered.<T extends IntRenderableProvider>
voidrender(java.lang.Iterable<T> renderableProviders, com.badlogic.gdx.graphics.g3d.Environment environment, IntShader shader)
CallsIntRenderableProvider.getRenderables(Array, Pool)
and adds all returnedIntRenderable
instances to the current batch to be rendered.<T extends IntRenderableProvider>
voidrender(java.lang.Iterable<T> renderableProviders, IntShader shader)
CallsIntRenderableProvider.getRenderables(Array, Pool)
and adds all returnedIntRenderable
instances to the current batch to be rendered.void
setCamera(com.badlogic.gdx.graphics.Camera cam)
Change the camera in betweenbegin(Camera)
andend()
.
-
-
-
Field Detail
-
camera
protected com.badlogic.gdx.graphics.Camera camera
-
renderablesPool
protected final IntModelBatch.RenderablePool renderablesPool
-
renderables
protected final com.badlogic.gdx.utils.Array<IntRenderable> renderables
list of Renderables to be rendered in the current batch
-
context
protected final com.badlogic.gdx.graphics.g3d.utils.RenderContext context
theRenderContext
-
shaderProvider
protected final IntShaderProvider shaderProvider
theIntShaderProvider
, providesIntShader
instances for IntRenderables
-
sorter
protected final IntRenderableSorter sorter
-
-
Constructor Detail
-
IntModelBatch
public IntModelBatch(com.badlogic.gdx.graphics.g3d.utils.RenderContext context, IntShaderProvider shaderProvider, IntRenderableSorter sorter)
Construct a ModelBatch, using this constructor makes you responsible for calling context.begin() and context.end() yourself.- Parameters:
context
- TheRenderContext
to use.shaderProvider
- TheIntShaderProvider
to use, will be disposed when this ModelBatch is disposed.sorter
- TheRenderableSorter
to use.
-
IntModelBatch
public IntModelBatch(com.badlogic.gdx.graphics.g3d.utils.RenderContext context, IntShaderProvider shaderProvider)
Construct a ModelBatch, using this constructor makes you responsible for calling context.begin() and context.end() yourself.- Parameters:
context
- TheRenderContext
to use.shaderProvider
- TheIntShaderProvider
to use, will be disposed when this ModelBatch is disposed.
-
IntModelBatch
public IntModelBatch(com.badlogic.gdx.graphics.g3d.utils.RenderContext context, IntRenderableSorter sorter)
Construct a ModelBatch, using this constructor makes you responsible for calling context.begin() and context.end() yourself.- Parameters:
context
- TheRenderContext
to use.sorter
- TheIntRenderableSorter
to use.
-
IntModelBatch
public IntModelBatch(com.badlogic.gdx.graphics.g3d.utils.RenderContext context)
Construct a ModelBatch, using this constructor makes you responsible for calling context.begin() and context.end() yourself.- Parameters:
context
- TheRenderContext
to use.
-
IntModelBatch
public IntModelBatch(IntShaderProvider shaderProvider, IntRenderableSorter sorter)
Construct a ModelBatch- Parameters:
shaderProvider
- TheIntShaderProvider
to use, will be disposed when this ModelBatch is disposed.sorter
- TheIntRenderableSorter
to use.
-
IntModelBatch
public IntModelBatch(java.lang.String vertexShader, java.lang.String fragmentShader)
Construct a ModelBatch with the default implementation and the specified ubershader. SeeDefaultIntShader
for more information about using a custom ubershader. Requires OpenGL ES 2.0.- Parameters:
vertexShader
- The vertex shader to use.fragmentShader
- The fragment shader to use.
-
IntModelBatch
public IntModelBatch()
Construct a ModelBatch with the default implementation
-
-
Method Detail
-
begin
public void begin(com.badlogic.gdx.graphics.Camera cam)
Start rendering one or moreIntRenderable
s. Use one of the render() methods to provide the renderables. Must be followed by a call toend()
. The OpenGL context must not be altered betweenbegin(Camera)
andend()
.- Parameters:
cam
- TheCamera
to be used when rendering and sorting.
-
setCamera
public void setCamera(com.badlogic.gdx.graphics.Camera cam)
Change the camera in betweenbegin(Camera)
andend()
. This causes the batch to be flushed. Can only be called after the call tobegin(Camera)
and before the call toend()
.- Parameters:
cam
- The new camera to use.
-
getCamera
public com.badlogic.gdx.graphics.Camera getCamera()
Provides access to the current camera in betweenbegin(Camera)
andend()
. Do not change the camera's values. UsesetCamera(Camera)
, if you need to change the camera.- Returns:
- The current camera being used or null if called outside
begin(Camera)
andend()
.
-
ownsRenderContext
public boolean ownsRenderContext()
Checks whether theRenderContext
returned bygetRenderContext()
is owned and managed by this ModelBatch. When the RenderContext isn't owned by the ModelBatch, you are responsible for calling theRenderContext.begin()
andRenderContext.end()
methods yourself, as well as disposing the RenderContext.- Returns:
- True if this ModelBatch owns the RenderContext, false otherwise.
-
getRenderContext
public com.badlogic.gdx.graphics.g3d.utils.RenderContext getRenderContext()
- Returns:
- the
RenderContext
used by this ModelBatch.
-
getShaderProvider
public IntShaderProvider getShaderProvider()
- Returns:
- the
IntShaderProvider
used by this ModelBatch.
-
getRenderableSorter
public IntRenderableSorter getRenderableSorter()
- Returns:
- the
IntRenderableSorter
used by this ModelBatch.
-
flush
public void flush()
Flushes the batch, causing allIntRenderable
s in the batch to be rendered. Can only be called after the call tobegin(Camera)
and before the call toend()
.
-
end
public void end()
End rendering one or moreIntRenderable
s. Must be called after a call tobegin(Camera)
. This will flush the batch, causing any renderables provided using one of the render() methods to be rendered. After a call to this method the OpenGL context can be altered again.
-
render
public void render(IntRenderable renderable)
Add a singleIntRenderable
to the batch. TheIntShaderProvider
will be used to fetch a suitableIntShader
. Can only be called after a call tobegin(Camera)
and before a call toend()
.- Parameters:
renderable
- TheIntRenderable
to be added.
-
render
public void render(IntRenderableProvider renderableProvider)
CallsRenderableProvider.getRenderables(Array, Pool)
and adds all returnedIntRenderable
instances to the current batch to be rendered. Can only be called after a call tobegin(Camera)
and before a call toend()
.- Parameters:
renderableProvider
- the renderable provider
-
render
public <T extends IntRenderableProvider> void render(java.lang.Iterable<T> renderableProviders)
CallsRenderableProvider.getRenderables(Array, Pool)
and adds all returnedIntRenderable
instances to the current batch to be rendered. Can only be called after a call tobegin(Camera)
and before a call toend()
.- Parameters:
renderableProviders
- one or more renderable providers
-
render
public void render(IntRenderableProvider renderableProvider, com.badlogic.gdx.graphics.g3d.Environment environment)
CallsRenderableProvider.getRenderables(Array, Pool)
and adds all returnedIntRenderable
instances to the current batch to be rendered. Any environment set on the returned renderables will be replaced with the given environment. Can only be called after a call tobegin(Camera)
and before a call toend()
.- Parameters:
renderableProvider
- the renderable providerenvironment
- theEnvironment
to use for the renderables
-
render
public <T extends IntRenderableProvider> void render(java.lang.Iterable<T> renderableProviders, com.badlogic.gdx.graphics.g3d.Environment environment)
CallsIntRenderableProvider.getRenderables(Array, Pool)
and adds all returnedIntRenderable
instances to the current batch to be rendered. Any environment set on the returned renderables will be replaced with the given environment. Can only be called after a call tobegin(Camera)
and before a call toend()
.- Parameters:
renderableProviders
- one or more renderable providersenvironment
- theEnvironment
to use for the renderables
-
render
public void render(IntRenderableProvider renderableProvider, IntShader shader)
CallsRenderableProvider.getRenderables(Array, Pool)
and adds all returnedIntRenderable
instances to the current batch to be rendered. Any shaders set on the returned renderables will be replaced with the givenIntShader
. Can only be called after a call tobegin(Camera)
and before a call toend()
.- Parameters:
renderableProvider
- the renderable providershader
- the shader to use for the renderables
-
render
public <T extends IntRenderableProvider> void render(java.lang.Iterable<T> renderableProviders, IntShader shader)
CallsIntRenderableProvider.getRenderables(Array, Pool)
and adds all returnedIntRenderable
instances to the current batch to be rendered. Any shaders set on the returned renderables will be replaced with the givenIntShader
. Can only be called after a call tobegin(Camera)
and before a call toend()
.- Parameters:
renderableProviders
- one or more renderable providersshader
- the shader to use for the renderables
-
render
public void render(IntRenderableProvider renderableProvider, com.badlogic.gdx.graphics.g3d.Environment environment, IntShader shader)
CallsIntRenderableProvider.getRenderables(Array, Pool)
and adds all returnedIntRenderable
instances to the current batch to be rendered. Any environment set on the returned renderables will be replaced with the given environment. Any shaders set on the returned renderables will be replaced with the givenIntShader
. Can only be called after a call tobegin(Camera)
and before a call toend()
.- Parameters:
renderableProvider
- the renderable providerenvironment
- theEnvironment
to use for the renderablesshader
- the shader to use for the renderables
-
render
public <T extends IntRenderableProvider> void render(java.lang.Iterable<T> renderableProviders, com.badlogic.gdx.graphics.g3d.Environment environment, IntShader shader)
CallsIntRenderableProvider.getRenderables(Array, Pool)
and adds all returnedIntRenderable
instances to the current batch to be rendered. Any environment set on the returned renderables will be replaced with the given environment. Any shaders set on the returned renderables will be replaced with the givenIntShader
. Can only be called after a call tobegin(Camera)
and before a call toend()
.- Parameters:
renderableProviders
- one or more renderable providersenvironment
- theEnvironment
to use for the renderablesshader
- the shader to use for the renderables
-
dispose
public void dispose()
- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
-
-