|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthmi.environment.GraphicsDemoEnvironment
hmi.environment.PhysicalDemoEnvironment
public class PhysicalDemoEnvironment
Extends GraphicsDemoEnvironment with a physical world and physical simulation. Adds, by default, the checkerboard ground as physical representation, and a throwable ball, to the scene.
| Nested Class Summary | |
|---|---|
(package private) class |
PhysicalDemoEnvironment.CollisionCheckListener
|
(package private) class |
PhysicalDemoEnvironment.PhysicsCheckListener
|
(package private) class |
PhysicalDemoEnvironment.PhysicsClockListener
Links physics clock to the physicsTime method in which the simulation should be updated |
(package private) static class |
PhysicalDemoEnvironment.Sleeper
Added as a hack to enforce high precision timing |
(package private) class |
PhysicalDemoEnvironment.ThrowBallListener
position the physical sphere, and give it a speed; the graphical sphere will follow the physical one... |
| Nested classes/interfaces inherited from class hmi.environment.GraphicsDemoEnvironment |
|---|
GraphicsDemoEnvironment.DebugCheckListener, GraphicsDemoEnvironment.MyRenderclockCallback, GraphicsDemoEnvironment.PlayListener, GraphicsDemoEnvironment.ResetListener |
| Field Summary | |
|---|---|
protected org.odejava.collision.JavaCollision |
collision
To calculate collisions and their effecting forces/impulses. |
boolean |
collisionEnabled
Simulate collisions yes or no? |
protected float[] |
g
Direction and strength of gravity in this environment |
protected org.odejava.JointGroup |
glueJointGroup
all joints that are glued to the floor? |
protected org.odejava.GeomPlane |
groundGeom
By default, the physical world contains this physical representation of the Visual ground |
private org.slf4j.Logger |
logger
|
protected OdeRigidBody |
phsphere
By default, the scene contains this hard coded physical sphere, which also has a graphical and Animation representation. |
protected org.odejava.World |
phworld
The Physical World |
protected SystemClock |
physicsClock
The clock on which steps in the physical simulation are taken |
long |
physicsLoopFrequency
physics is calculated on about 2 times render speed: you want every render tick to surely have latest physics results in it, or at most one animatino step (half a render frame time) behind time... |
protected List<Runnable> |
physicsRunners
|
protected double |
prevTime
last time stamp for which physics was simulated. |
boolean |
runphysics
If set to false, no physics are calculated |
protected org.odejava.HashSpace |
space
Collison space? |
private static float[] |
sphereAmbient
color settings for the default phsphere object |
protected VJoint |
sphereAnimationJoint
The animation joint of the phsphere |
private static float[] |
sphereDiffuse
color settings for the default phsphere object |
private static float[] |
sphereEmission
color settings for the default phsphere object |
protected VJoint |
sphereRenderJoint
The render vjoint of the phsphere |
private static float[] |
sphereSpecular
color settings for the default phsphere object |
protected float |
timeStep
Stepsize for physics simulation in seconds. |
| Fields inherited from class hmi.environment.GraphicsDemoEnvironment |
|---|
background, color_buf_tex, debugJOGL, depth_buf_tex, dx, dy, dz, enableFSAA, fovyFar, fovyNear, frameTitle, FSAA_samples, fullscreen, glCanvas, glNavControl, glObjectControl, hiddenVisualisations, jframe, laptop, light0, light1, light2, light3, light4, lightPos0, lightPos1, lightPos2, lightPos3, lightPos4, numStencilBits, render, renderClock, renderDebugVisualisations, renderer, renderRunners, shutdownSync, toolBar, useVsync, vglSceneRenderRoot, visualisations, visualisationsUninitialized, vjNavigationNode, vjSceneRenderRoot, vjWorldAnimationRoot, vjWorldRenderRoot, wowTransformMatrix, wowvx, wowvx_header_data, wowvx_header_tex |
| Constructor Summary | |
|---|---|
PhysicalDemoEnvironment()
|
|
| Method Summary | |
|---|---|
void |
addPhysicsRunner(Runnable r)
Add a runner to the physics thread. |
private void |
cleanUpOdeObjects()
|
void |
close()
Clean up native ODE objects. |
protected void |
disposeFrame()
close button pressed, extend or override in subclass |
void |
glueFeetToFloor(PhysicalHumanoid pHuman)
Connects the ankle segments to the world with a fixed, unmovable joint, to prevent the feet from slipping |
void |
init()
Init the world physics before initializing the rest of the system; after initialization, set up the physics of the default sphere (graphics of it was already done in initGraphicScene) and of the ground |
protected void |
initGraphicScene()
Add the graphical representation for the phsphere to the graphical scene |
protected void |
initGraphicSphere()
do the init of the graphical sphere |
protected void |
initGroundPhysics()
Initialise the default physical representation of the ground The default invocation from init is synchronized to the PhysicsSync |
protected void |
initQuickSettings()
By default, override the frameTitl. |
protected void |
initSpherePhysics()
Create the physics of the default sphere and connect it to the graphical representation of the sphere. |
void |
initThrowBallButton()
|
protected void |
initUI()
Make frame, make canvas, make toolbars & buttons... |
protected void |
initUI(boolean collisionEnabledCheck,
boolean runPhysicsCheck)
Add a 'throw ball' button to the default UI, and a 'collisionenabled' and 'runphysics' box |
protected void |
initWorldPhysics()
Initialise the world physics, collision space, etc When called from init, this is garanteed to be locked on the physics sync |
protected void |
physicsCopy()
|
protected void |
physicsRun(double currentTime)
|
protected void |
physicsTick(float delta)
Called for every tick of the physics simulation, runs collisions and steps the physical world. |
protected void |
physicsTime(double currentTime)
Called from the physicsclock. |
protected void |
prepareClose()
prepare to close on a physicsrunner |
void |
prepareDispose()
prepare to close on a renderrunner |
void |
prepareReset()
prepare to reset on a physicsrunner |
protected void |
reset()
On reset, reset some of the collision info. |
void |
setCollisionEnabled(boolean ce)
CAn also be done through overriding the quicksettings... |
void |
setPhysicsEnabled(boolean rp)
CAn also be done through overriding the quicksettings... |
void |
startClocks()
in addition to super.startClocks, start physics clock... |
void |
toggleCollision()
|
void |
togglePhysics()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private org.slf4j.Logger logger
public boolean runphysics
public long physicsLoopFrequency
public boolean collisionEnabled
protected float[] g
protected float timeStep
protected List<Runnable> physicsRunners
protected org.odejava.World phworld
protected org.odejava.HashSpace space
protected org.odejava.collision.JavaCollision collision
protected SystemClock physicsClock
protected double prevTime
protected org.odejava.GeomPlane groundGeom
protected OdeRigidBody phsphere
protected VJoint sphereAnimationJoint
protected VJoint sphereRenderJoint
private static final float[] sphereDiffuse
private static final float[] sphereSpecular
private static final float[] sphereAmbient
private static final float[] sphereEmission
protected org.odejava.JointGroup glueJointGroup
| Constructor Detail |
|---|
public PhysicalDemoEnvironment()
| Method Detail |
|---|
protected void initUI(boolean collisionEnabledCheck,
boolean runPhysicsCheck)
protected void initUI()
GraphicsDemoEnvironment
initUI in class GraphicsDemoEnvironmentpublic void initThrowBallButton()
public void addPhysicsRunner(Runnable r)
protected void initGraphicScene()
initGraphicScene in class GraphicsDemoEnvironmentprotected void initGraphicSphere()
public void startClocks()
startClocks in class GraphicsDemoEnvironmentprotected void initQuickSettings()
initQuickSettings in class GraphicsDemoEnvironmentpublic void init()
init in class GraphicsDemoEnvironmentprotected void initWorldPhysics()
protected void initSpherePhysics()
protected void initGroundPhysics()
protected void physicsTick(float delta)
protected void physicsRun(double currentTime)
protected void physicsCopy()
protected void physicsTime(double currentTime)
private void cleanUpOdeObjects()
public void close()
close in class GraphicsDemoEnvironment
protected void disposeFrame()
throws InterruptedException,
InvocationTargetException
GraphicsDemoEnvironment
disposeFrame in class GraphicsDemoEnvironmentInterruptedException
InvocationTargetExceptionprotected void reset()
reset in class GraphicsDemoEnvironmentpublic void toggleCollision()
public void togglePhysics()
public void prepareReset()
prepareReset in class GraphicsDemoEnvironmentprotected void prepareClose()
prepareClose in class GraphicsDemoEnvironmentpublic void prepareDispose()
GraphicsDemoEnvironment
prepareDispose in class GraphicsDemoEnvironmentpublic void glueFeetToFloor(PhysicalHumanoid pHuman)
pHuman - human to tighten in place like thispublic void setCollisionEnabled(boolean ce)
ce - the collisionEnabled to setpublic void setPhysicsEnabled(boolean rp)
rp - the runPhysics to set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||