public Position2D GetScreenCoordinatesFrom3DPosition(Vector3D position, CameraSceneNode camera)
 {
     IntPtr cam = (camera == null ? IntPtr.Zero : camera.Raw);
     int[] sc = new int[2];
     SceneCollisionManager_GetScreenCoordinatesFrom3DPosition(_raw, position.ToUnmanaged(), cam, sc);
     return Position2D.FromUnmanaged(sc);
 }
 public Vector3D GetCollisionResultPoint(TriangleSelector selector, Vector3D ellipsoidPosition, Vector3D ellipsoidRadius, Vector3D ellipsoidDirectionAndSpeed, out Triangle3D outTriangle, out bool outFalling, float slidingSpeed, Vector3D gravityDirectionAndSpeed)
 {
     float[] outtri = new float[9];
     float[] outpos = new float[3];
     outFalling = false;
     SceneCollisionManager_GetCollisionResultPoint(_raw, selector.Raw, ellipsoidPosition.ToUnmanaged(), ellipsoidRadius.ToUnmanaged(), ellipsoidDirectionAndSpeed.ToUnmanaged(), outtri, ref outFalling, slidingSpeed, gravityDirectionAndSpeed.ToUnmanaged(), outpos);
     outTriangle = Triangle3D.FromUnmanaged(outtri);
     return Vector3D.FromUnmanaged(outpos);
 }
 public TextSceneNode AddBillboardTextSceneNodeW(GUIFont font, string text, SceneNode parent, Dimension2Df size, Vector3D position, int id, Color shade_top, Color shade_down)
 {
     IntPtr par = IntPtr.Zero;
     if (parent != null)
         par = parent.Raw;
     return (TextSceneNode)
         NativeElement.GetObject(SceneManager_AddTextSceneNode2W(_raw, font.Raw, text, par, size.ToUnmanaged(), position.ToUnmanaged(),
                                                         id, shade_top.ToUnmanaged(), shade_down.ToUnmanaged()),
                                 typeof(TextSceneNode));
 }
Esempio n. 4
0
 /// <summary>
 /// Creates a simple animator that will rotate.
 /// </summary>
 /// <returns>An Animator</returns>
 /// <param name="rotation">Rotation</param>
 public Animator CreateRotationAnimator(Vector3D rotation)
 {
     return (Animator)
         NativeElement.GetObject(SceneManager_CreateRotationAnimator(_raw, rotation.ToUnmanaged()),
                                 typeof(Animator));
 }
Esempio n. 5
0
 /// <summary>
 /// Creates an animator that will fly from one point to... another one !
 /// </summary>
 /// <returns>An Animator</returns>
 /// <param name="start">Start</param>
 /// <param name="end">End</param>
 /// <param name="time">Time needed</param>
 /// <param name="loop">May the movement be looped ?</param>
 public Animator CreateFlyStraightAnimator(Vector3D start, Vector3D end, uint time, bool loop)
 {
     return (Animator)
         NativeElement.GetObject(SceneManager_CreateFlyStraightAnimator(_raw, start.ToUnmanaged(), end.ToUnmanaged(), time, loop),
                                 typeof(Animator));
 }
Esempio n. 6
0
 /// <summary>
 /// Creates an animator that will fly around a center
 /// </summary>
 /// <returns>An Animator</returns>
 /// <param name="center">Center</param>
 /// <param name="radius">Radius</param>
 /// <param name="speed">Speed</param>
 public Animator CreateFlyCircleAnimator(Vector3D center, float radius, float speed)
 {
     return (Animator)
         NativeElement.GetObject(SceneManager_CreateFlyCircleAnimator(_raw, center.ToUnmanaged(), radius, speed),
                                 typeof(Animator));
 }
Esempio n. 7
0
 /// <summary>
 /// Creates a simple animator for collision detection
 /// </summary>
 /// <returns>An Animator</returns>
 /// <param name="world">"World", meaning the triangle selector of the terrain/map</param>
 /// <param name="node">Node. Notice that this node MUST BE THE ONE THE ANIMATOR IS ADDED</param>
 /// <param name="ellipsoidRadius">Ellipsoid radius. Usually it's the difference between the node's skybox's max edge and its center</param>
 /// <param name="gravityPerSecond">How much gravity (don't try (0, -100000, 0), even on Jupiter you wouldn't have such gravity)</param>
 /// <param name="ellipsoidTranslation">By default (0, 0, 0), meaning the center of the scene node. You can modify it if needed</param>
 /// <param name="slidingValue">Sliding value, usually 0.0005f</param>
 public Animator CreateCollisionResponseAnimator(TriangleSelector world, SceneNode node, Vector3D ellipsoidRadius, Vector3D gravityPerSecond, Vector3D ellipsoidTranslation, float slidingValue)
 {
     return (Animator)
         NativeElement.GetObject(SceneManager_CreateCollisionResponseAnimator(_raw, world.Raw, node.Raw, ellipsoidRadius.ToUnmanaged(), gravityPerSecond.ToUnmanaged(), ellipsoidTranslation.ToUnmanaged(), slidingValue),
                                 typeof(Animator));
 }
