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

C# Engine.Camera类代码示例

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

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



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

示例1: OnEditorSelectionDebugRender

 protected override void OnEditorSelectionDebugRender( Camera camera, bool bigBorder,
     bool simpleGeometry)
 {
     Box box = GetBox();
     box.Expand( bigBorder ? .2f : .1f );
     camera.DebugGeometry.AddBox( box );
 }
开发者ID:Eneth,项目名称:GAO,代码行数:7,代码来源:DynamicCollision.cs


示例2: OnRender

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

            if (EntitySystemWorld.Instance.WorldSimulationType == WorldSimulationTypes.Editor ||
                EngineDebugSettings.DrawGameSpecificDebugGeometry)
            {
                camera.DebugGeometry.Color = new ColorValue(0, 0, 1);
                camera.DebugGeometry.AddBox(GetBox());
            }

            if (EntitySystemWorld.Instance.WorldSimulationType == WorldSimulationTypes.Editor ||
                EngineDebugSettings.DrawGameSpecificDebugGeometry)
            {
                Vec3 direction = -Rotation.GetForward();

                Vec3 point0 = Position + Rotation * new Vec3(0, -Scale.Y / 2, -Scale.Z / 2);
                Vec3 point1 = Position + Rotation * new Vec3(0, Scale.Y / 2, -Scale.Z / 2);
                Vec3 point2 = Position + Rotation * new Vec3(0, -Scale.Y / 2, Scale.Z / 2);
                Vec3 point3 = Position + Rotation * new Vec3(0, Scale.Y / 2, Scale.Z / 2);

                camera.DebugGeometry.Color = new ColorValue(0, 1, 0);
                camera.DebugGeometry.AddArrow(point0, point0 + direction);
                camera.DebugGeometry.AddArrow(point1, point1 + direction);
                camera.DebugGeometry.AddArrow(point2, point2 + direction);
                camera.DebugGeometry.AddArrow(point3, point3 + direction);
            }

            if (EngineDebugSettings.DrawGameSpecificDebugGeometry)
            {
                Line line = GetClimbingLine();
                camera.DebugGeometry.Color = new ColorValue(0, 1, 0);
                camera.DebugGeometry.AddLine(line);
            }
        }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:35,代码来源:Ladder.cs


示例3: renderTargetUserControl1_Render

        void renderTargetUserControl1_Render( RenderTargetUserControl sender, Camera camera )
        {
            //update camera
            if( Map.Instance != null )
            {
                Vec3 position;
                Vec3 forward;
                Degree fov;

                //find "MapCamera_1"
                MapCamera mapCamera = Entities.Instance.GetByName( "MapCamera_1" ) as MapCamera;
                if( mapCamera != null )
                {
                    position = mapCamera.Position;
                    forward = mapCamera.Rotation * new Vec3( 1, 0, 0 );
                    fov = mapCamera.Fov;
                }
                else
                {
                    position = Map.Instance.EditorCameraPosition;
                    forward = Map.Instance.EditorCameraDirection.GetVector();
                    fov = Map.Instance.Fov;
                }

                if( fov == 0 )
                    fov = Map.Instance.Fov;

                renderTargetUserControl1.CameraNearFarClipDistance = Map.Instance.NearFarClipDistance;
                renderTargetUserControl1.CameraFixedUp = Vec3.ZAxis;
                renderTargetUserControl1.CameraFov = fov;
                renderTargetUserControl1.CameraPosition = position;
                renderTargetUserControl1.CameraDirection = forward;
            }
        }
开发者ID:whztt07,项目名称:SDK,代码行数:34,代码来源:Example3DViewForm.cs


示例4: Editor_RenderSelectionBorder

        public override void Editor_RenderSelectionBorder( Camera camera, bool simpleGeometry, DynamicMeshManager manager, 
			DynamicMeshManager.MaterialData material )
        {
            DynamicMeshManager.Block block = manager.GetBlockFromCacheOrCreate( "CollisionVolume.Editor_RenderSelectionBorder: Box" );
            block.AddBox( false, new Box( Vec3.Zero, Vec3.One, Mat3.Identity ), null );

            Box box = GetBox();
            manager.AddBlockToScene( block, box.Center, box.Axis.ToQuat(), box.Extents, false, material );
        }
