C# Class OpenSim.Region.Physics.OdePlugin.OdeScene

Inheritance: PhysicsScene
显示文件 Open project: N3X15/VoxelSim Class Usage Examples

Public Properties

Property Type Description
MeshSculptphysicalLOD float
OdeLock Object
WorldExtents System.Vector2
actor_name_map PhysicsActor>.Dictionary
bodyFramesAutoDisable int
bodyMotorJointMaxforceTensor float
bodyPIDD float
bodyPIDG float
forceSimplePrimMeshing bool
geomContactPointsStartthrottle int
geomCrossingFailuresBeforeOutofbounds int
geomDefaultDensity float
geomUpdatesPerThrottledUpdate int
geom_name_map String>.Dictionary
gravityx float
gravityy float
gravityz float
hpr Ode.NET.d.Vector3
maximumMassObject float
meshSculptLOD float
meshSculptedPrim bool
mesher IMesher
physics_logging bool
physics_logging_append_existing_logfile bool
physics_logging_interval int
space IntPtr
staticPrimspace ].IntPtr[
triArrayCallback d.TriArrayCallback
triCallback d.TriCallback
voxmesher IVoxelMesher
world IntPtr
xyz d.Vector3

Public Methods

Method Description
AddAvatar ( string avName, System.Vector3 position, System.Vector3 size, bool isFlying ) : PhysicsActor
AddCharacter ( OpenSim.Region.Physics.OdePlugin.OdeCharacter chr ) : void
AddPhysicsActorTaint ( PhysicsActor prim ) : void

Called after our prim properties are set Scale, position etc. We use this event queue like method to keep changes to the physical scene occuring in the threadlocked mutex This assures us that we have no race conditions

AddPrimShape ( string primName, OpenSim.Framework.PrimitiveBaseShape pbs, System.Vector3 position, System.Vector3 size, Quaternion rotation ) : PhysicsActor
AddPrimShape ( string primName, OpenSim.Framework.PrimitiveBaseShape pbs, System.Vector3 position, System.Vector3 size, Quaternion rotation, bool isPhysical ) : PhysicsActor
BadCharacter ( OpenSim.Region.Physics.OdePlugin.OdeCharacter chr ) : void
Combine ( PhysicsScene pScene, System.Vector3 offset, System.Vector3 extents ) : void
DeleteTerrain ( ) : void
Dispose ( ) : void
DumpJointInfo ( ) : void
GetJointAnchor ( OpenSim.Region.Physics.Manager.PhysicsJoint joint ) : System.Vector3
GetJointAxis ( OpenSim.Region.Physics.Manager.PhysicsJoint joint ) : System.Vector3
GetResults ( ) : void
GetTerrainHeightAtXY ( float x, float y ) : float
GetTopColliders ( ) : float>.Dictionary
GetWaterLevel ( ) : float
Initialise ( IMesher meshmerizer, IVoxelMesher voxmesh, IConfigSource config ) : void
OdeScene ( OpenSim.Region.Physics.Manager.CollisionLocker dode, string sceneIdentifier ) : System

Initiailizes the scene Sets many properties that ODE requires to be stable These settings need to be tweaked 'exactly' right or weird stuff happens.

RaycastWorld ( System.Vector3 position, System.Vector3 direction, float length, RaycastCallback retMethod ) : void
RemoveAllJointsConnectedToActorThreadLocked ( PhysicsActor actor ) : void
RemoveAvatar ( PhysicsActor actor ) : void
RemoveCharacter ( OpenSim.Region.Physics.OdePlugin.OdeCharacter chr ) : void
RemovePrim ( PhysicsActor prim ) : void
RemovePrimThreadLocked ( OpenSim.Region.Physics.OdePlugin.OdePrim prim ) : void

This is called from within simulate but outside the locked portion We need to do our own locking here Essentially, we need to remove the prim from our space segment, whatever segment it's in. If there are no more prim in the segment, we need to empty (spacedestroy)the segment and reclaim memory that the space was using.

RequestJointCreation ( string objectNameInScene, PhysicsJointType jointType, System.Vector3 position, Quaternion rotation, string parms, List bodyNames, string trackedBodyName, Quaternion localRotation ) : OpenSim.Region.Physics.Manager.PhysicsJoint
RequestJointDeletion ( string ObjectNameInScene ) : void
ResizeTerrain512Interpolation ( float heightMap ) : float[]
ResizeTerrain512NearestNeighbour ( float heightMap ) : float[]
SetTerrain ( bool voxmap ) : void
SetTerrain ( bool voxmap, System.Vector3 pOffset ) : void
SetWaterLevel ( float baseheight ) : void
Simulate ( float timeStep ) : float

This is our main simulate loop It's thread locked by a Mutex in the scene. It holds Collisions, it instructs ODE to step through the physical reactions It moves the objects around in memory It calls the methods that report back to the object owners.. (scenepresence, SceneObjectGroup)

SupportsCombining ( ) : bool
SupportsRayCast ( ) : bool
TriArrayCallback ( IntPtr trimesh, IntPtr refObject, int triangleIndex, int triCount ) : int
TriCallback ( IntPtr trimesh, IntPtr refObject, int triangleIndex ) : int
UnCombine ( PhysicsScene pScene ) : void
addActivePrim ( OpenSim.Region.Physics.OdePlugin.OdePrim activatePrim ) : void
addCollisionEventReporting ( PhysicsActor obj ) : void
calculateSpaceArrayItemFromPos ( System.Vector3 pos ) : int[]

Holds the space allocation logic

calculateSpaceForGeom ( System.Vector3 pos ) : IntPtr

Calculates the space the prim should be in by its position

command ( int cmd ) : void
createprimspace ( int iprimspaceArrItemX, int iprimspaceArrItemY ) : IntPtr

Creates a new space at X Y

needsMeshing ( OpenSim.Framework.PrimitiveBaseShape pbs ) : bool

Routine to figure out if we need to mesh this prim with our mesher

randomizeWater ( float baseheight ) : void
recalculateSpaceForGeom ( IntPtr geom, Vector3 pos, IntPtr currentspace ) : IntPtr

Called when a static prim moves. Allocates a space for the prim based on its position

remActivePrim ( OdePrim deactivatePrim ) : void
remCollisionEventReporting ( PhysicsActor obj ) : void
resetSpaceArrayItemToZero ( IntPtr pSpace ) : void

Takes a space pointer and zeros out the array we're using to hold the spaces

resetSpaceArrayItemToZero ( int arrayitemX, int arrayitemY ) : void
start ( int unused ) : void
startvisualization ( object o ) : void
step ( int pause ) : void
whichspaceamIin ( Vector3 pos ) : string

Debug space message for printing the space that a prim/avatar is in.

Private Methods

Method Description
AddPrim ( String name, System.Vector3 position, System.Vector3 size, Quaternion rotation, IMesh mesh, OpenSim.Framework.PrimitiveBaseShape pbs, bool isphysical ) : PhysicsActor
CreateRequestedJoints ( ) : void
DeleteRequestedJoints ( ) : void
InternalAddActiveJoint ( OpenSim.Region.Physics.Manager.PhysicsJoint joint ) : void
InternalAddPendingJoint ( OpenSim.Region.Physics.OdePlugin.OdePhysicsJoint joint ) : void
InternalRemoveActiveJoint ( OpenSim.Region.Physics.Manager.PhysicsJoint joint ) : void
InternalRemovePendingJoint ( OpenSim.Region.Physics.Manager.PhysicsJoint joint ) : void
RemoveAllJointsConnectedToActor ( PhysicsActor actor ) : void
checkDupe ( Ode.NET.d contactGeom, int atype ) : bool
collision_accounting_events ( PhysicsActor p1, PhysicsActor p2, ContactPoint contact ) : void
collision_optimized ( float timeStep ) : void

This is our collision testing routine in ODE

near ( IntPtr space, IntPtr g1, IntPtr g2 ) : void

This is our near callback. A geometry is near a body

waitForSpaceUnlock ( IntPtr space ) : void

Method Details

AddAvatar() public method

public AddAvatar ( string avName, System.Vector3 position, System.Vector3 size, bool isFlying ) : PhysicsActor
avName string
position System.Vector3
size System.Vector3
isFlying bool
return PhysicsActor

AddCharacter() public method

public AddCharacter ( OpenSim.Region.Physics.OdePlugin.OdeCharacter chr ) : void
chr OpenSim.Region.Physics.OdePlugin.OdeCharacter
return void

AddPhysicsActorTaint() public method

Called after our prim properties are set Scale, position etc. We use this event queue like method to keep changes to the physical scene occuring in the threadlocked mutex This assures us that we have no race conditions
public AddPhysicsActorTaint ( PhysicsActor prim ) : void
prim PhysicsActor
return void

AddPrimShape() public method

public AddPrimShape ( string primName, OpenSim.Framework.PrimitiveBaseShape pbs, System.Vector3 position, System.Vector3 size, Quaternion rotation ) : PhysicsActor
primName string
pbs OpenSim.Framework.PrimitiveBaseShape
position System.Vector3
size System.Vector3
rotation Quaternion
return PhysicsActor

AddPrimShape() public method

public AddPrimShape ( string primName, OpenSim.Framework.PrimitiveBaseShape pbs, System.Vector3 position, System.Vector3 size, Quaternion rotation, bool isPhysical ) : PhysicsActor
primName string
pbs OpenSim.Framework.PrimitiveBaseShape
position System.Vector3
size System.Vector3
rotation Quaternion
isPhysical bool
return PhysicsActor

BadCharacter() public method

public BadCharacter ( OpenSim.Region.Physics.OdePlugin.OdeCharacter chr ) : void
chr OpenSim.Region.Physics.OdePlugin.OdeCharacter
return void

Combine() public method

public Combine ( PhysicsScene pScene, System.Vector3 offset, System.Vector3 extents ) : void
pScene PhysicsScene
offset System.Vector3
extents System.Vector3
return void

DeleteTerrain() public method

public DeleteTerrain ( ) : void
return void

Dispose() public method

public Dispose ( ) : void
return void

DumpJointInfo() public method

public DumpJointInfo ( ) : void
return void

GetJointAnchor() public method

public GetJointAnchor ( OpenSim.Region.Physics.Manager.PhysicsJoint joint ) : System.Vector3
joint OpenSim.Region.Physics.Manager.PhysicsJoint
return System.Vector3

GetJointAxis() public method

public GetJointAxis ( OpenSim.Region.Physics.Manager.PhysicsJoint joint ) : System.Vector3
joint OpenSim.Region.Physics.Manager.PhysicsJoint
return System.Vector3

GetResults() public method

public GetResults ( ) : void
return void

GetTerrainHeightAtXY() public method

public GetTerrainHeightAtXY ( float x, float y ) : float
x float
y float
return float

GetTopColliders() public method

public GetTopColliders ( ) : float>.Dictionary
return float>.Dictionary

GetWaterLevel() public method

public GetWaterLevel ( ) : float
return float

Initialise() public method

public Initialise ( IMesher meshmerizer, IVoxelMesher voxmesh, IConfigSource config ) : void
meshmerizer IMesher
voxmesh IVoxelMesher
config IConfigSource
return void

OdeScene() public method

Initiailizes the scene Sets many properties that ODE requires to be stable These settings need to be tweaked 'exactly' right or weird stuff happens.
public OdeScene ( OpenSim.Region.Physics.Manager.CollisionLocker dode, string sceneIdentifier ) : System
dode OpenSim.Region.Physics.Manager.CollisionLocker
sceneIdentifier string
return System

RaycastWorld() public method

public RaycastWorld ( System.Vector3 position, System.Vector3 direction, float length, RaycastCallback retMethod ) : void
position System.Vector3
direction System.Vector3
length float
retMethod RaycastCallback
return void

RemoveAllJointsConnectedToActorThreadLocked() public method

public RemoveAllJointsConnectedToActorThreadLocked ( PhysicsActor actor ) : void
actor PhysicsActor
return void

RemoveAvatar() public method

public RemoveAvatar ( PhysicsActor actor ) : void
actor PhysicsActor
return void

RemoveCharacter() public method

public RemoveCharacter ( OpenSim.Region.Physics.OdePlugin.OdeCharacter chr ) : void
chr OpenSim.Region.Physics.OdePlugin.OdeCharacter
return void

RemovePrim() public method

public RemovePrim ( PhysicsActor prim ) : void
prim PhysicsActor
return void

RemovePrimThreadLocked() public method

This is called from within simulate but outside the locked portion We need to do our own locking here Essentially, we need to remove the prim from our space segment, whatever segment it's in. If there are no more prim in the segment, we need to empty (spacedestroy)the segment and reclaim memory that the space was using.
public RemovePrimThreadLocked ( OpenSim.Region.Physics.OdePlugin.OdePrim prim ) : void
prim OpenSim.Region.Physics.OdePlugin.OdePrim
return void

RequestJointCreation() public method

public RequestJointCreation ( string objectNameInScene, PhysicsJointType jointType, System.Vector3 position, Quaternion rotation, string parms, List bodyNames, string trackedBodyName, Quaternion localRotation ) : OpenSim.Region.Physics.Manager.PhysicsJoint
objectNameInScene string
jointType PhysicsJointType
position System.Vector3
rotation Quaternion
parms string
bodyNames List
trackedBodyName string
localRotation Quaternion
return OpenSim.Region.Physics.Manager.PhysicsJoint

RequestJointDeletion() public method

public RequestJointDeletion ( string ObjectNameInScene ) : void
ObjectNameInScene string
return void

ResizeTerrain512Interpolation() public method

public ResizeTerrain512Interpolation ( float heightMap ) : float[]
heightMap float
return float[]

ResizeTerrain512NearestNeighbour() public method

public ResizeTerrain512NearestNeighbour ( float heightMap ) : float[]
heightMap float
return float[]

SetTerrain() public method

public SetTerrain ( bool voxmap ) : void
voxmap bool
return void

SetTerrain() public method

public SetTerrain ( bool voxmap, System.Vector3 pOffset ) : void
voxmap bool
pOffset System.Vector3
return void

SetWaterLevel() public method

public SetWaterLevel ( float baseheight ) : void
baseheight float
return void

Simulate() public method

This is our main simulate loop It's thread locked by a Mutex in the scene. It holds Collisions, it instructs ODE to step through the physical reactions It moves the objects around in memory It calls the methods that report back to the object owners.. (scenepresence, SceneObjectGroup)
public Simulate ( float timeStep ) : float
timeStep float
return float

SupportsCombining() public method

public SupportsCombining ( ) : bool
return bool

SupportsRayCast() public method

public SupportsRayCast ( ) : bool
return bool

TriArrayCallback() public method

public TriArrayCallback ( IntPtr trimesh, IntPtr refObject, int triangleIndex, int triCount ) : int
trimesh System.IntPtr
refObject System.IntPtr
triangleIndex int
triCount int
return int

TriCallback() public method

public TriCallback ( IntPtr trimesh, IntPtr refObject, int triangleIndex ) : int
trimesh System.IntPtr
refObject System.IntPtr
triangleIndex int
return int

UnCombine() public method

public UnCombine ( PhysicsScene pScene ) : void
pScene PhysicsScene
return void

addActivePrim() public method

public addActivePrim ( OpenSim.Region.Physics.OdePlugin.OdePrim activatePrim ) : void
activatePrim OpenSim.Region.Physics.OdePlugin.OdePrim
return void

addCollisionEventReporting() public method

public addCollisionEventReporting ( PhysicsActor obj ) : void
obj PhysicsActor
return void

calculateSpaceArrayItemFromPos() public method

Holds the space allocation logic
public calculateSpaceArrayItemFromPos ( System.Vector3 pos ) : int[]
pos System.Vector3
return int[]

calculateSpaceForGeom() public method

Calculates the space the prim should be in by its position
public calculateSpaceForGeom ( System.Vector3 pos ) : IntPtr
pos System.Vector3
return System.IntPtr

command() public method

public command ( int cmd ) : void
cmd int
return void

createprimspace() public method

Creates a new space at X Y
public createprimspace ( int iprimspaceArrItemX, int iprimspaceArrItemY ) : IntPtr
iprimspaceArrItemX int
iprimspaceArrItemY int
return System.IntPtr

needsMeshing() public method

Routine to figure out if we need to mesh this prim with our mesher
public needsMeshing ( OpenSim.Framework.PrimitiveBaseShape pbs ) : bool
pbs OpenSim.Framework.PrimitiveBaseShape
return bool

randomizeWater() public method

public randomizeWater ( float baseheight ) : void
baseheight float
return void

recalculateSpaceForGeom() public method

Called when a static prim moves. Allocates a space for the prim based on its position
public recalculateSpaceForGeom ( IntPtr geom, Vector3 pos, IntPtr currentspace ) : IntPtr
geom IntPtr the pointer to the geom that moved
pos Vector3 the position that the geom moved to
currentspace IntPtr a pointer to the space it was in before it was moved.
return IntPtr

remActivePrim() public method

public remActivePrim ( OdePrim deactivatePrim ) : void
deactivatePrim OdePrim
return void

remCollisionEventReporting() public method

public remCollisionEventReporting ( PhysicsActor obj ) : void
obj PhysicsActor
return void

resetSpaceArrayItemToZero() public method

Takes a space pointer and zeros out the array we're using to hold the spaces
public resetSpaceArrayItemToZero ( IntPtr pSpace ) : void
pSpace IntPtr
return void

resetSpaceArrayItemToZero() public method

public resetSpaceArrayItemToZero ( int arrayitemX, int arrayitemY ) : void
arrayitemX int
arrayitemY int
return void

start() public method

public start ( int unused ) : void
unused int
return void

startvisualization() public method

public startvisualization ( object o ) : void
o object
return void

step() public method

public step ( int pause ) : void
pause int
return void

whichspaceamIin() public method

Debug space message for printing the space that a prim/avatar is in.
public whichspaceamIin ( Vector3 pos ) : string
pos Vector3
return string

Property Details

MeshSculptphysicalLOD public_oe property

public float MeshSculptphysicalLOD
return float

OdeLock public_oe property

public Object OdeLock
return Object

WorldExtents public_oe property

public Vector2,System WorldExtents
return System.Vector2

actor_name_map public_oe property

public Dictionary actor_name_map
return PhysicsActor>.Dictionary

bodyFramesAutoDisable public_oe property

public int bodyFramesAutoDisable
return int

bodyMotorJointMaxforceTensor public_oe property

public float bodyMotorJointMaxforceTensor
return float

bodyPIDD public_oe property

public float bodyPIDD
return float

bodyPIDG public_oe property

public float bodyPIDG
return float

forceSimplePrimMeshing public_oe property

public bool forceSimplePrimMeshing
return bool

geomContactPointsStartthrottle public_oe property

public int geomContactPointsStartthrottle
return int

geomCrossingFailuresBeforeOutofbounds public_oe property

public int geomCrossingFailuresBeforeOutofbounds
return int

geomDefaultDensity public_oe property

public float geomDefaultDensity
return float

geomUpdatesPerThrottledUpdate public_oe property

public int geomUpdatesPerThrottledUpdate
return int

geom_name_map public_oe property

public Dictionary geom_name_map
return String>.Dictionary

gravityx public_oe property

public float gravityx
return float

gravityy public_oe property

public float gravityy
return float

gravityz public_oe property

public float gravityz
return float

hpr public_oe property

public d.Vector3,Ode.NET hpr
return Ode.NET.d.Vector3

maximumMassObject public_oe property

public float maximumMassObject
return float

meshSculptLOD public_oe property

public float meshSculptLOD
return float

meshSculptedPrim public_oe property

public bool meshSculptedPrim
return bool

mesher public_oe property

public IMesher mesher
return IMesher

physics_logging public_oe property

public bool physics_logging
return bool

physics_logging_append_existing_logfile public_oe property

public bool physics_logging_append_existing_logfile
return bool

physics_logging_interval public_oe property

public int physics_logging_interval
return int

space public_oe property

public IntPtr space
return IntPtr

staticPrimspace public_oe property

public IntPtr[,] staticPrimspace
return ].IntPtr[

triArrayCallback public_oe property

public d.TriArrayCallback triArrayCallback
return d.TriArrayCallback

triCallback public_oe property

public d.TriCallback triCallback
return d.TriCallback

voxmesher public_oe property

public IVoxelMesher voxmesher
return IVoxelMesher

world public_oe property

public IntPtr world
return IntPtr

xyz public_oe property

public d.Vector3 xyz
return d.Vector3