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


C# Camera.IsForShadowMapGeneration方法代码示例

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


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

示例1: OnRender

        /// <summary>Overridden from <see cref="Engine.MapSystem.MapObject.OnRender(Camera)"/>.</summary>
        protected override void OnRender( Camera camera )
        {
            base.OnRender( camera );

            //no update in cubemap generation mode
            if( Map.Instance.CubemapGenerationMode )
                return;

            bool playerIntellectFPSCamera = false;
            {
                PlayerIntellect playerIntellect = Intellect as PlayerIntellect;
                if( playerIntellect != null )
                    playerIntellectFPSCamera = playerIntellect.FPSCamera;
            }
            bool fpsCamera = playerIntellectFPSCamera && RendererWorld.Instance.DefaultCamera == camera;

            if( activeWeapon != null && GameMap.Instance.GameType != GameMap.GameTypes.TPSArcade )
            {
                //FPS mesh material
                activeWeapon.FPSMeshMaterialNameEnabled =
                    fpsCamera && !camera.IsForShadowMapGeneration();

                //update weapon vertical orientation
                if( activeWeaponAttachedObject.MapObject is Gun )
                {
                    //for guns
                    if( fpsCamera )
                    {
                        Vec3 p = camera.Position + camera.Rotation * Type.WeaponFPSAttachPosition;
                        Quat r = camera.Rotation;
                        Vec3 s = new Vec3( 1, 1, 1 );
                        activeWeaponAttachedObject.MapObject.SetTransform( p, r, s );
                        activeWeaponAttachedObject.MapObject.SetOldTransform( p, r, s );

                        //Vec3 diff = playerIntellect.LookDirection.GetVector();
                        //float dirV = -MathFunctions.ATan( diff.Z, diff.ToVec2().Length() );
                        //float halfDirV = dirV * .5f;
                        //Quat rot = new Quat( 0, MathFunctions.Sin( halfDirV ), 0,
                        //   MathFunctions.Cos( halfDirV ) );
                        //activeWeaponAttachedObject.RotationOffset = rot;
                        //activeWeaponAttachedObject.PositionOffset =
                        //   Type.FPSCameraOffset + Type.WeaponFPSAttachPosition * rot;
                    }
                    else
                    {
                        float dirV;

                        if( EntitySystemWorld.Instance.IsClientOnly() )
                        {
                            //client specific
                            dirV = client_weaponVerticalAngle;
                        }
                        else
                        {
                            Vec3 diff = TurnToPosition - Position;
                            dirV = -MathFunctions.ATan( diff.Z, diff.ToVec2().Length() );
                        }

                        float halfDirV = dirV * .5f;
                        Quat rot = new Quat( 0, MathFunctions.Sin( halfDirV ), 0,
                            MathFunctions.Cos( halfDirV ) );

                        activeWeaponAttachedObject.RotationOffset = rot;
                        activeWeaponAttachedObject.PositionOffset = Type.WeaponAttachPosition;
                    }
                }
                else
                {
                    //for melee weapons
                    activeWeaponAttachedObject.RotationOffset = Quat.Identity;
                    activeWeaponAttachedObject.PositionOffset = Vec3.Zero;
                }

                //no cast shadows from active weapon in the FPS mode
                foreach( MapObjectAttachedObject weaponAttachedObject in activeWeapon.AttachedObjects )
                {
                    MapObjectAttachedMesh weaponAttachedMesh = weaponAttachedObject as MapObjectAttachedMesh;
                    if( weaponAttachedMesh != null && weaponAttachedMesh.MeshObject != null )
                    {
                        if( weaponAttachedMesh.RemainingTime == 0 )
                            weaponAttachedMesh.MeshObject.CastShadows = !fpsCamera;
                    }
                }
            }

            //only weapon visible in the FPS mode
            foreach( MapObjectAttachedObject attachedObject in AttachedObjects )
                attachedObject.Visible = !fpsCamera || attachedObject == activeWeaponAttachedObject;

            //no cast shadows in the FPS mode
            if( camera.IsForShadowMapGeneration() && playerIntellectFPSCamera )
            {
                foreach( MapObjectAttachedObject attachedObject in AttachedObjects )
                    attachedObject.Visible = false;
            }
        }
开发者ID:DarrenHassan,项目名称:GDM4242-GroupD,代码行数:97,代码来源:PlayerCharacter.cs

示例2: OnSceneManagementGetObjectsForCamera

        public override void OnSceneManagementGetObjectsForCamera( Camera camera,
			List<SceneNode> outSceneNodes, List<StaticMeshObject> outStaticMeshObjects, List<RenderLight> outLights )
        {
            RenderLight shadowGenerationLight = null;
            if( camera.IsForShadowMapGeneration() )
                shadowGenerationLight = camera.GetShadowMapGenerationLight();

            if( shadowGenerationLight != null )
            {
                //shadow generation

                int directionalLightPSSMTextureIndex = 0;
                Vec3 pointLightFaceDirection = Vec3.Zero;
                if( shadowGenerationLight.Type == RenderLightType.Directional && SceneManager.Instance.IsShadowTechniquePSSM() )
                    directionalLightPSSMTextureIndex = camera.GetDirectionalLightPSSMTextureIndex();
                if( shadowGenerationLight.Type == RenderLightType.Point && SceneManager.Instance.IsShadowTechniqueShadowmapBased() )
                    pointLightFaceDirection = camera.Direction;

                GetShadowCastersForLight( SceneManager.Instance.CurrentUpdatingCamera, shadowGenerationLight,
                    directionalLightPSSMTextureIndex, pointLightFaceDirection, outSceneNodes, outStaticMeshObjects );
            }
            else
            {
                //usual camera

                GetObjectsForUsualCamera( camera, outSceneNodes, outStaticMeshObjects, outLights );
            }

            //add objects never culled by the frustum
            if( SceneManager.Instance.OverrideVisibleObjects == null && Map.Instance != null )
            {
                Map.Instance.Walk_AddObjectsWithDisabled_AllowSceneManagementCulling_Property( shadowGenerationLight != null,
                    outSceneNodes, outStaticMeshObjects, outLights );
            }
        }
