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 boolean |
aggressiveStripping
A debug switch...might go away in later version. |
static boolean |
autoMaintainAspectRatio
Ensures that the aspect ratio doesn't change when changing framebuffer
size. |
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 |
collideSectorOffset
The number of units a position vector may be placed outside of a sector
and still be considered as part of it as far as collision detection is
concerned. |
static float |
defaultCameraFOV
The default FOV for the camera. |
static float |
farPlane
The far clipping plane. |
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 boolean |
glAvoidTextureCopies
If true, texture data will be erased from main memory after uploading the
texture to the graphics card. |
static int |
glBatchSize
When compiling an Object3D, the renderer has to assume an ideal batch size for the underlying hardware. |
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 |
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 |
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 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 float |
specPow
The sharpness of specular highlights. |
static float |
specTerm
An "amplifier"-value for specular highlights. |
static boolean |
stateOrientedSorting
If true, sorting will be state oriented. |
static boolean |
useVBO
Makes the engine use vertex buffer objects if possible instead of plain
vertex arrays. |
static int |
vectorCacheSize
Size of an internal cache for storing SimpleVectors. |
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 reaons. No need to
adjust it.
Default is 32.
maxPolysVisible
public static int maxPolysVisible
- The maximum size of the VisList. This represents the number of polygons
jPCT can display on screen per frame. If the polygon number surpasses
this value, all additional polygons will be rejected and not drawn. This
value has to be modified before instanciating a world. Default is 4096.
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 (for most MD2).
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.
collideSectorOffset
public static float collideSectorOffset
- The number of units a position vector may be placed outside of a sector
and still be considered as part of it as far as collision detection is
concerned. This value is important for detecting the collision with parts
of the sector the direction vector points to (in other words: where the
entity moves into). A value too high may cause unnecessary checsk while a
value too low may cause collision detection to fail at sector borders.
Default is 3.
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.
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.
specTerm
public static float specTerm
- An "amplifier"-value for specular highlights. Specular lighting has to be
used on objects for this setting to take effect. Default is 10.
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 for Android.
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. Default is false, which actually means choose.
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.
glDither
public static boolean glDither
- Use dithering. Will look better in 16bit mode but is slower. Default is false.
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.
glAvoidTextureCopies
public static boolean glAvoidTextureCopies
- If true, texture data will be erased from main memory after uploading the
texture to the graphics card. If set to false, a copy in main memory will be
kept in case that the texture has to be uploaded again. 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.
useVBO
public static boolean useVBO
- Makes the engine use vertex buffer objects if possible instead of plain
vertex arrays. This may be faster on some hardware. On Samsung Galaxy, it isn't and
i can't help but think that enabling it causes a crash now and then...which is why it defaults to false.
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.
vectorCacheSize
public static int vectorCacheSize
- Size of an internal cache for storing SimpleVectors. Increasing this may help to reduce garbage collection
but requires more memory.
aggressiveStripping
public static boolean aggressiveStripping
- A debug switch...might go away in later version. 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.
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