开发者ID:whztt07,项目名称:SDK,代码行数:9,代码来源:CollisionVolume.cs


示例5: OnRender

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

            if (EntitySystemWorld.Instance.IsEditor() && EditorLayer.Visible ||
                EngineDebugSettings.DrawGameSpecificDebugGeometry)
            {
                if (camera.Purpose == Camera.Purposes.MainCamera)
                {
                    camera.DebugGeometry.Color = new ColorValue(0, 0, 1);
                    camera.DebugGeometry.AddBox(GetBox());
                }
            }
        }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:15,代码来源:ObserveCameraArea.cs


示例6: renderTargetUserControl_Render

 void renderTargetUserControl_Render(Camera camera)
 {
     _camera = camera;
     WorldView.UpdateFromWorldModel();
     Perspective.Check();
     renderTarget.CameraPosition = Perspective.Position.ToVec3();
     renderTarget.CameraDirection = Perspective.Rotation.ToQuat() * Vec3.XAxis;
     // TODO: what does it all mean?
     //new Angles(0f, 0f, MathFunctions.RadToDeg((float)_perspective.Heading)).ToQuat()
     //* new Angles(0f, MathFunctions.RadToDeg((float)_perspective.Tilt), 0f).ToQuat()
     //* Vec3.XAxis;
     if (SoundWorld.Instance != null)
         SoundWorld.Instance.SetListener(camera.Position, Vec3.Zero, camera.Direction, camera.Up);
     RenderEntityOverCursor(camera);
 }
开发者ID:628426,项目名称:Strive.NET,代码行数:15,代码来源:PerspectiveView.xaml.cs


示例7: OnRender

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

            if (EntitySystemWorld.Instance.IsEditor() && EditorLayer.Visible ||
                EngineDebugSettings.DrawGameSpecificDebugGeometry)
            {
                if (camera.Purpose == Camera.Purposes.MainCamera)
                {
                    if (PhysicsModel != null)
                    {
                        foreach (Body body in PhysicsModel.Bodies)
                            body.DebugRender(camera.DebugGeometry, 0, 1, true, true, new ColorValue(1, 0, 0));
                    }
                }
            }
        }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:18,代码来源:CollisionVolume.cs


示例8: OnRender

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

            bool show = alwaysShowBorder;
            if (EntitySystemWorld.Instance.IsEditor() && !EditorLayer.Visible)
                show = false;
            if (MapEditorInterface.Instance != null && MapEditorInterface.Instance.IsEntitySelected(this))
                show = true;
            if (EngineDebugSettings.DrawGameSpecificDebugGeometry)
                show = true;

            if (show && camera.Purpose == Camera.Purposes.MainCamera)
            {
                camera.DebugGeometry.Color = new ColorValue(1, 0, 0);
                camera.DebugGeometry.AddBox(GetBox());
            }
        }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:19,代码来源:WaterPlaneClipVolume.cs


示例9: WalkForCamera

        public static void WalkForCamera( Camera camera, float farClipDistance,
            Set<SceneNode> outSceneNodes, Set<StaticMeshObject> outStaticMeshObjects)
        {
            Frustum frustum = FrustumUtils.GetFrustumByCamera( camera, farClipDistance );

            if( EngineDebugSettings.FrustumTest && camera.AllowFrustumTestMode )
            {
                frustum.HalfWidth *= .5f;
                frustum.HalfHeight *= .5f;
            }

            SceneManager.Instance._SceneGraph.GetObjects( ref frustum, false,
                _SceneObjectGroups.SceneNode | _SceneObjectGroups.StaticMeshObject,
                delegate( _ISceneObject sceneObject )
                {
                    _SceneObjectGroups objGroups = sceneObject._SceneData.Groups;

                    //StaticMeshObject
                    if( ( objGroups & _SceneObjectGroups.StaticMeshObject ) != 0 )
                    {
                        StaticMeshObject staticMeshObject = (StaticMeshObject)sceneObject;

                        if( !staticMeshObject.Visible )
                            return;
                        outStaticMeshObjects.Add( staticMeshObject );
                        return;
                    }

                    //SceneNode
                    if( ( objGroups & _SceneObjectGroups.SceneNode ) != 0 )
                    {
                        SceneNode sceneNode = (SceneNode)sceneObject;

                        if( !sceneNode.Visible )
                            return;
                        outSceneNodes.Add( sceneNode );
                        return;
                    }

                    Log.Fatal( "InternalSceneManagement: WalkForCamera: invalid sceneObject." );
                } );
        }
