35 lines
616 B
C#
35 lines
616 B
C#
using System;
|
|
|
|
using OpenTK;
|
|
using org.budnhead.core;
|
|
using org.budnhead.graphics;
|
|
|
|
namespace bnhdemo
|
|
{
|
|
public class CameraRotator : Actor
|
|
{
|
|
GLCamera camera;
|
|
Matrix3 m3 = Matrix3.CreateRotationZ(MathHelper.PiOver2 / 45.0f);
|
|
|
|
Vector3 p = new Vector3(400,400,256);
|
|
Vector3 offset = new Vector3(150,0,0);
|
|
Vector3 view = new Vector3(-1,0,-1);
|
|
|
|
public CameraRotator(GLCamera camera)
|
|
:base(0)
|
|
{
|
|
this.camera = camera;
|
|
}
|
|
|
|
public override void update(float timespan)
|
|
{
|
|
offset = m3 * offset;
|
|
view = m3 * view;
|
|
|
|
camera.Position = p + offset;
|
|
camera.View = view.Normalized();
|
|
}
|
|
|
|
}
|
|
}
|