Esempio n. 1
0
 public PhysicalBody(RigidBody rigidBody, CollisionShape shape, TransformationManager manager)
 {
     Body           = rigidBody;
     Shape          = shape;
     Transformation = manager;
     Enabled        = false;
 }
Esempio n. 2
0
 public CubeMapFramebuffer(int width, int height, bool depthOnly = false)
 {
     Transformation = new TransformationManager(Vector3.Zero);
     Generated = false;
     Width = width;
     Height = height;
 }
Esempio n. 3
0
 public CubeMapDepthFramebuffer(int width, int height)
 {
     Generated      = false;
     Width          = width;
     Height         = height;
     Transformation = new TransformationManager(Vector3.Zero);
 }
Esempio n. 4
0
        public Mesh3dInstance AddInstance(TransformationManager transformation, string name = "unnamed")
        {
            var i = new Mesh3dInstance(transformation, name);

            Instances.Add(i);
            return(i);
        }
Esempio n. 5
0
 public PhysicalBody(RigidBody rigidBody, CollisionShape shape, TransformationManager manager)
 {
     Body = rigidBody;
     Shape = shape;
     Transformation = manager;
     Enabled = false;
 }
Esempio n. 6
0
        public Matrix4 MapSingle(ShadowMapQuality quality, TransformationManager transformation, float angle, float cutoff)
        {
            Camera last = Camera.Current;

            SingleCamera.UpdatePerspective(1, angle, 0.01f, cutoff);
            SingleCamera.Transformation = transformation;
            SingleCamera.Update();
            SingleCamera.Transformation.ClearModifiedFlag();

            Camera.Current = SingleCamera;
            if (quality == ShadowMapQuality.High)
            {
                SpotHighQuality.Use();
            }
            if (quality == ShadowMapQuality.Medium)
            {
                SpotMediumQuality.Use();
            }
            if (quality == ShadowMapQuality.Low)
            {
                SpotLowQuality.Use();
            }

            RenderWorld();

            Camera.Current = last;
            return(SingleCamera.GetVPMatrix());
        }
Esempio n. 7
0
        public PhysicalBody CreateBody(float mass, TransformationManager startTransform, CollisionShape shape)
        {
            var rb = CreateRigidBody(mass, startTransform.GetWorldTransform(), shape);
            var pb = new PhysicalBody(rb, shape, startTransform);

            return(pb);
        }
Esempio n. 8
0
 public CubeMapFramebuffer(int width, int height, bool depthOnly = false)
 {
     Transformation = new TransformationManager(Vector3.Zero);
     Generated      = false;
     Width          = width;
     Height         = height;
     Texture        = new CubeMapTexture(0);
 }
Esempio n. 9
0
 public Camera()
 {
     Transformation = new TransformationManager(Vector3.Zero);
     Matrix4.CreatePerspectiveFieldOfView(MathHelper.DegreesToRadians(90.0f), 1.0f, 0.01f, 10000.0f, out ProjectionMatrix);
     Far   = 10000.0f;
     Pitch = 0.0f;
     Roll  = 0.0f;
     Update();
 }
Esempio n. 10
0
 public KeyframeAnimatedMesh3d(List<Object3dInfo> infos, GenericMaterial material)
 {
     Transformation = new TransformationManager(Vector3.Zero);
     Frames = new List<Mesh3d>();
     CurrentFrame = 0;
     foreach(var i in infos)
     {
         Frames.Add(new Mesh3d(i, material));
     }
 }
Esempio n. 11
0
 public Camera(Vector3 position, Vector3 lookAt, Vector3 up, float aspectRatio, float fov, float near, float far)
 {
     Transformation = new TransformationManager(position, Quaternion.Identity, 1.0f);
     Matrix4.CreatePerspectiveFieldOfView(fov, aspectRatio, near, far, out ProjectionMatrix);
     Far   = far;
     Pitch = 0.0f;
     Roll  = 0.0f;
     Transformation.SetOrientation(Matrix4.LookAt(Vector3.Zero, lookAt, up).ExtractRotation().Inverted());
     Update();
 }
Esempio n. 12
0
 public Mesh3d(Object3dInfo objectInfo, GenericMaterial material)
 {
     // ModelMatricesBuffer = new ShaderStorageBuffer();
        // RotationMatricesBuffer = new ShaderStorageBuffer();
     DisableDepthWrite = false;
     Instances = 1;
     MainObjectInfo = objectInfo;
     MainMaterial = material;
     Transformation = new TransformationManager(Vector3.Zero, Quaternion.Identity, 1.0f);
     UpdateMatrix();
     MeshColoredID = new Vector3((float)Randomizer.NextDouble(), (float)Randomizer.NextDouble(), (float)Randomizer.NextDouble());
 }
Esempio n. 13
0
 public Camera(Vector3 position, Vector3 lookAt, Vector2 size, float near, float far)
 {
     Transformation = new TransformationManager(position, Quaternion.Identity, 1.0f);
     Far = far;
     //ViewMatrix = Matrix4.LookAt(position, lookAt, new Vector3(0, 1, 0));
     Matrix4.CreateOrthographic(size.X, size.Y, near, far, out ProjectionMatrix);
     if(Current == null)
         Current = this;
     Pitch = 0.0f;
     Roll = 0.0f;
     Update();
 }