Esempio n. 8
0
 public SceneNode AddTreeSceneNode(string XMLString, SceneNode parent, int id, Vector3D position,
     Vector3D rotation, Vector3D scale, Texture TreeTexture, Texture LeafTexture, Texture BillTexture)
 {
     IntPtr par = IntPtr.Zero;
     if (parent != null)
         par = parent.Raw;
     return (SceneNode)
         NativeElement.GetObject(SceneManager_AddTreeSceneNode(_raw, XMLString, par, id, position.ToUnmanaged(), rotation.ToUnmanaged(), scale.ToUnmanaged(), TreeTexture.Raw, LeafTexture.Raw, BillTexture.Raw, (int)MaterialType.TransparentAlphaChannel), typeof(SceneNode));
 }
Esempio n. 9
0
 public TerrainSceneNode AddTerrainSceneNodeFromRawData(float[,] data, int width, SceneNode parent, int id, Vector3D position, Vector3D rotation, Vector3D scale, Color vertexColor, int maxLOD, TerrainPatchSize patchSize, int smoothFactor)
 {
     IntPtr par = IntPtr.Zero;
     if (parent != null)
         par = parent.Raw;
     return (TerrainSceneNode)
         NativeElement.GetObject(SceneManager_AddTerrainSceneNodeFromRawData(_raw, data, data.Length, width, par, id, position.ToUnmanaged(), rotation.ToUnmanaged(), scale.ToUnmanaged(), vertexColor.ToUnmanaged(), maxLOD, patchSize, smoothFactor),
                                 typeof(TerrainSceneNode));
 }
Esempio n. 10
0
 /// <summary>
 /// Adds a heightmap-based terrain on the scene
 /// </summary>
 /// <returns>The terrain node</returns>
 /// <param name="heightMap">Relative or non-relative path to the heightmap.</param>
 /// <param name="parent">Parent from the terrain</param>
 /// <param name="id">ID (-1 for automatic assign.)</param>
 /// <param name="position">Position of the node</param>
 /// <param name="rotation">Rotation of the node</param>
 /// <param name="scale">Scale of the node</param>
 /// <param name="vertexColor">Default color of all the vertices used if no texture is assigned to the node.</param>
 /// <param name="maxLOD">Maximal LOD, set 5 or change it ONLY IF YOU KNOW WHAT YOU ARE DOING</param>
 /// <param name="patchSize">PatchSize, should be 17 and you mustn't change it unless you know what you're doing</param>
 public TerrainSceneNode AddTerrainSceneNode(string heightMap, SceneNode parent, int id, Vector3D position, Vector3D rotation, Vector3D scale, Color vertexColor, int maxLOD, TerrainPatchSize patchSize, int smoothFactor)
 {
     IntPtr par = IntPtr.Zero;
     if(parent != null)
         par = parent.Raw;
     return (TerrainSceneNode)
         NativeElement.GetObject(SceneManager_AddTerrainSceneNode(_raw, heightMap, par, id, position.ToUnmanaged(), rotation.ToUnmanaged(), scale.ToUnmanaged(), vertexColor.ToUnmanaged(), maxLOD, patchSize, smoothFactor),
                                 typeof(TerrainSceneNode));
 }
Esempio n. 11
0
 /// <summary>
 /// Adds a light scene node to the scene
 /// </summary>
 /// <returns>The light</returns>
 /// <param name="parent">Parent from the node</param>
 /// <param name="position">Initial position of the light</param>
 /// <param name="color">Floating color of the light</param>
 /// <param name="radius">Radius of the light</param>
 /// <param name="id">ID (-1 for automatic assignation)</param>
 public LightSceneNode AddLightSceneNode(SceneNode parent, Vector3D position, Colorf color, float radius, int id)
 {
     IntPtr par = IntPtr.Zero;
     if(parent != null)
         par = parent.Raw;
     return (LightSceneNode)
         NativeElement.GetObject(SceneManager_AddLightSceneNode(_raw, par, position.ToUnmanaged(), color.ToUnmanaged(), radius, id),
                                 typeof(LightSceneNode));
 }
Esempio n. 12
0
 public void Draw3DLine(Vector3D start, Vector3D end, Color color)
 {
     VideoDriver_Draw3DLine(_raw, start.ToUnmanaged(), end.ToUnmanaged(), color.ToUnmanaged());
 }
		public ParticleEmitter CreatePointEmitter(Vector3D direction, uint minPPS, uint maxPPS, Color minSC, Color maxSC, uint minLT, uint maxLT, int maxAngleDegrees)
		{
			return (ParticleEmitter)
				NativeElement.GetObject(Particle_CreatePointEmitter(_raw, direction.ToUnmanaged(), minPPS, maxPPS, minSC.ToUnmanaged(), maxSC.ToUnmanaged(), minLT, maxLT, maxAngleDegrees),
										typeof(ParticleEmitter));
		}
		public ParticleAffector CreateGravityAffector(Vector3D gravity, uint timeForceLost)
		{
			return (ParticleAffector)
				NativeElement.GetObject(Particle_CreateGravityAffector(_raw, gravity.ToUnmanaged(), timeForceLost),
										typeof(ParticleAffector));
		}
Esempio n. 15
0
 /// <summary>
 /// Scales the whole mesh. 
 /// </summary>
 /// <param name="mesh">Mesh on which the operation is performed. </param>
 /// <param name="scale">Scale factor. </param>
 public void ScaleMesh(Mesh mesh, Vector3D scale)
 {
     MeshManipulator_ScaleMesh(_raw, mesh.Raw, scale.ToUnmanaged());
 }