开发者ID:DarrenHassan,项目名称:GDM4242-GroupD,代码行数:42,代码来源:LowLevelSceneManagement.cs


示例10: WalkForShadowGeneration

        public static void WalkForShadowGeneration( Camera camera, RenderLight light,
            float farClipDistance, Set<SceneNode> outSceneNodes,
            Set<StaticMeshObject> outStaticMeshObjects)
        {
            switch( light.Type )
            {
            case RenderLightType.Spot:
                WalkSpotLightShadowGeneration( camera, light, outSceneNodes,
                    outStaticMeshObjects );
                break;

            case RenderLightType.Point:
                WalkPointLightShadowGeneration( camera, light, outSceneNodes,
                    outStaticMeshObjects );
                break;

            case RenderLightType.Directional:
                WalkDirectionalLightShadowGeneration( camera, light, farClipDistance,
                    outSceneNodes, outStaticMeshObjects );
                break;
            }
        }
开发者ID:DarrenHassan,项目名称:GDM4242-GroupD,代码行数:22,代码来源:LowLevelSceneManagement.cs


示例11: OnRender

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

            if( attachedMesh != null )
            {
                bool visible = camera.IsIntersectsFast( MapBounds );
                attachedMesh.Visible = visible;
                if( visible )
                {
                    //update mesh if needed
                    if( needUpdateVertices )
                    {
                        UpdateMeshVertices();
                        needUpdateVertices = false;
                    }
                    if( needUpdateIndices )
                    {
                        UpdateMeshIndices();
                        needUpdateIndices = false;
                    }
                }
            }
        }
开发者ID:CITS4242B2010,项目名称:project2010,代码行数:24,代码来源:BlinkGrid.cs


示例12: StaticMeshObject_AddToRenderQueue

        void StaticMeshObject_AddToRenderQueue( StaticMeshObject staticMeshObject,
            Camera camera, ref bool allowRender)
        {
            if( needMaterialAlpha != 1 )
            {
                if( shaderBaseMaterial != null )
                {
                    //ShaderBase high level material

                    float diffusePower = shaderBaseMaterial.DiffusePower;
                    ColorValue diffuse = shaderBaseMaterial.DiffuseColor *
                        new ColorValue( diffusePower, diffusePower, diffusePower, 1 );
                    staticMeshObject.SetCustomGpuParameter(
                        (int)ShaderBaseMaterial.GpuParameters.dynamicDiffuseScale,
                        new Vec4( diffuse.Red, diffuse.Green, diffuse.Blue,
                        diffuse.Alpha * needMaterialAlpha ) );
                }
                else if( clonedStandardMaterial != null )
                {
                    //standard material

                    foreach( Technique technique in clonedStandardMaterial.Techniques )
                    {
                        foreach( Pass pass in technique.Passes )
                        {
                            ColorValue diffuse = pass.Diffuse;
                            pass.Diffuse = new ColorValue( diffuse.Red, diffuse.Green,
                                diffuse.Blue, needMaterialAlpha );
                        }
                    }
                }
            }
        }
开发者ID:DarrenHassan,项目名称:GDM4242-GroupD,代码行数:33,代码来源:Decal.cs


示例13: OnRender

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

            // Avoid some errors on destruction
            if (UniversalClock.Instance == null)
                return;

            UniversalClock.Instance.Update();
            float relDayTime = Convert.ToSingle(UniversalClock.Instance.JulianDay % 1d);

            // Updates each elements one by one
            foreach(CaelumBase element in mChildren)
                element.Update(relDayTime, camera);

            // Manages fog
            if (Fog.Instance != null && mManageFog)
            {
                Fog.Instance.ExpDensity = SkyColorModel.GetFogDensity() * FogDensityMultiplier;
                Fog.Instance.Color = SkyColorModel.GetFogColor();
            }
        }
