Exemplo n.º 1
0
        public override void Update(ApplicationTime time)
        {
            IOxRenderPluginAvatar avatar = (IOxRenderPluginAvatar)Ox.Service.Get(typeof(IOxRenderPluginAvatar));
            SceneNode sn = avatar.GetAvatarScneNode(Ox.DataStore.World.Agent.ID);
            if (sn == null || node == null)
                return;

            node.Target = sn.Position + Render.RenderData.AgentHeadPosition;

            Matrix4 rot = new Matrix4();
            //rot.RotationDegrees = Util.ToRotationRH(new float[] {
            //    0,
            //    0,
            //    (float)(Ox.DataStore.World.Agent.Head * NewMath.RADTODEG) + Util.ROTATION_AND_3DS_OFFSET.Z });

            Quaternion q0 = new Quaternion();
            Quaternion q1 = new Quaternion();
            q0.fromAngleAxis(Ox.DataStore.Camera.Angle[0] + NewMath.DEGTORAD * Util.ROTATION_AND_3DS_OFFSET.Z, new Vector3D(0, 0, 1));
            q1.fromAngleAxis(Ox.DataStore.Camera.Angle[1], new Vector3D(1, 0, 0));
            q1 = q1 * q0;
            Vector3D vec = new Vector3D(0, -Ox.DataStore.Camera.Distance, 0);
            node.Position = node.Target + q1.Matrix.RotateVect(ref vec);

            if (Ox.DataStore.Camera.Angle[1] < -MathHelper.PIOver2 || MathHelper.PIOver2 < Ox.DataStore.Camera.Angle[1])
                node.UpVector = new Vector3D(0, 0, -1);
            else
                node.UpVector = new Vector3D(0, 0, 1);

            base.Update(time);
        }
Exemplo n.º 2
0
        /// <summary>
		/// Returns an intersection with a 3d line.
		/// Please note that also points are returned as intersection, which
		/// are on the line, but not between the start and end point of the line.
		/// If you want the returned point be between start and end, please
		/// use getIntersectionWithLimitedLine().
        /// </summary>
        /// <param name="linePoint">Vector of the line to intersect with.</param>
        /// <param name="lineVect">Point of the line to intersect with.</param>
        /// <param name="outIntersection">Place to store the intersection point, if there is one.</param>
        /// <returns>Returns true if there was an intersection, false if there was not.</returns>
		bool GetIntersectionWithLine(Vector3D linePoint, Vector3D lineVect, out Vector3D outIntersection)
		{
			if (GetIntersectionOfPlaneWithLine(linePoint, lineVect, out outIntersection))
				return IsPointInside(outIntersection);

			return false;			
		}
Exemplo n.º 3
0
 public void Update(ref Vector3D target, float length)
 {
     this.target = target;
     this.length = length;
     this.span = count;
     this.count = 1;
 }
Exemplo n.º 4
0
		public Box3D(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax)
		{
			MinEdge = new Vector3D();
			MaxEdge = new Vector3D();
			MinEdge.Set(xMin, yMin, zMin);
			MaxEdge.Set(xMax, yMax, zMax);
		}
