本文整理汇总了C#中Camera类的典型用法代码示例。如果您正苦于以下问题:C# Camera类的具体用法?C# Camera怎么用?C# Camera使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Camera类属于命名空间,在下文中一共展示了Camera类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start()
{
// Script References
shipGraphics = GetComponent<ShipGraphics>();
shipPhysicsScript = GetComponent<ShipPhysicsScript>();
// Component Variables
cam = GetComponentInChildren<Camera>();
body = GetComponent<Rigidbody>();
model = transform.Find("Model").gameObject;
capsuleCollider = GetComponentInChildren<CapsuleCollider>();
boxCollider = GetComponentInChildren<BoxCollider>();
lockSound = GetComponent<AudioSource>();
// Control Variables
mouseSensitivity = 8.0f;
//mouseThreshold = 8.0f;
//buttonSensitivity = 0.05f;
//buttonThreshold = 0.05f;
horTranslation = 0.0f;
verTranslation = 0.0f;
enemyNoLock = (Material)Resources.Load("Crosshair");
enemyLock = (Material)Resources.Load("Crosshair_Enemy");
trackedObject = null;
trackingResults = null;
shootWaitTime = 0.0f;
targetTime = 0.0f;
hits = 0;
}
示例2: InternalDraw
protected override void InternalDraw(GameTime time, Matrix absoluteTransform, PrimitiveBatch primitiveBatch, Camera camera)
{
if (_mesh != null)
{
primitiveBatch.DrawMesh(_mesh, absoluteTransform, camera);
}
}
示例3: Awake
void Awake()
{
mainCamera = Camera.main;
if (s_Instance == null)
s_Instance = this;
//DontDestroyOnLoad(this);
}
示例4: Start
protected override void Start()
{
base.Start ();
controller = GetComponent<PlayerController> ();
gunController = GetComponent<GunController> ();
viewCamera = Camera.main;
}
示例5: TileMap3D
public TileMap3D(GraphicsDevice graphicsDevice, ContentManager contentManager, int width, int height)
{
this.GraphicsDevice = graphicsDevice;
Wall = contentManager.Load<Model>("Models/TileMap3D/Wall");
FloorTile = contentManager.Load<Model>("Models/TileMap3D/FloorTile");
Dirt = contentManager.Load<Model>("Models/TileMap3D/Dirt");
Cleaner = contentManager.Load<Model>("Models/TileMap3D/Cleaner");
((BasicEffect)Wall.Meshes[0].Effects[0]).EnableDefaultLighting();
((BasicEffect)FloorTile.Meshes[0].Effects[0]).EnableDefaultLighting();
((BasicEffect)Dirt.Meshes[0].Effects[0]).EnableDefaultLighting();
((BasicEffect)Cleaner.Meshes[0].Effects[0]).EnableDefaultLighting();
foreach (BasicEffect effect in Cleaner.Meshes[0].Effects)
effect.Tag = effect.DiffuseColor;
foreach (BasicEffect effect in FloorTile.Meshes[0].Effects)
effect.Tag = effect.DiffuseColor;
dss.DepthBufferEnable = true;
dss.DepthBufferFunction = CompareFunction.LessEqual;
dss.DepthBufferWriteEnable = true;
rs.CullMode = CullMode.CullCounterClockwiseFace;
ss.AddressU = TextureAddressMode.Wrap;
ss.AddressV = TextureAddressMode.Wrap;
ss.Filter = TextureFilter.Anisotropic;
Camera = new Camera(graphicsDevice.Viewport.AspectRatio, graphicsDevice);
}
示例6: FormLoadTexture
public FormLoadTexture()
{
InitializeComponent();
//if (CameraDictionary.Instance.ContainsKey(this.GetType().Name))
//{
// this.camera = CameraDictionary.Instance[this.GetType().Name];
//}
//else
{
this.camera = new Camera(CameraType.Ortho, this.glCanvas1.Width, this.glCanvas1.Height);
//CameraDictionary.Instance.Add(this.GetType().Name, this.camera);
}
rotator = new SatelliteRotator(this.camera);
this.glCanvas1.MouseWheel += glCanvas1_MouseWheel;
element = new LoadTextureExample();
element.Initialize();
IUILayoutParam param = new IUILayoutParam(
AnchorStyles.Left | AnchorStyles.Bottom,
new Padding(10, 10, 10, 10), new Size(50, 50));
uiAxis = new SimpleUIAxis(param);
uiAxis.Initialize();
this.glCanvas1.MouseWheel += glCanvas1_MouseWheel;
this.glCanvas1.KeyPress += glCanvas1_KeyPress;
this.glCanvas1.MouseDown += glCanvas1_MouseDown;
this.glCanvas1.MouseMove += glCanvas1_MouseMove;
this.glCanvas1.MouseUp += glCanvas1_MouseUp;
this.glCanvas1.OpenGLDraw += glCanvas1_OpenGLDraw;
this.glCanvas1.Resize += glCanvas1_Resize;
this.Load += Form_Load;
}
示例7: renderTargetUserControl1_Render
void renderTargetUserControl1_Render( RenderTargetUserControl sender, Camera camera )
{
//update camera
if( Map.Instance != null )
{
Vec3 position;
Vec3 forward;
Degree fov;
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;
}
}
示例8: CalculateDepth
///////////////////////////////////////////////////////////////////////////////
// functions
///////////////////////////////////////////////////////////////////////////////
// ------------------------------------------------------------------
// Desc:
// ------------------------------------------------------------------
override protected float CalculateDepth ( Camera _cam ) {
if ( _cam == null )
return 0.0f;
float dist = _cam.farClipPlane - _cam.nearClipPlane;
float unitLayer = dist/MAX_LAYER;
return -(((float)layer_ + bias_) * unitLayer - _cam.transform.position.y + _cam.nearClipPlane);
}
示例9: Awake
// Use this for initialization
void Awake()
{
GameObject go = new GameObject("depthCamera");
depthCamera = go.AddComponent<Camera>();
depthCamera.transform.position = Vector3.zero;
depthCamera.transform.rotation = transform.rotation;
depthCamera.transform.localPosition += transform.forward * Near;
depthCamera.transform.parent = transform;
depthCamera.isOrthoGraphic = true;
depthCamera.clearFlags = CameraClearFlags.SolidColor;
depthCamera.backgroundColor = Color.white;
depthTexture = new RenderTexture(TextureSize,TextureSize, 16, RenderTextureFormat.ARGB32);
depthTexture.filterMode = FilterMode.Point;
depthCamera.targetTexture = depthTexture;
depthCamera.SetReplacementShader(shader, null);
depthCamera.enabled = false;
biasMatrix = Matrix4x4.identity;
biasMatrix[ 0, 0 ] = 0.5f;
biasMatrix[ 1, 1 ] = 0.5f;
biasMatrix[ 2, 2 ] = 0.5f;
biasMatrix[ 0, 3 ] = 0.5f;
biasMatrix[ 1, 3 ] = 0.5f;
biasMatrix[ 2, 3 ] = 0.5f;
}
示例10: Form_Load
private void Form_Load(object sender, EventArgs e)
{
{
var camera = new Camera(
new vec3(0, 0, 5), new vec3(0, 0, 0), new vec3(0, 1, 0),
CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height);
var rotator = new SatelliteManipulater();
rotator.Bind(camera, this.glCanvas1);
rotator.BindingMouseButtons = System.Windows.Forms.MouseButtons.Left | System.Windows.Forms.MouseButtons.Right;
this.rotator = rotator;
this.scene = new Scene(camera, this.glCanvas1);
this.glCanvas1.Resize += this.scene.Resize;
}
{
Teapot model = new Teapot();
OrderDependentTransparencyRenderer renderer = OrderDependentTransparencyRenderer.Create(model, model.Size, Teapot.strPosition, Teapot.strColor);
SceneObject obj = renderer.WrapToSceneObject();
this.scene.RootObject.Children.Add(obj);
}
{
var builder = new StringBuilder();
builder.AppendLine("1: Scene's property grid.");
builder.AppendLine("2: Canvas' property grid.");
MessageBox.Show(builder.ToString());
}
}
示例11: Update
public override void Update(float elapsed, Camera camera, Player player, Map map)
{
base.Update (elapsed, camera, player, map);
if (!dead) {
tileDirRelSprites = new List<TileDirectionRelSprite> ();
ApplyCamera (camera);
x += xDir * MOVE_SPEED * elapsed;
y += yDir * FALL_SPEED * elapsed;
if (jumping) {
if (yDir >= 0) {
jumping = false;
falling = true;
} else {
yDir += FALL_SPEED;
}
} else if (falling) {
if (yDir < FALL_CAP)
yDir += FALL_SPEED;
}
gun.Update (elapsed, camera);
if (xDir != 0) {
gun.left = xDir < 0;
}
if (gun.left) {
gun.x = x - gun.width;
} else if (!gun.left) {
gun.x = x + width;
}
gun.y = y + height / 3;
}
}
示例12: Draw
public void Draw(SpriteBatch spriteBatch, Camera cam, Texture2D texture)
{
for (int i = 0; i < MaxParticles; i++)
{
sparkParticles[i].Draw(spriteBatch, cam, texture, gameWindow);
}
}
示例13: Init
public void Init(Transform dependence, string msg, Color textColor, FlyNumerDirection flyDir = FlyNumerDirection.side,int size = 42)
{
base.Init();
cam = MainController.Instance.MainCamera;
this.dependence = dependence;
incFlyingNumbers.Init(msg, textColor, flyDir, size, OnDead);
}
示例14: Load
public override void Load()
{
camera = ((Camera)Container);
SlimDX.RawInput.Device.RegisterDevice(SlimDX.Multimedia.UsagePage.Generic, SlimDX.Multimedia.UsageId.Mouse, SlimDX.RawInput.DeviceFlags.None);
SlimDX.RawInput.Device.MouseInput += new EventHandler<MouseInputEventArgs>(MouseEventHandle);
}
示例15: Curve
public Curve(Molecule mol, Vector2 pos, Camera VectroCam = null)
{
_mol = mol;
_label = mol.getName();
_points = new LinkedList<Vector2>();
//_pts = new Vector2[_maxPoints];
_pts = new List<Vector2>();
_minY = 0;
_maxY = 0;
_color = new Color(UnityEngine.Random.Range(0f, 1f), UnityEngine.Random.Range(0f, 1f), UnityEngine.Random.Range(0f, 1f));
//_line = new VectorLine(mol.getName(), _pts, _color, null, 2.0f, LineType.Continuous, Joins.Weld);
_line = new VectorLine(mol.getName(), _pts, 2.0f, LineType.Continuous, Joins.Weld);
_line.color = _color;
_isEnabled = true;
_vectroCam = VectroCam;
// _pos = pos;
// _lines = new VectorLine[_maxPoints];
// _linesTypes = new _linesTypes[_maxPoints - 1];
VectorManager.useDraw3D = true;
if (_vectroCam != null)
//Vectrosity.VectorLine.SetCamera(_vectroCam);
Vectrosity.VectorLine.SetCamera3D(_vectroCam);
else
Logger.Log("No Camera set for the Graph Window.", Logger.Level.ERROR);
}