开发者ID:huytd,项目名称:fosproject,代码行数:22,代码来源:CaelumManager.cs


示例14: OnControlledObjectRender

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

            if( camera != RendererWorld.Instance.DefaultCamera )
                return;

            //debug geometry
            if( EngineDebugSettings.DrawGameSpecificDebugGeometry )
            {
                //way
                if( generalTaskCurrentWayPoint != null )
                {
                    ReadOnlyCollection<MapCurvePoint> points = generalTaskWay.Points;

                    camera.DebugGeometry.Color = new ColorValue( 0, 1, 0, .5f );
                    int index = points.IndexOf( generalTaskCurrentWayPoint );
                    for( ; index < points.Count - 1; index++ )
                    {
                        camera.DebugGeometry.AddArrow(
                            points[ index ].Position, points[ index + 1 ].Position, 1 );
                    }
                }

                //view radius
                if( ControlledObject.ViewRadius != 0 )
                {
                    camera.DebugGeometry.Color = new ColorValue( 0, 1, 0, .5f );
                    Vec3 lastPos = Vec3.Zero;
                    for( float angle = 0; angle <= MathFunctions.PI * 2 + .001f;
                        angle += MathFunctions.PI / 16 )
                    {
                        Vec3 pos = ControlledObject.Position + new Vec3( MathFunctions.Cos( angle ),
                            MathFunctions.Sin( angle ), 0 ) * ControlledObject.ViewRadius;

                        if( angle != 0 )
                            camera.DebugGeometry.AddLine( lastPos, pos );

                        lastPos = pos;
                    }
                }

                if( unitWeapons == null )
                    FindUnitWeapons();

                //weapons
                foreach( Weapon weapon in unitWeapons )
                {
                    float radius = 0;

                    if( weapon.Type.WeaponNormalMode.IsInitialized )
                        radius = Math.Max( radius, weapon.Type.WeaponNormalMode.UseDistanceRange.Maximum );
                    if( weapon.Type.WeaponAlternativeMode.IsInitialized )
                        radius = Math.Max( radius, weapon.Type.WeaponAlternativeMode.UseDistanceRange.Maximum );

                    camera.DebugGeometry.Color = new ColorValue( 1, 0, 0, .5f );
                    Vec3 lastPos = Vec3.Zero;
                    for( float angle = 0; angle <= MathFunctions.PI * 2 + .001f;
                        angle += MathFunctions.PI / 16 )
                    {
                        Vec3 pos = weapon.Position +
                            new Vec3( MathFunctions.Cos( angle ), MathFunctions.Sin( angle ), 0 ) * radius;

                        if( angle != 0 )
                            camera.DebugGeometry.AddLine( lastPos, pos );

                        lastPos = pos;
                    }
                }

                //move task
                if( moveTaskEnabled )
                {
                    camera.DebugGeometry.Color = new ColorValue( 0, 1, 0 );
                    camera.DebugGeometry.AddArrow( ControlledObject.Position, moveTaskPosition, 1 );
                }

                //attack tasks
                foreach( AttackTask attackTask in attackTasks )
                {
                    Vec3 targetPos = ( attackTask.TargetEntity != null ) ?
                        attackTask.TargetEntity.Position : attackTask.TargetPosition;

                    camera.DebugGeometry.Color = IsWeaponDirectedToTarget( attackTask ) ?
                        new ColorValue( 1, 1, 0 ) : new ColorValue( 1, 0, 0 );
                    camera.DebugGeometry.AddArrow( attackTask.Weapon.Position, targetPos, 1 );
                    camera.DebugGeometry.AddSphere( new Sphere( targetPos, 3 ), 10 );
                }
            }
        }
开发者ID:DarrenHassan,项目名称:GDM4242-GroupD,代码行数:90,代码来源:TankGameUnitAI.cs