Exemplo n.º 5
0
Arquivo: Util.cs Projeto: yooyke/work
        public static float CalcTargetFromPosition(ref Vector3D target, ref Vector3D position, ref Vector3D? front)
        {
            Vector3D f = new Vector3D(1, 0, 0);
            if (front != null)
                f = (Vector3D)front;

            Vector3D tar = target - position;
            tar.Z = 0;
            if (tar.LengthSQ > 0)
                tar.Normalize();

            float dotAngle;
            dotAngle = f.DotProduct(tar);
            //Vector3D.Dot(ref front, ref tar, out dotAngle);

            Vector3D cross;
            cross = f.CrossProduct(tar);
            //Vector3D.Cross(ref front, ref tar, out cross);

            float angle = (float)Math.Acos(dotAngle);
            if (cross.Z < 0)
                angle = MathHelper.TwoPI - angle;

            return angle;
        }
        public GrassPatchSceneNode(SceneNode parent, SceneManager mgr, int id, bool createIfEmpty,
                                   Vector3D gridPos, string filepath, Texture heightMap, Texture colourMap,
                                   Texture grassMap, SceneNode terrain, WindGenerator wind)
            : base(parent, mgr, id)
        {
            DrawDistance = GRASS_PATCH_SIZE * 1.5f;
            MaxDensity = 800;
            TerrainHeightMap = heightMap;
            TerrainColourMap = colourMap;
            TerrainGrassMap = grassMap;
            Terrain = terrain;
            WindGen = wind;
            lastwindtime = 0;
            lastdrawcount = 0;
            redrawnextloop = true;
            MaxFPS = 0;
            _mgr = mgr;
            WindRes = 5;

            filename = string.Format("{0}/{1}.{2}.grass", filepath, gridpos.X, gridpos.Z);
            gridpos = gridPos;
            Position = new Vector3D(gridpos.X * GRASS_PATCH_SIZE, 0f,
                                    gridpos.Z * GRASS_PATCH_SIZE);

            ImageCount = new Dimension2D(4, 2);

            if (!Load())
                Create(createIfEmpty);
        }
Exemplo n.º 7
0
        public RotationAnimator(Vector3D p_RotationStart, Vector3D p_rotationEnd, uint p_durationMs)
        {
            m_rotationStart = p_RotationStart;
            m_rotationEnd = p_rotationEnd;
            m_durationMs = p_durationMs;

        }
Exemplo n.º 8
0
        // Thanks to whoever wrote this little function :)
        Vector3D getTargetAngle(Vector3D v, Vector3D r)
        {
            //v -current node position
            //r -target node position

            Vector3D angle = new Vector3D();
            float x, y, z;
            x = r.X - v.X;
            y = r.Y - v.Y;
            z = r.Z - v.Z;

            //angle in X-Z plane
            angle.Y = (float)Math.Atan2(x, z);
            angle.Y *= (float)(180 / NewMath.PI); //converting from rad to degrees

            //just making sure angle is somewhere between 0-360 degrees
            if (angle.Y < 0) angle.Y += 360;
            if (angle.Y >= 360) angle.Y -= 360;

            //angle in Y-Z plane while Z and X axes are already rotated around Y
            float z1 = (float)Math.Sqrt(x * x + z * z);

            angle.X = (float)Math.Atan2(z1, y);
            angle.X *= (float)(180 / NewMath.PI); //converting from rad to degrees
            angle.X -= 90;

            //just making sure angle is somewhere between 0-360 degrees
            if (angle.X < 0) angle.X += 360;
            if (angle.X >= 360) angle.X -= 360;

            return angle;
        }
Exemplo n.º 9
0
 public DirectionalLight(Viewer viewer, SceneNode _parentNode, string _name)
     : base(viewer, -1)
 {
     parentNode = _parentNode;
     rotation = new Vector3D();
     name = _name;
 }
Exemplo n.º 10
0
        public override void Collision()
        {
            if (node == null)
                return;

            if (Render.Scene.ActiveCamera == null)
                return;

            Vector3D intersection = new Vector3D();
            Triangle3D triangle = new Triangle3D();

            Position2D mouse = new Position2D((int)Ox.DataStore.Input.Position[0], (int)Ox.DataStore.Input.Position[1]);
            Line3D line = Render.Scene.CollisionManager.GetRayFromScreenCoordinates(mouse, Render.Scene.ActiveCamera);

            bool hit = Render.Scene.CollisionManager.GetCollisionPoint(
                        line,
                        node.TriangleSelector,
                        out intersection,
                        out triangle
                        );

            if (hit)
            {
                float[] point = Util.ToPositionArrayFromIrrlicht(ref intersection);
                float length = (float)intersection.DistanceFrom(line.Start);
                PointData.HitData data = new PointData.HitData(point[0], point[1], point[2], PointData.ObjectType.Ground, ClickActionType.None, length, string.Empty);
                Ox.DataStore.World.Point.Add(ref data);
            }
        }
Exemplo n.º 11
0
 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);
 }
