• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IrrlichtNETCP.Vector3D类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: GetCollisionPoint

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


示例17: GetCollisionResultPoint

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


示例18: GetIntersectionWithLine

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


示例19: GetClosestPoint

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


示例20: GetIntersectionWithSphere

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TimePeriod.TimePeriodCollection类代码示例发布时间:2022-05-26
下一篇:
C# IrrlichtNETCP.SceneNode类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap