当前位置: 首页>>代码示例>>C#>>正文


C# IrrlichtNETCP.Vector3D类代码示例

本文整理汇总了C#中IrrlichtNETCP.Vector3D的典型用法代码示例。如果您正苦于以下问题:C# Vector3D类的具体用法?C# Vector3D怎么用?C# Vector3D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Vector3D类属于IrrlichtNETCP命名空间,在下文中一共展示了Vector3D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

        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);
        }
开发者ID:yooyke,项目名称:work,代码行数:30,代码来源:Camera.cs

示例2: GetIntersectionWithLine

        /// <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;			
		}
开发者ID:RealBadAngel,项目名称:irrlicht.netcp,代码行数:18,代码来源:Triangle3D.cs

示例3: Update

 public void Update(ref Vector3D target, float length)
 {
     this.target = target;
     this.length = length;
     this.span = count;
     this.count = 1;
 }
开发者ID:yooyke,项目名称:work,代码行数:7,代码来源:AvatarMoveData.cs

示例4: Box3D

		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);
		}
开发者ID:RealBadAngel,项目名称:irrlicht.netcp,代码行数:7,代码来源:Box3D.cs

示例5: CalcTargetFromPosition

        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;
        }
开发者ID:yooyke,项目名称:work,代码行数:25,代码来源:Util.cs

示例6: GrassPatchSceneNode

        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);
        }
开发者ID:RealBadAngel,项目名称:irrlicht.netcp,代码行数:29,代码来源:GrassPatchSceneNode.cs

示例7: RotationAnimator

        public RotationAnimator(Vector3D p_RotationStart, Vector3D p_rotationEnd, uint p_durationMs)
        {
            m_rotationStart = p_RotationStart;
            m_rotationEnd = p_rotationEnd;
            m_durationMs = p_durationMs;

        }
开发者ID:RealBadAngel,项目名称:irrlicht.netcp,代码行数:7,代码来源:RotateAnimator.cs

示例8: getTargetAngle

        // 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;
        }
开发者ID:RealBadAngel,项目名称:irrlicht.netcp,代码行数:33,代码来源:BeamNode.cs

示例9: DirectionalLight

 public DirectionalLight(Viewer viewer, SceneNode _parentNode, string _name)
     : base(viewer, -1)
 {
     parentNode = _parentNode;
     rotation = new Vector3D();
     name = _name;
 }
开发者ID:caocao,项目名称:3di-viewer-rei,代码行数:7,代码来源:DirectionalLight.cs

示例10: Collision

        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);
            }
        }
开发者ID:yooyke,项目名称:work,代码行数:29,代码来源:TilePicker.cs

示例11: GetScreenCoordinatesFrom3DPosition

 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);
 }
开发者ID:Paulus,项目名称:irrlichtnetcp,代码行数:7,代码来源:SceneCollisionManager.cs

示例12: Emit

 //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;
     }
 }
开发者ID:Paulus,项目名称:irrlichtnetcp,代码行数:37,代码来源:Program.cs

示例13: Vertex3D

 public Vertex3D(Vector3D position, Vector3D normal, Color color, Vector2D tcoord)
     : this()
 {
     Position = position;
     Normal = normal;
     Color = color;
     TCoords = tcoord;
 }
开发者ID:Paulus,项目名称:irrlichtnetcp,代码行数:8,代码来源:Vertices.cs

示例14: Wind

        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) );
        }
开发者ID:Paulus,项目名称:irrlichtnetcp,代码行数:8,代码来源:WindGenerator.cs

示例15: Collision

        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);
                }
            }
        }
开发者ID:yooyke,项目名称:work,代码行数:58,代码来源:Avatar.cs


注:本文中的IrrlichtNETCP.Vector3D类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。