com.threed.jpct
Class Config
java.lang.Object
com.threed.jpct.Config
public final class Config
- extends java.lang.Object
Config is used for configuring the engine. For faster access and to reduce
code size, all important configuration variables are public and can be
accessed directly.
For setting them programmatically, it may be more convenient to use the
setParameterValue()-method instead.
Some will show effect directly after modifying them, some should be modified
before doing the setup work for jPCT. This will be stated in the description
of the setting.
Field Summary |
static int |
aaMode
Don't fiddle around with this! |
static boolean |
aggressiveStripping
A debug switch...might go away in later versions. |
static boolean |
autoMaintainAspectRatio
Ensures that the aspect ratio doesn't change when changing framebuffer
size. |
static int |
byteBufferLimit
Sets a limit for internal byte buffers. |
static boolean |
cacheCompressedTextures
Experimental! |
static float |
collideEdgeMul
When using the sphere-polygon collision detection for the camera, it may
be useful to use a lower sphere radius for sphere-edge-collisions to
ensure that the camera slides around corners in a more realistic way. |
static float |
collideEllipsoidThreshold
A threshold that limits recursion for ellipsoid collision detection. |
static float |
collideOffset
The maximum number in world units a polygon's corner and/or axis aligned
bounding box/octree-node (is used) may have from a position vector to be
taken into account as a potential collider in the collision detection
methods. |
static float |
defaultCameraFOV
The default FOV for the camera. |
static float |
farPlane
The far clipping plane. |
static boolean |
fixCollapsingVertices
If a keyframe animation is build in a way that vertices collapse (i.e. |
static int |
flashSortThreshold
If the number of instances to sort exceeds this value, a flash sort will
be used instead of the default quick sort. |
static int |
glBatchSize
When compiling an Object3D, the renderer has to assume an ideal batch
size for the underlying hardware. |
static int |
glDebugLevel
Wraps gl calls to be printed out by the Logger if not set to 0. |
static boolean |
glDither
Use dithering. |
static boolean |
glForceEnvMapToSecondStage
By default, an environment map will be applied to the first texture stage
if environment mapping is used on an object. |
static boolean |
glForceHighPrecision
Forces high precision for shaders even if the shader source states
otherwise. |
static boolean |
glIgnoreErrors
If set to true, GL errors will be ignored. |
static boolean |
glIgnoreNearPlane
If set to true, the renderer will ignore the configured near plane for
creating the frustum and use a default value instead. |
static boolean |
glRevertADDtoMODULATE
When setting this to true, every texture blending operation that uses the
additive mode will be treated as if it were using modulation instead. |
static float |
glTransparencyMul
Modifies the multiplicator for the transparency calculations in jPCT-AE. |
static float |
glTransparencyOffset
Modifies the offset for the transparency calculations in jPCT-AE. |
static boolean |
glTriangleStrips
Experimental. |
static boolean |
glTrilinear
Use trilinear filtering between mip-map level. |
static boolean |
glUseIgnorantBlits
Forces the renderer to skip the texture conversion from the FrameBuffer's
blit(int[]...) |
static boolean |
internalMipmapCreation
If true, jPCT-AE will always use its own mipmap generation code even if
the GPU or driver could do it on its own. |
static int |
maxAnimationSubSequences
The maximum number of sub-sequences an Animation may contain. |
static int |
maxLights
The maximum number of lightsources that the Lights instance of a World
may handle. |
static int |
maxParentObjects
The maximum number of parent objects every object may have. usually, an
object has only one parent object anyway. |
static int |
maxPolysVisible
The maximum size of the VisList. |
static int |
maxTextureLayers
The maximum number of texture that a polygon can have. |
static int |
maxTextures
The inital number of textures the texture-manager can handle. |
static float |
nearPlane
The near clipping plane. |
static boolean |
oldStyle3DSLoader
jPCT 1.11+ features a fixed 3DS-loader, but the fix is based on
experience, not on file format specs, because they were all different and
inconsistent. |
static int |
polygonIDLimit
A value that defines how many polygon IDs that were part of a collision
will be stored before additional polygon IDs will be rejected. |
static boolean |
renderTargetsAsSubImages
If true, render targets will be filled using a method to copy sub images. |
static boolean |
reuseTextureBuffers
If set to true, buffers for uploading the textures will be reused if
possible. |
static boolean |
shadowMap4bpp
If true, a depth map will be limited to 16bit. |
static boolean |
skipDefaultShaders
If true, no default shaders except the universal one and the one used for
blitting will be compiled. |
static float |
specPow
The sharpness of specular highlights. |
static boolean |
stateOrientedSorting
If true, sorting will be state oriented. |
static boolean |
unloadImmediately
If true, textures will be unloaded immediately when calling one of the
unload-methods in the TextureManager. |
static boolean |
useFloatsForCollisions
Forces jPCT-AE to use floats for ray-polygon-collisions (and
calcMinDistance as well) instead of doubles. |
static boolean |
useNormalsFromOBJ
By default, jPCT calculates normals based on the mesh's geometry when
calling build(). |
static boolean |
usePowerVRTweaks
PowerVR chips labeled 6000 or higher are a buggy mess. |
static boolean |
useRotationPivotFrom3DS
By default, jPCT-AE calculates a rotation pivot based on the mesh's
geometry when calling build(). |
static boolean |
useVBO
Makes the engine use vertex buffer objects if possible instead of plain
vertex arrays. |
static int |
vertexBufferSize
Internal buffer used to upload vertex data to the gpu. |
static boolean |
viewportOffsetAffectsRenderTarget
If set to true, any offset to the viewport will affect the render target
as well. |
static float |
viewportOffsetX
Shifts the (normalized) viewport into x-direction, i.e. a value of 0.5
lets the rendering start in the middle of the framebuffer so that only
the leftmost half of the image is visible in the right half of the
framebuffer. |
static float |
viewportOffsetY
Shifts the (normalized) viewport into y-direction, i.e. a value of 0.5
lets the rendering start in the middle of the Framebuffer so that only
the uppermost half of the image is visible in the bottom of the
framebuffer. |
Method Summary |
static java.lang.String[] |
getParameterNames()
Returns the names of all public fields in Config, all configuration
options. |
static java.lang.Object |
getParameterValue(java.lang.String name)
Gets the current value of the parameter with the given name. |
static java.lang.String |
getVersion()
Returns the version of this release. |
static void |
setParameterValue(java.lang.String name,
java.lang.Object value)
Sets a parameter with the given name to a value. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
defaultCameraFOV
public static float defaultCameraFOV
- The default FOV for the camera. Takes effect at startup and when a new
camera is created. Default is 1.25.
autoMaintainAspectRatio
public static boolean autoMaintainAspectRatio
- Ensures that the aspect ratio doesn't change when changing framebuffer
size. Setting this to false causes xFOV and yFOV to be both set to FOV.
If it's set to true, only xFOV will be set to FOV and yFOV will
automatically be adjusted to a FOV-value that maintains the aspect ratio.
If yFOV is set explicitly in the camera, this setting will be ignored.
Default is true.
maxTextures
public static int maxTextures
- The inital number of textures the texture-manager can handle. The manager
wil increase the value if needed. This is in for historical reasons only.
No need to adjust it. Default is 64.
maxPolysVisible
public static int maxPolysVisible
- The maximum size of the VisList. This represents the number of instances
jPCT can display on screen per frame. If the instance number surpasses
this value, all additional instances will be rejected and not drawn. This
value has to be modified before instanciating a world. Default is 512.
Please note that the name of this setting is misleading. It's called this
way for compatibility with desktop jPCT.
maxLights
public static int maxLights
- The maximum number of lightsources that the Lights instance of a World
may handle. Has to be modified before constructing the World to take
effect. Default is 8.
maxAnimationSubSequences
public static int maxAnimationSubSequences
- The maximum number of sub-sequences an Animation may contain. The default
is 20 (which is fine for most MD2 files).
collideOffset
public static float collideOffset
- The maximum number in world units a polygon's corner and/or axis aligned
bounding box/octree-node (is used) may have from a position vector to be
taken into account as a potential collider in the collision detection
methods.
A polygon will be considered as a potential collider if its first corner
falls within a box with the length of 2*collideOffset and the position
vector used in the detection as midpoint.
This value may has be adjusted if the scaling of the world changes or the
movement speed of the camera is set to a very value high. Setting this to
a unnecessary high value reduces performance of collision detection while
setting it to a too low value can cause the collision detection to fail.
If the automated collision detection optimization is used on an object,
this value won't affect performance that much anymore. Anyway, it's taken
as an upper bound for the algorithm and for bounding box/octree-node
processing, so it may still be required to adjust it. Default is 40.
- See Also:
Object3D.setCollisionOptimization(boolean)
collideEdgeMul
public static float collideEdgeMul
- When using the sphere-polygon collision detection for the camera, it may
be useful to use a lower sphere radius for sphere-edge-collisions to
ensure that the camera slides around corners in a more realistic way. On
the other hand, this may also cause some "bouncing" in other areas.
Therefor, if the radius should be lowered, this value has to be adjusted.
A value of 1f means, that the same radius is used for sphere-edge and
sphere-polygon intersections. A lower value will lower the radius for
sphere-edge and higher values than 1f are possible, but don't make much
sense. Negative values will result in undefined behaviour. Default is 1f.
collideEllipsoidThreshold
public static float collideEllipsoidThreshold
- A threshold that limits recursion for ellipsoid collision detection. If
the length of the current velocity (after collision) is lower than the
initial velocity multiplied by with value, the recursion will stop.
Setting this to the very low value will make the collision detection more
accurate, but may also result in accuracy problems where collisions are
detected that don't happen. Default is 0.1f.
flashSortThreshold
public static int flashSortThreshold
- If the number of instances to sort exceeds this value, a flash sort will
be used instead of the default quick sort.
stateOrientedSorting
public static boolean stateOrientedSorting
- If true, sorting will be state oriented. If false, it will be spatial
oriented. Default is true.
nearPlane
public static float nearPlane
- The near clipping plane. Default is 1.
farPlane
public static float farPlane
- The far clipping plane. Default is 1000.
viewportOffsetX
public static float viewportOffsetX
- Shifts the (normalized) viewport into x-direction, i.e. a value of 0.5
lets the rendering start in the middle of the framebuffer so that only
the leftmost half of the image is visible in the right half of the
framebuffer. Useful for implementing sidebars and similar stuff. Possible
values are in the range of ]-1;1[, default is 0. This setting has NO
influence on blitting into the framebuffer but the methods in Interact2D
take it into account.
viewportOffsetY
public static float viewportOffsetY
- Shifts the (normalized) viewport into y-direction, i.e. a value of 0.5
lets the rendering start in the middle of the Framebuffer so that only
the uppermost half of the image is visible in the bottom of the
framebuffer. Useful for implementing sidebars and similar stuff. Possible
values are in the range of ]-1;1[, default is 0. This setting has NO
influence on blitting into the framebuffer but the methods in Interact2D
take it into account.
viewportOffsetAffectsRenderTarget
public static boolean viewportOffsetAffectsRenderTarget
- If set to true, any offset to the viewport will affect the render target
as well. If false, it won't. Default is false.
maxParentObjects
public static int maxParentObjects
- The maximum number of parent objects every object may have. usually, an
object has only one parent object anyway. Default is 1.
specPow
public static float specPow
- The sharpness of specular highlights. Specular lighting has to be used on
objects for this setting to take effect. Default is 6.
maxTextureLayers
public static int maxTextureLayers
- The maximum number of texture that a polygon can have. This is also
limited by the underlying hardware. Default is 2, which is fine to stay
compatible with older devices.
glTransparencyOffset
public static float glTransparencyOffset
- Modifies the offset for the transparency calculations in jPCT-AE. The
actual formula is trans=offset+objTrans*mul, default for offset is 0.1f.
glTransparencyMul
public static float glTransparencyMul
- Modifies the multiplicator for the transparency calculations in jPCT-AE.
The actual formula is trans=offset+objTrans*mul, default for offset is
0.1f.
internalMipmapCreation
public static boolean internalMipmapCreation
- If true, jPCT-AE will always use its own mipmap generation code even if
the GPU or driver could do it on its own. If it's false, jPCT-AE will use
the GPU to create them if possible. Default is true, because some devices
are having driver problems with mipmap generation.
glIgnoreNearPlane
public static boolean glIgnoreNearPlane
- If set to true, the renderer will ignore the configured near plane for
creating the frustum and use a default value instead. If it's false, the
near plane will be used. Default is true.
glIgnoreErrors
public static boolean glIgnoreErrors
- If set to true, GL errors will be ignored. If set to false, the app will
log the error and exit. Default is false.
glTriangleStrips
public static boolean glTriangleStrips
- Experimental. Default is false.
glDither
public static boolean glDither
- Use dithering. Will look better in 16bit mode but is slower. Default is
true.
glDebugLevel
public static int glDebugLevel
- Wraps gl calls to be printed out by the Logger if not set to 0. Default
is 0. While this works when using the OpenGL ES 2.0, it doesn't actually
log the ES 2.0 calls but the virtual ES 1.1 calls that jPCT-AE maps to
2.0. Has to be set before creating the FrameBuffer to have an effect.
glTrilinear
public static boolean glTrilinear
- Use trilinear filtering between mip-map level. Some devices don't like
this setting and produce only white texture, which is why it's false by
default.
glForceEnvMapToSecondStage
public static boolean glForceEnvMapToSecondStage
- By default, an environment map will be applied to the first texture stage
if environment mapping is used on an object. When combining it with multi
texturung, this may not always be want one wants, because the lighting
calculations of OpenGL may give you undesired results by applying the
lighting to the environment map instead of the base map. To work around
this problem, you can force jPCT to use the second texture stage for
environment mapping, if (and only if) the object uses multiple stages.
However, jPCT doesn't check if a particular polygon uses multiple stages.
So if you are forcing environment mapping to stage 2, make sure that your
multi textured object all have that stage for all polygons and that the
correct textures are assigned. Default is false.
glUseIgnorantBlits
public static boolean glUseIgnorantBlits
- Forces the renderer to skip the texture conversion from the FrameBuffer's
blit(int[]...)-method except for the first time. In other words: If this
is set to true, an int[]-array that should be used for blitting will be
converted into a texture exactly one time and this texture will be used
from there on as long as the size of the int[]-array to blit doesn't
change. This is much faster, but depending on the application, it may
blit nonsense. Default is false.
glRevertADDtoMODULATE
public static boolean glRevertADDtoMODULATE
- When setting this to true, every texture blending operation that uses the
additive mode will be treated as if it were using modulation instead.
glBatchSize
public static int glBatchSize
- When compiling an Object3D, the renderer has to assume an ideal batch
size for the underlying hardware. If that size is too small or too large,
performance may suffer or polygons are missing. The default is 8000.
glForceHighPrecision
public static boolean glForceHighPrecision
- Forces high precision for shaders even if the shader source states
otherwise. Default is false, i.e. the setting in the shader source will
be used instead.
renderTargetsAsSubImages
public static boolean renderTargetsAsSubImages
- If true, render targets will be filled using a method to copy sub images.
If false, they will be filled using another method. The sub image method
is the more compatible one, which is why it's default. Only change this,
if render targets don't work on your device. This affects the OpenGL ES
1.1 mode only. ES 2.0 will always use FBOs and render buffers.
useVBO
public static boolean useVBO
- Makes the engine use vertex buffer objects if possible instead of plain
vertex arrays. This might be faster on some hardware but not on all.
Default is true.
polygonIDLimit
public static int polygonIDLimit
- A value that defines how many polygon IDs that were part of a collision
will be stored before additional polygon IDs will be rejected. Default is
50.
vertexBufferSize
public static int vertexBufferSize
- Internal buffer used to upload vertex data to the gpu. Higher values
might increase performance but may cause memory problem on lower end
devices. Has to be multiple of 8 and 3. Default is 480.
aggressiveStripping
public static boolean aggressiveStripping
- A debug switch...might go away in later versions. If set to true,
Object3D.strip() will act a little more aggressive causing more memory to
be freed. If set to false, memory usage will increase a little. Only
adjust this, if advised to do so or if you feel that calling strip()
causes some trouble.
unloadImmediately
public static boolean unloadImmediately
- If true, textures will be unloaded immediately when calling one of the
unload-methods in the TextureManager. If false, unloading will be delayed
until the next frame is being rendered ensuring that it happens in the
same thread as the rendering does. Default is false.
useRotationPivotFrom3DS
public static boolean useRotationPivotFrom3DS
- By default, jPCT-AE calculates a rotation pivot based on the mesh's
geometry when calling build(). However, you might as well take the
rotation pivot from the 3DS file. Setting this to true will force jPCT to
use that pivot instead. Default is false.
useNormalsFromOBJ
public static boolean useNormalsFromOBJ
- By default, jPCT calculates normals based on the mesh's geometry when
calling build(). However, you might as well take the normals from an
OBJ-file. Setting this to true will force jPCT to use these normals
instead. Default is false.
oldStyle3DSLoader
public static boolean oldStyle3DSLoader
- jPCT 1.11+ features a fixed 3DS-loader, but the fix is based on
experience, not on file format specs, because they were all different and
inconsistent. If you are getting wrong object colors or an error message,
adjust this to true and see if it helps.
cacheCompressedTextures
public static boolean cacheCompressedTextures
- Experimental! With this, you can make jPCT cache ETC1-compressed textures
on disk. To use this, a Virtualizer has to be assigned to the
TextureManager.
skipDefaultShaders
public static boolean skipDefaultShaders
- If true, no default shaders except the universal one and the one used for
blitting will be compiled. This can useful, if you provide your own
shaders anyway. If you set this to true but are using some default
shaders anyway, performance will suffer. Default is false.
fixCollapsingVertices
public static boolean fixCollapsingVertices
- If a keyframe animation is build in a way that vertices collapse (i.e.
join the same space) during the animation, this can cause trouble with
indexed geometry. By setting this to true, one can apply a hacky
workaround for this. Default is false.
byteBufferLimit
public static int byteBufferLimit
- Sets a limit for internal byte buffers. If they are smaller than this
limit, they will be resued. If they are larger, they will be discarded
after use. This can improve load times at the cost of memory usage.
Default is 64K.
reuseTextureBuffers
public static boolean reuseTextureBuffers
- If set to true, buffers for uploading the textures will be reused if
possible. This can improve texture upload speed and may reduce garbage
collection activity during uploads but it can lead to peaks in memory
usage. Default is false.
useFloatsForCollisions
public static boolean useFloatsForCollisions
- Forces jPCT-AE to use floats for ray-polygon-collisions (and
calcMinDistance as well) instead of doubles. The reason behind this is,
that some older devices/VMs seem to have a bug in the JIT-compiler that
makes the double calculations go wrong and return no collisions even in
cases where there are some. Setting this to true will work around this
issue at the expense of accuracy. Default is false.
shadowMap4bpp
public static boolean shadowMap4bpp
- If true, a depth map will be limited to 16bit. If not, it will be 32bit.
Default is false.
usePowerVRTweaks
public static boolean usePowerVRTweaks
- PowerVR chips labeled 6000 or higher are a buggy mess. If this is set to true,
some more aggressive workarounds will be used for these chips. If false,
only basic workarounds will be used. Default is true.
aaMode
public static int aaMode
- Don't fiddle around with this! Just pretend that it isn't there.
getVersion
public static java.lang.String getVersion()
- Returns the version of this release. Use this instead of VERSION.
- Returns:
- the current version
setParameterValue
public static void setParameterValue(java.lang.String name,
java.lang.Object value)
- Sets a parameter with the given name to a value. This method can be used
to access the configuration variables via their names instead of setting
them directly. This is more suitable for setting them from some
configuration file's data, but its slower than direct access, because it
uses reflection.
- Parameters:
name
- the namevalue
- the value
getParameterValue
public static java.lang.Object getParameterValue(java.lang.String name)
- Gets the current value of the parameter with the given name. Because if
type of the value is unknown, this method simply returns an Object. It's
up to you to convert it correctly.
- Parameters:
name
- the name
- Returns:
- the value
getParameterNames
public static java.lang.String[] getParameterNames()
- Returns the names of all public fields in Config, all configuration
options.
- Returns:
- the names in no particular order