Exemplo n.º 12
0
 //The function called each time we need to emit something.
 //It takes as argument "now" which represent the actual time,
 //"timeSinceLastCall" which represent... you know what
 //And an "out" argument (which means that IT MUST BE INITIALIZED INTO THIS FUNCTION),
 //"Particles" which represents every newly created particle.
 public void Emit(uint now, uint timeSinceLastCall, out Particle[] Particles)
 {
     //YOU ALWAYS MUST INITIALIZE Particles
     Particles = new Particle[0];
     if (now - lastParticleCreation < 100)
         return;
     Particles = new Particle[36];
     lastParticleCreation = now;
     //A little offset for the particles to go up and down.
     Vector3D offset = new Vector3D(0, NewMath.FCos(now) / 10f, 0);
     //For every particle in our array
     for (int i = 0; i < 36; i++)
     {
         double angle = (Math.PI * 10 * i) / 180.0;
         //We create the particle
         Particles[i] = new Particle();
         //We set the postion as null...
         Particles[i].Position = new Vector3D(0, 0, 0);
         //Particle.Vector represents the direction and speed of the particle.
         //As you may have seen, I love cosines and sinus and here again I used
         //it to create a "circle" effect
         Particles[i].Vector = new Vector3D((float)Math.Cos(angle) / 5f, 0, NewMath.FSin(angle) / 5f) + offset;
         //Start Vector is the same as the vector... It is useless here but serves for the affector.
         Particles[i].StartVector = Particles[0].Vector;
         //Start Time is now and End Time is now + 10 seconds
         Particles[i].StartTime = now;
         Particles[i].EndTime = now + 10000;
         //Color is White and again Start Color is the same... For the same reason as Start Vector !
         Particles[i].Color = Color.From(0, _rand.Next(255), _rand.Next(255), _rand.Next(255)); ;
         Particles[i].StartColor = Particles[0].Color;
     }
 }
Exemplo n.º 13
0
 public Vertex3D(Vector3D position, Vector3D normal, Color color, Vector2D tcoord)
     : this()
 {
     Position = position;
     Normal = normal;
     Color = color;
     TCoords = tcoord;
 }
Exemplo n.º 14
0
        public Vector2D Wind(Vector3D position, uint timeMs)
        {
            float seed = (timeMs + position.X*7*fcos(timeMs/120000.0f) + position.Z*7*fsin(timeMs/120000.0f))/ 1000.0f;
            float dir = 2*NewMath.PI*noise( seed / Regularity );
            float amp = Strength*fsin( seed );

            return new Vector2D( amp*fcos(dir), amp*fsin(dir) );
        }
Exemplo n.º 15
0
        public override void Collision()
        {
            if (Render.Scene.ActiveCamera == null)
                return;

            Position2D mouse = new Position2D((int)Ox.DataStore.Input.Position[0], (int)Ox.DataStore.Input.Position[1]);
            Line3D line = Render.Scene.CollisionManager.GetRayFromScreenCoordinates(mouse, Render.Scene.ActiveCamera);

            foreach (string key in list.Keys)
            {
                if (list[key].Node == null)
                    continue;

                AnimatedMeshSceneNode node = list[key].Node;

                Box3D box;
                Util.CreateBox3DFromNode(node, out box);

                // Check inside bounding box
                if (box.IntersectsWithLimitedLine(line))
                {
                    Vector3D intersection = new Vector3D();
                    Triangle3D triangle = new Triangle3D();

                    Mesh mesh = node.AnimatedMesh.GetMesh(node.CurrentFrame);
                    TriangleSelector ts = Render.Scene.CreateTriangleSelector(mesh, node);

                    bool hit = Render.Scene.CollisionManager.GetCollisionPoint(
                                line,
                                ts,
                                out intersection,
                                out triangle
                                );

                    if (!hit)
                        continue;

                    ObjectData data;
                    if (!Ox.DataStore.World.SimCollection.TryGetObject(key, out data))
                        continue;

                    if (!(data is AvatarData))
                        continue;

                    AvatarData avatarData = data as AvatarData;
                    float[] point = Util.ToPositionArrayFromIrrlicht(ref intersection);
                    float length = (float)intersection.DistanceFrom(line.Start);
                    PointData.HitData hitData = new PointData.HitData(
                        point[0], point[1], point[2],
                        (avatarData.Myself ? PointData.ObjectType.AvatarSelf  : PointData.ObjectType.Avatar),
                        ClickActionType.None,
                        length,
                        key
                        );
                    Ox.DataStore.World.Point.Add(ref hitData);
                }
            }
        }