开发者ID:whztt07,项目名称:SDK,代码行数:35,代码来源:RenderingLowLevelMethodsImpl.cs

示例3: OnRender

        /// <summary>Overridden from <see cref="Engine.MapSystem.MapObject.OnRender(Camera)"/>.</summary>
        protected override void OnRender(Camera camera)
        {
            base.OnRender(camera);

            //no update in cubemap generation mode
            if (Map.Instance.CubemapGenerationMode)
                return;

            bool playerIntellectFPSCamera = false;
            {
                if (Intellect != null && Intellect == PlayerIntellect.Instance)
                    playerIntellectFPSCamera = PlayerIntellect.Instance.FPSCamera;
            }
            bool fpsCamera = playerIntellectFPSCamera && RendererWorld.Instance.DefaultCamera == camera;

            if (activeWeapon != null && GameMap.Instance.GameType != GameMap.GameTypes.TPSArcade)
            {
                //FPS mesh material
                activeWeapon.FPSMeshMaterialNameEnabled =
                    fpsCamera && !camera.IsForShadowMapGeneration();

                //update weapon vertical orientation
                if (activeWeaponAttachedObject.MapObject is Gun)
                {
                    //for guns
                    if (fpsCamera)
                    {
                        Vec3 diff = PlayerIntellect.Instance.LookDirection.GetVector();

                        float dirV = -MathFunctions.ATan(diff.Z, diff.ToVec2().Length());
                        float halfDirV = dirV * .5f;
                        Quat rot = new Quat(0, MathFunctions.Sin(halfDirV), 0,
                            MathFunctions.Cos(halfDirV));

                        activeWeaponAttachedObject.RotationOffset = rot;
                        activeWeaponAttachedObject.PositionOffset =
                            Type.FPSCameraOffset + Type.WeaponFPSAttachPosition * rot;
                    }
                    else
                    {
                        Vec3 diff = SeePosition - Position;

                        float dirV = -MathFunctions.ATan(diff.Z, diff.ToVec2().Length());
                        float halfDirV = dirV * .5f;
                        Quat rot = new Quat(0, MathFunctions.Sin(halfDirV), 0,
                            MathFunctions.Cos(halfDirV));

                        activeWeaponAttachedObject.RotationOffset = rot;
                        activeWeaponAttachedObject.PositionOffset = Type.WeaponAttachPosition;
                    }
                }
                else
                {
                    //for melee weapons
                    activeWeaponAttachedObject.RotationOffset = Quat.Identity;
                    activeWeaponAttachedObject.PositionOffset = Vec3.Zero;
                }

                //Update transform of the attached weapon.
                //That there was no twitching because of interpolation
                {
                    Vec3 p;
                    Quat r;
                    Vec3 s;
                    activeWeaponAttachedObject.GetGlobalTransform(out p, out r, out s);
                    activeWeaponAttachedObject.MapObject.SetTransform(p, r, s);
                    activeWeaponAttachedObject.GetGlobalOldTransform(out p, out r, out s);
                    activeWeaponAttachedObject.MapObject.SetOldTransform(p, r, s);
                }

                //no cast shadows from active weapon in the FPS mode
                foreach (MapObjectAttachedObject weaponAttachedObject in activeWeapon.AttachedObjects)
                {
                    MapObjectAttachedMesh weaponAttachedMesh = weaponAttachedObject as MapObjectAttachedMesh;
                    if (weaponAttachedMesh != null && weaponAttachedMesh.MeshObject != null)
                    {
                        if (weaponAttachedMesh.RemainingTime == 0)
                            weaponAttachedMesh.MeshObject.CastShadows = !fpsCamera;
                    }
                }
            }

            //only weapon visible in the FPS mode
            foreach (MapObjectAttachedObject attachedObject in AttachedObjects)
                attachedObject.Visible = !fpsCamera || attachedObject == activeWeaponAttachedObject;

            //no cast shadows in the FPS mode
            if (camera.IsForShadowMapGeneration() && playerIntellectFPSCamera)
            {
                foreach (MapObjectAttachedObject attachedObject in AttachedObjects)
                    attachedObject.Visible = false;
            }
        }
开发者ID:huytd,项目名称:fosproject,代码行数:94,代码来源:PlayerCharacter.cs

示例4: OnRender

		protected override void OnRender( Camera camera )
		{
			base.OnRender( camera );

			if( !camera.IsForShadowMapGeneration() && MapEditorInterface.Instance != null &&
				MapEditorInterface.Instance.IsEntitySelected( this ) )
			{
				//render volume
				if( physicsHeight != 0 && Type.PhysicsDensity != 0 )
				{
					Bounds bounds = new Bounds( Position - new Vec3( 0, 0, physicsHeight / 2 ) );
					bounds.Expand( new Vec3( Size.X, Size.Y, physicsHeight ) / 2 );

					camera.DebugGeometry.Color = new ColorValue( 0, 0, 1 );
					camera.DebugGeometry.AddBounds( bounds );
				}
			}
		}
开发者ID:whztt07,项目名称:NeoAxisCommunity,代码行数:18,代码来源:WaterPlane.cs


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