示例15: OnRender

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

            if ((EngineDebugSettings.DrawGameSpecificDebugGeometry ||
                EngineApp.Instance.ApplicationType == EngineApp.ApplicationTypes.ResourceEditor) &&
                camera.Purpose == Camera.Purposes.MainCamera)
            {
                if (Active)
                {
                    float height = Type.ActiveAreaHeight;
                    float radius = Type.ActiveAreaRadius;
                    int segments = 32;

                    camera.DebugGeometry.Color = new ColorValue(0, 1, 0, .5f);

                    float angleStep = MathFunctions.PI * 2 / (float)segments;
                    for (float angle = 0; angle < MathFunctions.PI * 2 - angleStep * .5f; angle += angleStep)
                    {
                        float sin1 = MathFunctions.Sin(angle);
                        float cos1 = MathFunctions.Cos(angle);
                        float sin2 = MathFunctions.Sin(angle + angleStep);
                        float cos2 = MathFunctions.Cos(angle + angleStep);
                        Vec3 bottom1 = Position + new Vec3(cos1 * radius, sin1 * radius, 0);
                        Vec3 top1 = Position + new Vec3(cos1 * radius, sin1 * radius, height);
                        Vec3 bottom2 = Position + new Vec3(cos2 * radius, sin2 * radius, 0);
                        Vec3 top2 = Position + new Vec3(cos2 * radius, sin2 * radius, height);

                        camera.DebugGeometry.AddLine(bottom1, top1);
                        camera.DebugGeometry.AddLine(top1, top2);
                        camera.DebugGeometry.AddLine(bottom1, bottom2);
                    }
                }
            }
        }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:35,代码来源:Teleporter.cs


示例16: CreateViewport

            private void CreateViewport()
            {
                int index = instance.views.IndexOf(this);

                DestroyViewport();

                Vec2I textureSize = GetNeededTextureSize();

                string textureName = TextureManager.Instance.GetUniqueName(
                    string.Format("MultiViewRendering{0}", index));
                PixelFormat format = PixelFormat.R8G8B8;

                int fsaa;
                if (!int.TryParse(RendererWorld.InitializationOptions.FullSceneAntialiasing, out fsaa))
                    fsaa = 0;

                texture = TextureManager.Instance.Create(textureName, Texture.Type.Type2D,
                    textureSize, 1, 0, format, Texture.Usage.RenderTarget, false, fsaa);
                if (texture == null)
                {
                    Log.Fatal("MultiViewRenderingManager: Unable to create texture.");
                    return;
                }

                RenderTarget renderTarget = texture.GetBuffer().GetRenderTarget();
                renderTarget.AutoUpdate = true;
                renderTarget.AllowAdditionalMRTs = true;

                //create camera
                camera = SceneManager.Instance.CreateCamera(
                    SceneManager.Instance.GetUniqueCameraName(string.Format("MultiViewRendering{0}", index)));
                camera.Purpose = Camera.Purposes.MainCamera;

                //add viewport
                viewport = renderTarget.AddViewport(camera, 0);
                viewport.ShadowsEnabled = true;

                //Create compositor for HDR render technique
                bool hdrCompositor =
                    RendererWorld.Instance.DefaultViewport.GetCompositorInstance("HDR") != null;
                if (hdrCompositor)
                {
                    viewport.AddCompositor("HDR");
                    viewport.SetCompositorEnabled("HDR", true);
                }

                //FXAA antialiasing post effect
                bool fxaaCompositor =
                    RendererWorld.Instance.DefaultViewport.GetCompositorInstance("FXAA") != null;
                if (fxaaCompositor)
                {
                    viewport.AddCompositor("FXAA");
                    viewport.SetCompositorEnabled("FXAA", true);
                }

                //add listener
                renderTargetListener = new ViewRenderTargetListener(this);
                renderTarget.AddListener(renderTargetListener);

                initializedTextureSize = textureSize;
            }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:61,代码来源:MultiViewRenderingManager.cs