Exemplo n.º 16
0
 public bool GetCollisionPoint(Line3D ray, TriangleSelector selector, out Vector3D collisionPoint, out Triangle3D collisionTriangle)
 {
     float[] colp = new float[3];
     float[] coltri = new float[9];
     bool toR = SceneCollisionManager_GetCollisionPoint(_raw, ray.ToUnmanaged(), selector.Raw, colp, coltri);
     collisionPoint = Vector3D.FromUnmanaged(colp);
     collisionTriangle = Triangle3D.FromUnmanaged(coltri);
     return toR;
 }
Exemplo n.º 17
0
 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);
 }
Exemplo n.º 18
0
        public bool GetIntersectionWithLine(Vector3D linePoint, Vector3D lineVector, out Vector3D outIntersection)
        {
            outIntersection = new Vector3D();

            float t2 = Normal.DotProduct(lineVector);

            if (t2 == 0)
                return (false);

            float t = -(Normal.DotProduct(linePoint) + D) / t2;
            outIntersection = linePoint + (lineVector * t);
            return (true);
        }
Exemplo n.º 19
0
        public Vector3D GetClosestPoint(Vector3D point)
        {
            Vector3D c = point - Start;
            Vector3D v = End - Start;
            float d = v.Length;
            v = v / d;
            float t = v.DotProduct(c);

            if (t < 0.0f) return Start;
            if (t > d) return End;

            v = v * t;
            return Start + v;
        }
Exemplo n.º 20
0
        public bool GetIntersectionWithSphere(Vector3D sorigin, float sradius, out double outdistance)
        {
            outdistance = 0.0;
            Vector3D q = sorigin - Start;
            double c = q.Length;
            Vector3D vv = Vector;
            vv.Normalize();
            double v = q.DotProduct(vv);
            double d = sradius * sradius - (c * c - v * v);

            if (d < 0.0)
                return false;

            outdistance = v - Math.Sqrt(d);
            return true;
        }
        public LensflareSceneNode(SceneNode parent, SceneManager mgr, int id, Vector3D position)
            : base(parent, mgr, id)
        {
            draw_flare = true;
            ign_geom = false;
            smgr = mgr;

            indices = new ushort[6];
            indices[0] = 0;
            indices[1] = 2;
            indices[2] = 1;
            indices[3] = 0;
            indices[4] = 3;
            indices[5] = 2;

            vertices = new Vertex3D[4];
            for (int i = 0; i < 4; i++)
            {
                vertices[i] = new Vertex3D();
            }
            vertices[0].TCoords = Vector2D.From(0.0f, 1.0f);
            vertices[0].Color = Color.White;
            vertices[1].TCoords = Vector2D.From(0.0f, 0.0f);
            vertices[1].Color = Color.White;
            vertices[2].TCoords = Vector2D.From(1.0f, 0.0f);
            vertices[2].Color = Color.White;
            vertices[3].TCoords = Vector2D.From(1.0f, 1.0f);
            vertices[3].Color = Color.White;

            material = new Material();

            material.Lighting = false;

            material.MaterialType = MaterialType.TransparentAddColor;

            material.ZBuffer = 0;

            material.ZWriteEnable = false;

            bbox = new Box3D();

            bbox.MinEdge = Vector3D.From(-2, -2, -2);

            bbox.MaxEdge = Vector3D.From(2, 2, 2);

        }
