本文整理汇总了C#中Engine.Camera类的典型用法代码示例。如果您正苦于以下问题:C# Camera类的具体用法?C# Camera怎么用?C# Camera使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Camera类属于Engine命名空间,在下文中一共展示了Camera类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 );
}
示例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);
}
}
示例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;
}
}
示例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 );
}
示例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());
}
}
}
示例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);
}
示例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));
}
}
}
}
示例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());
}
}
示例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." );
} );
}
示例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;
}
}
示例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;
}
}
}
}
示例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 );
}
}
}
}
}
示例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();
}
}
示例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 );
}
}
}
示例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);
}
}
}
}