Beispiel #1
0
        public Camera(Viewport v, float fov, float n, float f, bool debug = false)
        {
            myViewport           = v;
            myViewport.notifier += handle_viewportChanged;

            fieldOfView   = fov;
            myZnear       = n;
            myZfar        = f;
            myAspectRatio = (float)myViewport.width / (float)myViewport.height;

            myOrientation = Quaternion.Identity;
            myEye         = new Vector3(0.0f, 0.0f, 0.0f);
            myXAxis       = new Vector3(1.0f, 0.0f, 0.0f);
            myYAxis       = new Vector3(0.0f, 1.0f, 0.0f);
            myZAxis       = new Vector3(0.0f, 0.0f, 1.0f);
            myViewDir     = new Vector3(0.0f, 0.0f, 1.0f);
            updateViewMatrix();
            setPerspective(fov, (float)v.width / (float)v.height, myZnear, myZfar);

            myCameraUniformBuffer = new UniformBufferObject(BufferUsageHint.DynamicDraw);

            if (debug == false)
            {
                myDebugCamera = new Camera(v, fov, n, f * 2, true);                 //need to see further than the regular camera
            }
        }
Beispiel #2
0
        public void setUniformUpload(UniformBufferObject ubo, byte[] data)
        {
            currentUniformUpload++;
            UniformUploadData uData;

            uData.ubo  = ubo;
            uData.data = data;
            myUniformUploadData[currentUniformUpload] = uData;
        }
Beispiel #3
0
        public LightVisualizer()
            : base("light")
        {
            // room for 255 lights, light 0 is the sun
            for (int i = 0; i < 255; i++)
            {
                myLightData[i] = new LightUniformData();
            }

            myLightUniforBuffer = new UniformBufferObject(BufferUsageHint.DynamicDraw);
        }
Beispiel #4
0
        public Material(String n = "")
        {
            name = n;

            //default material properties
            ambient         = new Color4(0.1f, 0.1f, 0.1f, 1.0f);
            diffuse         = new Color4(0.8f, 0.8f, 0.8f, 1.0f);
            spec            = new Color4(0.1f, 0.1f, 0.1f, 1.0f);
            emission        = new Color4(0.0f, 0.0f, 0.0f, 1.0f);
            shininess       = 128.0f;
            alpha           = 1.0f;
            alphaTest       = 0.0f;
            hasTransparency = false;

            myMaterialUniformBuffer = new UniformBufferObject(BufferUsageHint.StaticDraw);
        }
Beispiel #5
0
 public BindUniformBufferCommand(UniformBufferObject ubo, String location)
     : base()
 {
     myUbo      = ubo;
     myLocation = location;
 }