Exemplo n.º 22
0
        /// <summary>
        /// Calculates the intersection between a 3d line and 
        /// the plane the triangle is on.
        /// </summary>
        /// <param name="linePoint">Vector of the line to intersect with</param>
        /// <param name="lineVect">Point of the line to intersect with.</param>
        /// <param name="intersection">Place to store the intersection point, if there is one.</param>
        /// <returns>Returns true if there was an intersection, false if there was not.</returns>
        public bool GetIntersectionOfPlaneWithLine(Vector3D linePoint,
            Vector3D lineVect,
            out Vector3D intersection)
        {
            Vector3D normal = Normal.Normalize();

            //float t2 = Normal.DotProduct(lineVect);

            float t2 = normal.DotProduct(lineVect); //corrected line

            intersection = new Vector3D();
            if (NewMath.IsZero(t2))
                return false;
            float d = PointA.DotProduct(normal);
            //float t = -(Normal.DotProduct(linePoint) - d) / t2;

            float t = -(normal.DotProduct(linePoint) - d) / t2; //corrected line
            intersection = linePoint + (lineVect * t);
            return true;
        }
Exemplo n.º 23
0
        public void UpdateDirection()
        {
            DateTime now = Reference.Viewer.WorldTime;
            TimeSpan span = new DateTime(2009, 1, 1, now.Hour, now.Minute, now.Second) - DateTime.Parse("2009-01-01 07:00:00");
            int sec = span.Hours * 3600 + span.Minutes * 60 + span.Seconds;
            int end = 10 * 3600 + 0 * 60 + 0;
            float amount = (float)sec / end;
            amount = Util.Clamp<float>(amount, 0, 1);
            angle = OpenViewer.Util.Lerp(sunriseAngle, sunsetAngle, amount);

            qx.fromAngleAxis((float)(Math.PI / 1.25f), new Vector3D(1, 0, 0));
            qy.fromAngleAxis(angle, new Vector3D(0, 1, 0));
            qy = qx * qy;
            Vector3D rot;
            qy.toEuler(out rot);
            rotation = new Vector3D(rot.X, rot.Y, rot.Z) * OpenMetaverse.Utils.RAD_TO_DEG;
        }
Exemplo n.º 24
0
        public override bool OnMouseEvent(Event p_event)
        {
            if (p_event.MouseInputEvent == MouseInputEvent.MouseWheel)
            {
                CameraController.MouseWheelAction(p_event.MouseWheelDelta);
            }
            if (p_event.MouseInputEvent == MouseInputEvent.LMouseLeftUp)
            {
                if (m_ctrlPressed)
                {
                    CameraController.ApplyMouseOffsets();
                }
                m_leftMousePressed = false;
            }
            if (p_event.MouseInputEvent == MouseInputEvent.LMousePressedDown)
            {

                m_leftMousePressed = true;
                if (m_ctrlPressed)
                {
                    CameraController.SwitchMode(ECameraMode.Build);
                    // Pick!

                    CameraController.ResetMouseOffsets();
                    Vector3D[] projection = CameraController.ProjectRayPoints(p_event.MousePosition, WindowWidth/2, WindowHeight/2, WindowAspect);
                    Line3D projectedray = new Line3D(projection[0], projection[1]);

                    Vector3D collisionpoint = new Vector3D(0, 0, 0);
                    Triangle3D tri = new Triangle3D(0, 0, 0, 0, 0, 0, 0, 0, 0);

                    // Check if we have a node under the mouse
                    SceneNode node = SceneGraph.TrianglePicker.GetSceneNodeFromRay(projectedray, 0x0128, true, CameraController.CameraNode.Position); //smgr.CollisionManager.GetSceneNodeFromScreenCoordinates(new Position2D(p_event.MousePosition.X, p_event.MousePosition.Y), 0, false);
                    if (node == null)
                    {
                        if (SceneGraph.TriangleSelector != null)
                        {
                            // Collide test against the terrain
                            if (Renderer.SceneManager.CollisionManager.GetCollisionPoint(projectedray, SceneGraph.TriangleSelector, out collisionpoint, out tri))
                            {
                                if (CameraController.CameraMode == ECameraMode.Build)
                                {
                                    CameraController.SetTarget(collisionpoint);
                                    CameraController.TargetNode = null;
                                }
                            }
                        }
                    }
                    else
                    {
                        // Sometimes the terrain picker returns weird values.
                        // If it's weird try the general 'everything' triangle picker.
                        m_log.WarnFormat("[PICK]: Picked <{0},{1},{2}>", node.Position.X, node.Position.Y, node.Position.Z);
                        if (node.Position.X == 0 && node.Position.Z == 0)
                        {
                            if (SceneGraph.TriangleSelector != null)
                            {
                                if (Renderer.SceneManager.CollisionManager.GetCollisionPoint(projectedray, SceneGraph.TriangleSelector, out collisionpoint, out tri))
                                {
                                    if (CameraController.CameraMode == ECameraMode.Build)
                                    {
                                        CameraController.SetTarget(collisionpoint);
                                        CameraController.TargetNode = null;
                                    }
                                }
                            }
                        }
                        else
                        {
                            // Target the node
                            if (CameraController.CameraMode == ECameraMode.Build)
                            {
                                CameraController.SetTarget(node.Position);
                                CameraController.TargetNode = node;
                            }
                        }
                    }
                }
            }
            if (p_event.MouseInputEvent == MouseInputEvent.RMouseLeftUp)
            {
                m_rightMousePressed = false;
            }
            if (p_event.MouseInputEvent == MouseInputEvent.RMousePressedDown)
            {
                m_rightMousePressed = true;
            }

            if (p_event.MouseInputEvent == MouseInputEvent.MouseMoved)
            {
                if (m_leftMousePressed && m_ctrlPressed)
                {
                    int deltaX = p_event.MousePosition.X - m_oldMouseX;
                    int deltaY = p_event.MousePosition.Y - m_oldMouseY;

                    CameraController.SetDeltaFromMouse(deltaX, deltaY);
                }

                if (m_rightMousePressed)
                {

                    int deltaX = p_event.MousePosition.X - m_oldMouseX;
                    int deltaY = p_event.MousePosition.Y - m_oldMouseY;

                    CameraController.SetRotationDelta(deltaX, deltaY);
                }

                m_oldMouseX = p_event.MousePosition.X;
                m_oldMouseY = p_event.MousePosition.Y;
            }
            return false;
        }
Exemplo n.º 25
0
        private bool Play(string _fileName, bool _loop, bool _is3d, Vector3D _position)
        {
            bool flag = false;

            if (engine == null)
            {
                Reference.Log.Debug("Play: Engine NULL");
                return flag;
            }

            if (System.IO.File.Exists(_fileName))
            {
                if (_is3d)
                {
                    engine.Play3D(_fileName, _position.X, _position.Y, _position.Z, _loop);
                }
                else
                {
                    engine.Play2D(_fileName, _loop);
                }

                Reference.Log.Debug("Play sound" + _fileName);

                flag = true;
            }

            return flag;
        }
Exemplo n.º 26
0
        private bool Play(UUID _uuid, bool _loop, bool _is3d, Vector3D _position)
        {
            bool flag = false;

            if (soundList.Contains(_uuid))
            {
                string path = workDirectory + "/" + _uuid.ToString() + Const.SoundExtension;

                flag = Play(path, _loop, _is3d, _position);
            }

            return flag;
        }
Exemplo n.º 27
0
 public bool PlaySE(UUID _uuid, Vector3D _position)
 {
     return Play3D(_uuid, true, _position);
 }
Exemplo n.º 28
0
 public bool Play3D(UUID _uuid, bool _loop, Vector3D _position)
 {
     return Play(_uuid, _loop, true, _position);
 }
 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));
 }
Exemplo n.º 30
0
        public Vector3D TransformVect(ref Vector3D vect)
        {
            float[] vector = { 0, 0, 0 };

            vector[0] = vect.X * M[0] + vect.Y * M[4] + vect.Z * M[8] + M[12];
            vector[1] = vect.X * M[1] + vect.Y * M[5] + vect.Z * M[9] + M[13];
            vector[2] = vect.X * M[2] + vect.Y * M[6] + vect.Z * M[10] + M[14];

            vect.X = vector[0];
            vect.Y = vector[1];
            vect.Z = vector[2];
            return vect;
        }