/// <summary>
        /// Creates a PerspectiveProjection with default properties.
        /// Fov = Pi / 2
        /// Near = 1
        /// Far = 1000
        /// </summary>
        /// <param name="compositor"></param>
        /// <exception cref="System.ArgumentException">Thrown when constructor is passed a null value.</exception>
        public PerspectiveProjection(Compositor compositor)
        {
            if (compositor == null)
            {
                throw new System.ArgumentException("Compositor cannot be null");
            }

            _compositor  = compositor;
            _propertySet = _compositor.CreatePropertySet();

            // Create the properties for the projection
            _propertySet.InsertScalar("Fov", MathF.PI / 2);
            _propertySet.InsertScalar("Near", 1f);
            _propertySet.InsertScalar("Far", 1000f);
            _propertySet.InsertMatrix4x4("ProjectionMatrix", Matrix4x4.Identity);

            StartAnimationonProjectionMatrix();
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a Viewport with default properties.
        /// Offset = Vector3.Zero
        /// Size = Vector2(100, 100)
        /// Stretch = Uniform
        /// StretchMatrix = Matrix4x4.Identity
        /// </summary>
        /// <param name="compositor"></param>
        /// <exception cref="System.ArgumentException">Thrown when constructor is passed a null value.</exception>
        public Viewport(Compositor compositor)
        {
            if (compositor == null)
            {
                throw new System.ArgumentException("Compositor cannot be null");
            }

            _compositor  = compositor;
            _propertySet = _compositor.CreatePropertySet();

            // Create properties of viewport
            _propertySet.InsertVector3("Offset", Vector3.Zero);
            _propertySet.InsertVector2("Size", new Vector2(100, 100));
            _propertySet.InsertScalar("Stretch", (int)Stretch.Uniform);
            _propertySet.InsertMatrix4x4("StretchMatrix", Matrix4x4.Identity);

            Camera = new OrbitalCamera(_compositor);

            StartAnimationsOnStretchMatrix();
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a FirstPersonCamera with default properties.
        /// Position = Vector3.Zero
        /// Yaw = 0
        /// Pitch = 0
        /// Roll = 0
        /// ModelViewProjectionMatrix = Matrix4x4.Identity
        /// </summary>
        /// <param name="compositor"></param>
        /// <exception cref="System.ArgumentException">Thrown when constructor is passed a null value.</exception>
        public FirstPersonCamera(Compositor compositor)
        {
            if (compositor == null)
            {
                throw new System.ArgumentException("Compositor cannot be null");
            }

            _compositor = compositor;

            // Create the properties for the camera
            _propertySet = _compositor.CreatePropertySet();
            _propertySet.InsertVector3("Position", Vector3.Zero);
            _propertySet.InsertScalar("Yaw", 0f);
            _propertySet.InsertScalar("Pitch", 0f);
            _propertySet.InsertScalar("Roll", 0f);
            _propertySet.InsertMatrix4x4("ModelViewProjectionMatrix", Matrix4x4.Identity);

            // Default is an orthographic projection
            Projection = new OrthographicProjection(_compositor);
        }
Esempio n. 4
0
        /// <summary>
        /// Creates an OrbitalCamera with default properties.
        /// Target = Vector3.Zero
        /// Phi = 0
        /// Theta = 0
        /// Radius = 300
        /// ModelViewProjectionMatrix = Matrix4x4.Identity
        /// </summary>
        /// <param name="compositor"></param>
        /// <exception cref="System.ArgumentException">Thrown when constructor is passed a null value.</exception>
        public OrbitalCamera(Compositor compositor)
        {
            if (compositor == null)
            {
                throw new System.ArgumentException("Compositor cannot be null");
            }

            _compositor  = compositor;
            _fpCam       = new FirstPersonCamera(_compositor);
            _propertySet = _compositor.CreatePropertySet();

            float epsilon = 0.0001f;

            // Create the properties for the camera
            _propertySet.InsertVector3("Target", Vector3.Zero);
            _propertySet.InsertScalar("Phi", epsilon);
            _propertySet.InsertScalar("Theta", 0f);
            _propertySet.InsertScalar("Radius", 300f);
            _propertySet.InsertMatrix4x4("ModelViewProjectionMatrix", Matrix4x4.Identity);

            // Connect orbital camera's properties to the _fpCam's properties
            StartAnimationsOnFPCamera();
        }
Esempio n. 5
0
 public static CompositionPropertySet SetValue(this CompositionPropertySet set, string name, Matrix4x4 value)
 {
     set.InsertMatrix4x4(name, value);
     return set;
 }