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


C# Vec3.Equals方法代码示例

本文整理汇总了C#中Vec3.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Vec3.Equals方法的具体用法?C# Vec3.Equals怎么用?C# Vec3.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vec3的用法示例。


在下文中一共展示了Vec3.Equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WalkPointLightShadowGeneration

        static void WalkPointLightShadowGeneration( Camera mainCamera, RenderLight light,
			Vec3 pointLightFaceDirection, List<SceneNode> outSceneNodes,
			List<StaticMeshObject> outStaticMeshObjects )
        {
            Sphere lightSphere = new Sphere( light.Position, light.AttenuationFar );

            if( !pointLightFaceDirection.Equals( Vec3.Zero, .001f ) )
            {
                //shadowmap. 6 render targets.

                int[] sceneGraphIndexes;
                if( SceneManager.Instance.OverrideVisibleObjects != null )
                {
                    sceneGraphIndexes = GetOverrideVisibleObjectsSceneGraphIndexes();
                }
                else
                {
                    Plane[] clipPlanes;
                    {
                        //add point light clip planes
                        Plane[] array1 = GetClipPlanesForPointLightShadowGeneration( mainCamera, light, pointLightFaceDirection );
                        //add main frustum clip planes and light position
                        Plane[] array2 = GetClipPlanesOfConvexHullAroundMainCameraAndLightPosition( mainCamera, light );

                        clipPlanes = new Plane[ array1.Length + array2.Length ];
                        Array.Copy( array1, 0, clipPlanes, 0, array1.Length );
                        Array.Copy( array2, 0, clipPlanes, array1.Length, array2.Length );
                    }
                    Bounds clipBounds = lightSphere.ToBounds();

                    uint groupMask = 0;
                    if( outSceneNodes != null )
                        groupMask |= 1 << (int)SceneManager.SceneGraphGroups.SceneNode;
                    if( outStaticMeshObjects != null )
                        groupMask |= 1 << (int)SceneManager.SceneGraphGroups.StaticMeshObject;

                    sceneGraphIndexes = SceneManager.Instance.SceneGraph.GetObjects( clipPlanes, clipBounds, groupMask );
                }

                foreach( int sceneGraphIndex in sceneGraphIndexes )
                {
                    SceneManager.SceneGraphObjectData data = SceneManager.Instance.SceneGraphObjects[ sceneGraphIndex ];

                    //SceneNode
                    SceneNode sceneNode = data.SceneNode;
                    if( sceneNode != null && sceneNode.Visible && sceneNode.IsContainsObjectWithCastsShadowsEnabled() )
                    {
                        Bounds sceneNodeBounds = sceneNode.GetWorldBounds();
                        //clip by sphere
                        if( lightSphere.IsIntersectsBounds( sceneNodeBounds ) )
                        {
                            //clip volumes
                            if( !IsTotalClipVolumesContainsBounds( sceneNodeBounds ) )
                                outSceneNodes.Add( sceneNode );
                        }
                    }

                    //StaticMeshObject
                    StaticMeshObject staticMeshObject = data.StaticMeshObject;
                    if( staticMeshObject != null && staticMeshObject.Visible && staticMeshObject.CastShadows )
                    {
                        //clip by sphere
                        if( lightSphere.IsIntersectsBounds( staticMeshObject.Bounds ) )
                        {
                            //clip volumes
                            if( !IsTotalClipVolumesContainsBounds( staticMeshObject.Bounds ) )
                                outStaticMeshObjects.Add( staticMeshObject );
                        }
                    }
                }
            }
            else
            {
                //stencil shadows.
                //check by sphere volume.

                int[] sceneGraphIndexes;
                if( SceneManager.Instance.OverrideVisibleObjects != null )
                {
                    sceneGraphIndexes = GetOverrideVisibleObjectsSceneGraphIndexes();
                }
                else
                {
                    Plane[] clipPlanes;
                    {
                        //add main frustum clip planes and light position
                        Plane[] array1 = GetClipPlanesOfConvexHullAroundMainCameraAndLightPosition( mainCamera, light );

                        clipPlanes = new Plane[ 6 + array1.Length ];

                        //add 6 light clip planes.
                        clipPlanes[ 0 ] = new Plane( Vec3.XAxis, lightSphere.Origin.X + lightSphere.Radius );
                        clipPlanes[ 1 ] = new Plane( -Vec3.XAxis, -( lightSphere.Origin.X - lightSphere.Radius ) );
                        clipPlanes[ 2 ] = new Plane( Vec3.YAxis, lightSphere.Origin.Y + lightSphere.Radius );
                        clipPlanes[ 3 ] = new Plane( -Vec3.YAxis, -( lightSphere.Origin.Y - lightSphere.Radius ) );
                        clipPlanes[ 4 ] = new Plane( Vec3.ZAxis, lightSphere.Origin.Z + lightSphere.Radius );
                        clipPlanes[ 5 ] = new Plane( -Vec3.ZAxis, -( lightSphere.Origin.Z - lightSphere.Radius ) );

                        Array.Copy( array1, 0, clipPlanes, 6, array1.Length );
                    }
//.........这里部分代码省略.........
开发者ID:whztt07,项目名称:SDK,代码行数:101,代码来源:RenderingLowLevelMethodsImpl.cs

示例2: CalculateRelativeVelocity

        private void CalculateRelativeVelocity()
        {
            if (EntitySystemWorld.Instance.IsServer() || EntitySystemWorld.Instance.IsSingle())
            {
                //server or single mode
                //if (Damager_Ball_Player.AngularVelocity.LengthSqr() < .3f)
                groundRelativeVelocity = Damager_Ball_Player.LinearVelocity; // -Damager_Ball_Player.LastStepLinearVelocity;
                //else
                //    groundRelativeVelocity = Vec3.Zero;

                if (EntitySystemWorld.Instance.IsServer())
                {
                    if (!groundRelativeVelocity.Equals(server_sentGroundRelativeVelocity, .1f))
                    {
                        Server_SendGroundRelativeVelocityToClients(
                            EntitySystemWorld.Instance.RemoteEntityWorlds, groundRelativeVelocity);
                        server_sentGroundRelativeVelocity = groundRelativeVelocity;
                    }
                }
            }
            else
            {
                //client

                //groundRelativeVelocity is updated from server,
                //because body velocities are not synchronized via network.
            }
        }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:28,代码来源:DamagerBall.cs

示例3: OnDestinationReached

        public static float SPEED = 60;//25; //approximated movement speed with 25% move speed bonus

        public void OnDestinationReached(DestType type, Vec3 dest)
        {
            if (dest.Equals(m_Destination))
                m_Destination = Vec3.Empty;
        }
开发者ID:InjectionDev,项目名称:Dev.D3,代码行数:7,代码来源:TestBot.cs


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