示例17: OnRender

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

			//update visiblity of attached objects. hide car for First Person mode.
			{
				bool show = true;
				PlayerIntellect playerIntellect = Intellect as PlayerIntellect;
				if( playerIntellect != null && playerIntellect.FPSCamera )
					show = false;
				foreach( MapObjectAttachedObject attachedObject in AttachedObjects )
					attachedObject.Visible = show;
			}

			//draw debug data
			if( camera.Purpose == Camera.Purposes.MainCamera && EngineDebugSettings.DrawDynamicPhysics && physicsVehicle != null )
			{
				float distanceSqr = MapBounds.GetPointDistanceSqr( camera.Position );
				float farClipDistance = camera.FarClipDistance;
				if( distanceSqr < farClipDistance * farClipDistance )
				{
					float renderTime = RendererWorld.Instance.FrameRenderTime;
					float timeInterpolate = ( renderTime - Entities.Instance.TickTime ) * EntitySystemWorld.Instance.GameFPS;
					MathFunctions.Clamp( ref timeInterpolate, 0, 1 );

					camera.DebugGeometry.SetSpecialDepthSettings( false, true );
					physicsVehicle.DebugRender( camera.DebugGeometry, timeInterpolate, 1, false, true, new ColorValue( 1, 0, 0 ) );
					camera.DebugGeometry.RestoreDefaultDepthSettings();
				}
			}
		}
开发者ID:whztt07,项目名称:NeoAxisCommunity,代码行数:31,代码来源:Car.cs


示例18: OnRender

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

            //update background area image
            if( backgroundImageMeshObject != null )
            {
                Rect area = GetDestinationArea();
                backgroundImageSceneNode.Position = new Vec3(
                    ( area.Maximum.X + area.Minimum.X ) / 2,
                    ( area.Maximum.Y + area.Minimum.Y ) / 2, -.04f );
                backgroundImageSceneNode.Scale = new Vec3( area.Size.X, area.Size.Y, 1 );
            }

            //render destination area
            {
                Rect area = GetDestinationArea();
                area.Expand( .1f );
                Bounds b = new Bounds(
                    area.Minimum.X, area.Minimum.Y, 0,
                    area.Maximum.X, area.Maximum.Y, 0 );
                camera.DebugGeometry.Color = new ColorValue( 0, 1, 0 );
                camera.DebugGeometry.AddBounds( b );
            }

            //render game area
            {
                Rect area = GetGameArea();
                area.Expand( .1f );
                Bounds b = new Bounds(
                    area.Minimum.X, area.Minimum.Y, 0,
                    area.Maximum.X, area.Maximum.Y, 0 );
                camera.DebugGeometry.Color = new ColorValue( 0, 1, 0 );
                camera.DebugGeometry.AddBounds( b );
            }
        }
开发者ID:DarrenHassan,项目名称:GDM4242-GroupD,代码行数:36,代码来源:JigsawPuzzleManager.cs


示例19: workAreaControl_Render

		void workAreaControl_Render( MultiViewRenderTargetControl sender, int viewIndex, Camera camera )
		{
			//update camera
			if( Map.Instance != null )
			{
				Vec3 position;
				Vec3 forward;
				Vec3 up;
				Degree fov;

				if( !freeCameraEnabled )
				{
					//usual camera mode

					//add here your special camera management code and set "freeCameraEnabled = false;"

					position = Vec3.Zero;
					forward = new Vec3( 1, 0, 0 );
					up = Vec3.ZAxis;
					fov = Map.Instance.Fov;

					//MapCamera mapCamera = Entities.Instance.GetByName( "MapCamera_0" ) as MapCamera;
					//if( mapCamera != null )
					//{
					//   position = mapCamera.Position;
					//   forward = mapCamera.Rotation * new Vec3( 1, 0, 0 );
					//   fov = mapCamera.Fov;
					//}
				}
				else
				{
					//free camera mode
					position = freeCameraPosition;
					forward = freeCameraDirection.GetVector();
					up = Vec3.ZAxis;
					fov = Map.Instance.Fov;
				}

				//update control
				RenderTargetUserControl control = workAreaControl.Views[ viewIndex ].Control;

				if( viewIndex == 0 )
				{
					//first view
					control.CameraNearFarClipDistance = Map.Instance.NearFarClipDistance;
					control.CameraFixedUp = up;
					control.CameraFov = fov;
					control.CameraPosition = position;
					control.CameraDirection = forward;
				}
				else
				{
					//all views except first view. set orthographic camera projection.
					control.CameraNearFarClipDistance = Map.Instance.NearFarClipDistance;
					control.CameraProjectionType = ProjectionTypes.Orthographic;
					control.CameraOrthoWindowHeight = 30;

					Vec3 lookAt = position;

					switch( viewIndex )
					{
					case 1:
						control.CameraFixedUp = Vec3.ZAxis;
						control.CameraDirection = -Vec3.XAxis;
						control.CameraPosition = lookAt - control.CameraDirection * 100;
						break;
					case 2:
						control.CameraFixedUp = Vec3.ZAxis;
						control.CameraDirection = -Vec3.YAxis;
						control.CameraPosition = lookAt - control.CameraDirection * 100;
						break;
					case 3:
						control.CameraFixedUp = Vec3.YAxis;
						control.CameraDirection = -Vec3.ZAxis;
						control.CameraPosition = lookAt - control.CameraDirection * 100;
						break;
					}
				}
			}

			//update sound listener
			if( viewIndex == 0 && SoundWorld.Instance != null )
				SoundWorld.Instance.SetListener( camera.Position, Vec3.Zero, camera.Direction, camera.Up );

			//draw 2D graphics as 3D by means DebugGeometry
			if( workAreaViewsConfiguration == ViewsConfigurations.FourViews && viewIndex == 3 )
			{
				const float cameraOffset = 10;
				Vec3 center = camera.Position + camera.Direction * cameraOffset;

				//draw box
				Vec3[] positions;
				int[] indices;
				GeometryGenerator.GenerateBox( new Vec3( 10, 4, 1 ), out positions, out indices );
				Mat4 transform = new Mat4( Mat3.Identity, center );
				camera.DebugGeometry.Color = new ColorValue( .5f, 0, 0 );
				camera.DebugGeometry.AddVertexIndexBuffer( positions, indices, transform, false, true );
				camera.DebugGeometry.Color = new ColorValue( 1, 1, 0 );
				camera.DebugGeometry.AddVertexIndexBuffer( positions, indices, transform, true, true );

//.........这里部分代码省略.........
开发者ID:whztt07,项目名称:NeoAxisCommunity,代码行数:101,代码来源:MainForm.cs


示例20: DebugDrawNavMesh

        public void DebugDrawNavMesh( Camera camera )
        {
            if( recastWorld == IntPtr.Zero )
                return;

            if( debugNavigationMeshVertices == null )
            {
                if( !GetDebugNavigationMeshGeometry( out debugNavigationMeshVertices ) )
                    return;

                debugNavigationMeshIndices = new int[ debugNavigationMeshVertices.Length ];
                for( int n = 0; n < debugNavigationMeshIndices.Length; n++ )
                    debugNavigationMeshIndices[ n ] = n;
            }

            //Render NavMesh
            {
                Mat4 transform = new Mat4( Mat3.Identity, new Vec3( 0, 0, .1f ) );

                //draw without depth test
                {
                    camera.DebugGeometry.SetSpecialDepthSettings( false, false );

                    camera.DebugGeometry.Color = new ColorValue( 0, 1, 0, .1f );
                    camera.DebugGeometry.AddVertexIndexBuffer( debugNavigationMeshVertices,
                        debugNavigationMeshIndices, transform, false, true );

                    camera.DebugGeometry.Color = new ColorValue( 1, 1, 0, .1f );
                    camera.DebugGeometry.AddVertexIndexBuffer( debugNavigationMeshVertices,
                        debugNavigationMeshIndices, transform, true, true );

                    camera.DebugGeometry.RestoreDefaultDepthSettings();
                }

                //draw with depth test
                {
                    camera.DebugGeometry.Color = new ColorValue( 0, 1, 0, .3f );
                    camera.DebugGeometry.AddVertexIndexBuffer( debugNavigationMeshVertices,
                        debugNavigationMeshIndices, transform, false, true );
                    camera.DebugGeometry.Color = new ColorValue( 1, 1, 0, .3f );
                    camera.DebugGeometry.AddVertexIndexBuffer( debugNavigationMeshVertices,
                        debugNavigationMeshIndices, transform, true, true );
                }
            }
        }
开发者ID:whztt07,项目名称:SDK,代码行数:45,代码来源:RecastNavigationSystem.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Engine.Vector类代码示例发布时间:2022-05-24
下一篇:
C# Engine.Button类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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