Esempio n. 14
0
 public Camera(Vector3 position, Vector3 lookAt, float aspectRatio, float fov, float near, float far)
 {
     Transformation = new TransformationManager(position, Quaternion.Identity, 1.0f);
     //ViewMatrix = Matrix4.LookAt(position, lookAt, new Vector3(0, 1, 0));
     Matrix4.CreatePerspectiveFieldOfView(fov, aspectRatio, near, far, out ProjectionMatrix);
     Far = far;
     if(Current == null)
         Current = this;
     if(MainDisplayCamera == null)
         MainDisplayCamera = this;
     Pitch = 0.0f;
     Roll = 0.0f;
     Update();
 }
Esempio n. 15
0
 public Camera(Vector3 position, Vector3 lookAt, Vector2 size, float near, float far)
 {
     Transformation = new TransformationManager(position, Quaternion.Identity, 1.0f);
     Far            = far;
     //ViewMatrix = Matrix4.LookAt(position, lookAt, new Vector3(0, 1, 0));
     Matrix4.CreateOrthographic(size.X, size.Y, near, far, out ProjectionMatrix);
     if (Current == null)
     {
         Current = this;
     }
     Pitch = 0.0f;
     Roll  = 0.0f;
     Update();
 }
Esempio n. 16
0
 public Camera(Vector3 position, Vector3 lookAt, Vector3 up, float aspectRatio, float fov, float near, float far)
 {
     Transformation = new TransformationManager(position, Quaternion.Identity, 1.0f);
     Matrix4.CreatePerspectiveFieldOfView(fov, aspectRatio, near, far, out ProjectionMatrix);
     Far = far;
     if(Current == null)
         Current = this;
     if(MainDisplayCamera == null)
         MainDisplayCamera = this;
     Pitch = 0.0f;
     Roll = 0.0f;
     Transformation.SetOrientation(Matrix4.LookAt(Vector3.Zero, lookAt, up).ExtractRotation().Inverted());
     Update();
 }
Esempio n. 17
0
        public void MapCube(ShadowMapQuality quality, TransformationManager transformation, float cutoff)
        {
            Camera last = Camera.Current;
            CubeMapDepthFramebuffer cfb = null;

            if (quality == ShadowMapQuality.High)
            {
                cfb = CubeHighQuality;
            }
            if (quality == ShadowMapQuality.Medium)
            {
                cfb = CubeMediumQuality;
            }
            if (quality == ShadowMapQuality.Low)
            {
                cfb = CubeLowQuality;
            }
            cfb.UpdateFarPlane(cutoff);

            cfb.Use();
            cfb.Clear();
            cfb.SetPosition(transformation.Position);

            cfb.SwitchCameraAndFace(OpenTK.Graphics.OpenGL4.TextureTarget.TextureCubeMapPositiveX);
            RenderWorld();
            cfb.SwitchCameraAndFace(OpenTK.Graphics.OpenGL4.TextureTarget.TextureCubeMapPositiveY);
            RenderWorld();
            cfb.SwitchCameraAndFace(OpenTK.Graphics.OpenGL4.TextureTarget.TextureCubeMapPositiveZ);
            RenderWorld();

            cfb.SwitchCameraAndFace(OpenTK.Graphics.OpenGL4.TextureTarget.TextureCubeMapNegativeX);
            RenderWorld();
            cfb.SwitchCameraAndFace(OpenTK.Graphics.OpenGL4.TextureTarget.TextureCubeMapNegativeY);
            RenderWorld();
            cfb.SwitchCameraAndFace(OpenTK.Graphics.OpenGL4.TextureTarget.TextureCubeMapNegativeZ);
            RenderWorld();

            Camera.Current = last;
        }
Esempio n. 18
0
 public SimplePointLight(Vector3 position, Color color)
 {
     Transformation = new TransformationManager(position);
     Color = color;
 }
Esempio n. 19
0
 public Mesh3dInstance(TransformationManager trans, string name)
 {
     Transformation = trans;
     Name = name;
     Id = ObjectIDGenerator.GetNext();
 }
Esempio n. 20
0
 public Light(TransformationManager trans)
 {
     Transformation = trans;
 }
Esempio n. 21
0
 public AreaLight(Vector3 position, Vector3 color, Vector3 normal, Vector3 tangent)
 {
     Transformation = new TransformationManager(position);
     Color = color;
 }
Esempio n. 22
0
 public PhysicalBody CreateBody(float mass, TransformationManager startTransform, CollisionShape shape)
 {
     var rb = CreateRigidBody(mass, startTransform.GetWorldTransform(), shape);
     var pb = new PhysicalBody(rb, shape, startTransform);
     return pb;
 }
Esempio n. 23
0
 public Mesh3dInstance AddInstance(TransformationManager transformation, string name = "unnamed")
 {
     var i = new Mesh3dInstance(transformation, name);
     Instances.Add(i);
     return i;
 }
Esempio n. 24
0
 public Mesh3dInstance(TransformationManager trans, string name)
 {
     Transformation = trans;
     Name           = name;
     Id             = ObjectIDGenerator.GetNext();
 }