Exemplo n.º 1
0
    public void SwitchPartner(bool playerInLaser)
    {
        partnerPreviewRenderer.enabled = false;
        previewRenderer.enabled        = false;


        partnerLinkedPair.timesFlipped += 1;

        if (playerInLaser) //player is going to laser with this object, so partner should be set to real
        {
            ShaderUtility.ShaderToReal(partnerMaterial);

            partner.GetComponent <Transition>().SetStart(1f);

            StartCoroutine(flipTransitionRoutine(1, 0f, 1f, false));

            partner.layer = 11;
        }

        else //player is going to real, so the pair should go to laser
        {
            ShaderUtility.ShaderToLaser(partnerMaterial);

            partner.GetComponent <Transition>().SetStart(0f);

            StartCoroutine(flipTransitionRoutine(0f, 1f, 1f, true));


            partner.layer = 10;
        }
    }
Exemplo n.º 2
0
        protected override void OnLoad(EventArgs e)
        {
            // Set some GL state
            GL.ClearColor(Color4.SkyBlue);
            GL.Enable(EnableCap.DepthTest);
            GL.Enable(EnableCap.CullFace);

            mShader = new ShaderUtility(@"ACW/Shaders/vPassThrough.vert", @"ACW/Shaders/fLighting.frag");
            GL.UseProgram(mShader.ShaderProgramID);
            int vPositionLocation  = GL.GetAttribLocation(mShader.ShaderProgramID, "vPosition");
            int vNormalLocation    = GL.GetAttribLocation(mShader.ShaderProgramID, "vNormal");
            int vTexCoordsLocation = GL.GetAttribLocation(mShader.ShaderProgramID, "vTexCoords");

            GL.GenVertexArrays(mVAO_IDs.Length, mVAO_IDs);
            GL.GenBuffers(mVBO_IDs.Length, mVBO_IDs);

            //ground
            Textures.LoadTexture(mTexture_ID, 0, mShader);
            Ground.GroundMethod(mVAO_IDs, mVBO_IDs, vPositionLocation, vNormalLocation, vTexCoordsLocation);

            //armadillo

            Textures.LoadTexture(mTexture_ID, 1, mShader);
            mArmadilloModelUtility = ModelUtility.LoadModel(@"Utility/Models/model.bin");
            Armadillo.ArmadilloMethod(mVAO_IDs, mVBO_IDs, mArmadilloModelUtility, vPositionLocation, vNormalLocation, vTexCoordsLocation);

            //Cylinder Model

            Textures.LoadTexture(mTexture_ID, 2, mShader);
            mCylinderModelUtility = ModelUtility.LoadModel(@"Utility/Models/cylinder.bin");
            Cylinder.CyclinderMethod(mVAO_IDs, mVBO_IDs, mCylinderModelUtility, vPositionLocation, vNormalLocation, vTexCoordsLocation);

            //Sphere Model

            Textures.LoadTexture(mTexture_ID, 3, mShader);
            mSphereModelUtility = ModelUtility.LoadModel(@"Utility/Models/sphere.bin");
            Sphere.SphereMethod(mVAO_IDs, mVBO_IDs, mSphereModelUtility, vPositionLocation, vNormalLocation, vTexCoordsLocation);

            // End

            mView = Matrix4.CreateTranslation(0.0f, -1.5f, 0.0f);
            int uView = GL.GetUniformLocation(mShader.ShaderProgramID, "uView");

            GL.UniformMatrix4(uView, true, ref mView);

            mGroundModel = Matrix4.CreateTranslation(0.0f, 0.0f, -5.0f);

            mArmadilloModel = Matrix4.CreateTranslation(0.0f, 3.0f, -5.0f); //sets armadillo position
            Vector3 t                  = mArmadilloModel.ExtractTranslation();
            Matrix4 translation        = Matrix4.CreateTranslation(t);
            Matrix4 inverseTranslation = Matrix4.CreateTranslation(-t);

            mArmadilloModel = mArmadilloModel * inverseTranslation * Matrix4.CreateRotationY(-1.7f) * translation; // rotates armadillo

            mCylinderModel = Matrix4.CreateTranslation(0.0f, 1.0f, -5.0f);                                         //sets cylidner position

            mSphereModel = Matrix4.CreateTranslation(5.0f, currentPosition, -3.0f);                                //sets Sphere position

            base.OnLoad(e);
        }
Exemplo n.º 3
0
        public void ShowPhysicsData(ref ShaderUtility mShader)
        {
            if (!World.gamePhysics.showPhysicsData)
            {
                return;
            }
            Vector4 normalVelocity       = velocity.Normalized();
            int     uAmbientLightReflect = GL.GetUniformLocation(mShader.ShaderProgramID, "uMaterial.AmbientReflectivity");

            GL.Uniform3(uAmbientLightReflect, this.material.Ambient);
            Vector3 limeGreen = new Vector3(0, 100, 0);
            Vector3 red       = new Vector3(100, 0, 0);
            Vector3 orange    = new Vector3(100, 100, 0);

            GL.Uniform3(uAmbientLightReflect, limeGreen);

            //Likely Collision.
            GL.Uniform3(uAmbientLightReflect, limeGreen);
            GL.Begin(PrimitiveType.Lines);
            GL.LineWidth(4);
            GL.Vertex3(0, 0, 0);
            GL.Vertex3(NearestContact.X, NearestContact.Y, NearestContact.Z);
            GL.End();
            //Velocity Vector
            GL.LineWidth(2);
            GL.Uniform3(uAmbientLightReflect, red);
            GL.Begin(PrimitiveType.Lines);
            GL.Vertex3(0, 0, 0);
            GL.Vertex3(normalVelocity.X * 10, normalVelocity.Y * 10, normalVelocity.Z * 10);
            GL.End();
            GL.LineWidth(1);
        }
Exemplo n.º 4
0
    public override void Drop()
    {
        Renderer r = GetComponent <Renderer>();

        if (player.GetComponent <flipScript>().space)
        {
            //Going to real
            ShaderUtility.ShaderWorldChange(r.material, false);

            this.gameObject.layer = 11;
            GetComponent <SelectionRenderChange>().OnDrop();
            GetComponent <Transition>().SetStart(0f);
            GetComponent <MorphController>().OnDeselection();
        }

        else
        {
            //Going to laser
            ShaderUtility.ShaderWorldChange(r.material, true);

            //GetComponent<Renderer>().material.shader = raycastManager.laserWorldShader;
            this.gameObject.layer = 10;
            GetComponent <SelectionRenderChange>().OnDrop();
            GetComponent <Transition>().SetStart(1f);
            GetComponent <MorphController>().OnDeselection();
        }

        _iconContainer.SetOpenHand();
        selected = false;
        rigidbody.freezeRotation = false;
        rigidbody.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll;
        rigidbody.isKinematic = true;
        ResetWalk();
    }
Exemplo n.º 5
0
        public static void LoadSurface(ref ShaderUtility mShader)
        {
            VBO[0] = GL.GenBuffer();
            //VBO[1] = GL.GenBuffer();
            VAO = GL.GenVertexArray();

            int vPositionLocation = GL.GetAttribLocation(mShader.ShaderProgramID, "vPosition");
            int vNormal           = GL.GetAttribLocation(mShader.ShaderProgramID, "vNormal");

            //Ground verticies?
            float[] vertices = new float[] { -1, 0, -1, 0, 1, 0,
                                             -1, 0, 1, 0, 1, 0,
                                             1, 0, 1, 0, 1, 0,
                                             1, 0, -1, 0, 1, 0, };
            //Ground...
            GL.BindVertexArray(VAO);
            GL.BindBuffer(BufferTarget.ArrayBuffer, VBO[0]);
            GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(vertices.Length * sizeof(float)), vertices, BufferUsageHint.StaticDraw);

            int size;

            GL.GetBufferParameter(BufferTarget.ArrayBuffer, BufferParameterName.BufferSize, out size);
            if (vertices.Length * sizeof(float) != size)
            {
                throw new ApplicationException("Vertex data not loaded onto graphics card correctly");
            }

            GL.EnableVertexAttribArray(vPositionLocation);
            GL.EnableVertexAttribArray(vNormal);
            GL.VertexAttribPointer(vPositionLocation, 3, VertexAttribPointerType.Float, false, 6 * sizeof(float), 0);
            GL.VertexAttribPointer(vNormal, 3, VertexAttribPointerType.Float, true, 6 * sizeof(float), 3 * sizeof(float));
        }
Exemplo n.º 6
0
        public static void LoadCylinder(ref ShaderUtility mShader)
        {
            GL.GenBuffers(2, VBO);
            VAO = GL.GenVertexArray();

            int vPositionLocation = GL.GetAttribLocation(mShader.ShaderProgramID, "vPosition");
            int vNormal           = GL.GetAttribLocation(mShader.ShaderProgramID, "vNormal");

            GL.BindVertexArray(VAO);
            GL.BindBuffer(BufferTarget.ArrayBuffer, VBO[0]);
            GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(mModelUtility.Vertices.Length * sizeof(float)), mModelUtility.Vertices, BufferUsageHint.StaticDraw);

            GL.BindBuffer(BufferTarget.ElementArrayBuffer, VBO[1]);
            GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(mModelUtility.Indices.Length * sizeof(float)), mModelUtility.Indices, BufferUsageHint.StaticDraw);

            int size;

            GL.GetBufferParameter(BufferTarget.ArrayBuffer, BufferParameterName.BufferSize, out size);
            if (mModelUtility.Vertices.Length * sizeof(float) != size)
            {
                throw new ApplicationException("Vertex data not loaded onto graphics card correctly");
            }

            GL.GetBufferParameter(BufferTarget.ElementArrayBuffer, BufferParameterName.BufferSize, out size);
            if (mModelUtility.Indices.Length * sizeof(float) != size)
            {
                throw new ApplicationException("Index data not loaded onto graphics card correctly");
            }

            GL.EnableVertexAttribArray(vPositionLocation);
            GL.EnableVertexAttribArray(vNormal);
            GL.VertexAttribPointer(vPositionLocation, 3, VertexAttribPointerType.Float, false, 6 * sizeof(float), 0);
            GL.VertexAttribPointer(vNormal, 3, VertexAttribPointerType.Float, true, 6 * sizeof(float), 3 * sizeof(float));
        }
Exemplo n.º 7
0
 //Render Static Objects.
 public static void DrawStages(ref ShaderUtility mShader)
 {
     foreach (Shape obj in GlobalStaticObjects)
     {
         obj.Draw(ref mShader);
     }
 }
Exemplo n.º 8
0
        public void OnValidate(WaterCamera waterCamera)
        {
            ShaderUtility instance = ShaderUtility.Instance;

            instance.Use(ShaderList.VolumesFrontSimple);
            instance.Use(ShaderList.VolumesFront);
            instance.Use(ShaderList.VolumesBack);
        }
Exemplo n.º 9
0
        private void CreateMaterials()
        {
            ShaderUtility instance = ShaderUtility.Instance;

            this._FinalMaterial   = instance.CreateMaterial(ShaderList.RaindropsFinal, HideFlags.None);
            this._FadeMaterial    = instance.CreateMaterial(ShaderList.RaindropsFade, HideFlags.None);
            this._DropletMaterial = instance.CreateMaterial(ShaderList.RaindropsParticle, HideFlags.None);
        }
Exemplo n.º 10
0
        protected override void OnLoad(EventArgs e)
        {
            // Set some GL state
            GL.ClearColor(Color4.DodgerBlue);
            GL.Enable(EnableCap.DepthTest);
            GL.Enable(EnableCap.CullFace);


            mModel  = ModelUtility.LoadModel(@"Utility/Models/lab22model.sjg");
            mShader = new ShaderUtility(@"Lab2/Shaders/vLab22.vert", @"Lab2/Shaders/fSimple.frag");
            GL.UseProgram(mShader.ShaderProgramID);

            mView = Matrix4.CreateTranslation(0, 0, -2);
            int uView = GL.GetUniformLocation(mShader.ShaderProgramID, "uView");

            GL.UniformMatrix4(uView, true, ref mView);

            int     uProjectionLocation = GL.GetUniformLocation(mShader.ShaderProgramID, "uProjection");
            Matrix4 projection          = Matrix4.CreateOrthographic(10, 10, -1, 1);

            GL.UniformMatrix4(uProjectionLocation, true, ref projection);

            int vPositionLocation = GL.GetAttribLocation(mShader.ShaderProgramID, "vPosition");
            int vColourLocation   = GL.GetAttribLocation(mShader.ShaderProgramID, "vColour");

            mVAO_ID = GL.GenVertexArray();
            GL.GenBuffers(mVBO_IDs.Length, mVBO_IDs);

            GL.BindVertexArray(mVAO_ID);
            GL.BindBuffer(BufferTarget.ArrayBuffer, mVBO_IDs[0]);
            GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(mModel.Vertices.Length * sizeof(float)), mModel.Vertices, BufferUsageHint.StaticDraw);
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, mVBO_IDs[1]);
            GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(mModel.Indices.Length * sizeof(float)), mModel.Indices, BufferUsageHint.StaticDraw);

            int size;

            GL.GetBufferParameter(BufferTarget.ArrayBuffer, BufferParameterName.BufferSize, out size);
            if (mModel.Vertices.Length * sizeof(float) != size)
            {
                throw new ApplicationException("Vertex data not loaded onto graphics card correctly");
            }

            GL.GetBufferParameter(BufferTarget.ElementArrayBuffer, BufferParameterName.BufferSize, out size);
            if (mModel.Indices.Length * sizeof(float) != size)
            {
                throw new ApplicationException("Index data not loaded onto graphics card correctly");
            }

            GL.EnableVertexAttribArray(vPositionLocation);
            GL.VertexAttribPointer(vPositionLocation, 3, VertexAttribPointerType.Float, false, 6 * sizeof(float), 0);
            GL.EnableVertexAttribArray(vColourLocation);
            GL.VertexAttribPointer(vColourLocation, 3, VertexAttribPointerType.Float, false, 6 * sizeof(float), 3 * sizeof(float));

            GL.BindVertexArray(0);

            base.OnLoad(e);
        }
Exemplo n.º 11
0
        public override void Draw(ref ShaderUtility mShader)
        {
            int uModel = GL.GetUniformLocation(mShader.ShaderProgramID, "uModel");

            GL.UniformMatrix4(uModel, true, ref mTransformations);
            GL.BindVertexArray(VAO);
            base.Draw(ref mShader);
            GL.DrawElements(PrimitiveType.TriangleStrip, indices.Length, DrawElementsType.UnsignedInt, 0);
        }
Exemplo n.º 12
0
        public override void Draw(ref ShaderUtility mShader)
        {
            int uModel = GL.GetUniformLocation(mShader.ShaderProgramID, "uModel");

            GL.UniformMatrix4(uModel, true, ref mTransformations);
            GL.BindVertexArray(VAO);
            base.Draw(ref mShader);
            GL.DrawArrays(PrimitiveType.TriangleFan, 0, 4);
        }
Exemplo n.º 13
0
        private void _loadPath(Asset asset)
        {
            PathStyleBuilder builder = new PathStyleBuilder();

            switch (asset.PathMaterialType)
            {
            case Asset.PathMaterial.Sheet:
            {
                Texture2D sheet  = AssetPackUtilities.LoadAsset <Texture2D>(_bundle, asset.Guid + ".path_sheet");
                Texture2D mask   = AssetPackUtilities.LoadAsset <Texture2D>(_bundle, asset.Guid + ".path_mask");
                Texture2D normal = AssetPackUtilities.LoadAsset <Texture2D>(_bundle, asset.Guid + ".path_normal");

                CustomColorsMaskedNormalBuilder materialBuilder = ShaderUtility.PathMaterial();
                if (sheet != null)
                {
                    materialBuilder.MainTex(sheet);
                }
                materialBuilder.MainTex(sheet == null ? ShaderUtility.EmptyTexture : sheet);
                materialBuilder.MaskTex(mask == null ? ShaderUtility.EmptyTexture : mask);
                materialBuilder.NormalTex(normal == null ? ShaderUtility.EmptyTexture : normal);

                builder.Material(materialBuilder.build())
                .Id(asset.Guid)
                .Name(asset.Name)
                .CustomColor(AssetPackUtilities.ConvertColors(asset.CustomColors, asset.ColorCount))
                .Register(asset.PathType, _assetManagerLoader,
                          PathStyleBuilder.GetPathStyle(PathStyleBuilder.NormalPathIds.Gravel,
                                                        PathStyleBuilder.PathType.Normal));
            }
            break;

            case Asset.PathMaterial.Tiled:
            {
                Texture2D sheet  = AssetPackUtilities.LoadAsset <Texture2D>(_bundle, asset.Guid + ".path_sheet");
                Texture2D mask   = AssetPackUtilities.LoadAsset <Texture2D>(_bundle, asset.Guid + ".path_mask");
                Texture2D normal = AssetPackUtilities.LoadAsset <Texture2D>(_bundle, asset.Guid + ".path_normal");

                CustomColorMaskedCutoutBuilder materialBuilder = ShaderUtility.PathMaterialTiled();
                if (sheet != null)
                {
                    materialBuilder.MainTex(sheet);
                }
                materialBuilder.MaskTex(mask == null ? ShaderUtility.EmptyTexture : mask);
                materialBuilder.MainTex(sheet == null ? ShaderUtility.EmptyTexture : sheet);
                materialBuilder.NormalTex(normal == null ? ShaderUtility.EmptyTexture : normal);
                builder.Material(materialBuilder.build())
                .Id(asset.Guid)
                .CustomColor(AssetPackUtilities.ConvertColors(asset.CustomColors, asset.ColorCount))
                .Name(asset.Name)
                .Register(asset.PathType, _assetManagerLoader,
                          PathStyleBuilder.GetPathStyle(PathStyleBuilder.NormalPathIds.Concrete,
                                                        PathStyleBuilder.PathType.Normal));
            }
            break;
            }
        }
Exemplo n.º 14
0
        protected override void OnLoad(EventArgs e)
        {
            GL.ClearColor(Color4.CadetBlue);

            float[] vertices = new float[] { -0.8f, 0.8f,
                                             -0.6f, -0.4f,
                                             0.2f, 0.2f };

            uint[] indices = new uint[] { 0, 1, 2 };

            GL.GenBuffers(2, mTriangleVertexBufferObjectIDArray);
            GL.BindBuffer(BufferTarget.ArrayBuffer, mTriangleVertexBufferObjectIDArray[0]);
            GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(vertices.Length * sizeof(float)), vertices, BufferUsageHint.StaticDraw);

            vertices = new float[] { -0.2f, -0.4f,
                                     0.8f, -0.4f,
                                     0.8f, 0.6f,
                                     -0.2f, 0.6f };

            indices = new uint[] { 0, 1, 2, 3 };

            GL.GenBuffers(2, mSquareVertexBufferObjectIDArray);
            GL.BindBuffer(BufferTarget.ArrayBuffer, mSquareVertexBufferObjectIDArray[0]);
            GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(vertices.Length * sizeof(float)), vertices, BufferUsageHint.StaticDraw);

            int size;

            GL.GetBufferParameter(BufferTarget.ArrayBuffer, BufferParameterName.BufferSize, out size);

            if (vertices.Length * sizeof(float) != size)
            {
                throw new ApplicationException("Vertex data not loaded onto graphics card correctly");
            }

            GL.BindBuffer(BufferTarget.ElementArrayBuffer, mTriangleVertexBufferObjectIDArray[1]);
            GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(indices.Length * sizeof(int)), indices, BufferUsageHint.StaticDraw);

            GL.BindBuffer(BufferTarget.ElementArrayBuffer, mSquareVertexBufferObjectIDArray[1]);
            GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(indices.Length * sizeof(int)), indices, BufferUsageHint.StaticDraw);

            GL.GetBufferParameter(BufferTarget.ElementArrayBuffer, BufferParameterName.BufferSize, out size);

            if (indices.Length * sizeof(int) != size)
            {
                throw new ApplicationException("Index data not loaded onto graphics card correctly");
            }

            #region Shader Loading Code

            mShader = new ShaderUtility(@"Lab2/Shaders/vLab21.vert", @"Lab2/Shaders/fSimple.frag");

            #endregion

            base.OnLoad(e);
        }
Exemplo n.º 15
0
    private void Start()
    {
        _material  = GetComponent <MeshRenderer>().material;
        _collision = new RayCastMeshCollisionUseCase(CachedTransform);

        _collision.HitDirection.Pairwise().Subscribe(dir =>
        {
            _material.DisableKeyword(ShaderUtility.GetKeywordForMeshDirection(dir.Previous));
            _material.EnableKeyword(ShaderUtility.GetKeywordForMeshDirection(dir.Current));
        }).AddTo(gameObject);
    }
Exemplo n.º 16
0
    }                                              //used in flippable

    public virtual void LoadShader(bool real)
    {
        if (real)
        {
            ShaderUtility.ShaderToReal(_material);
        }

        else
        {
            ShaderUtility.ShaderToLaser(_material);
        }
    }
Exemplo n.º 17
0
        //Adds a bit of colour...
        public virtual void Draw(ref ShaderUtility mShader)
        {
            int uAmbientLightReflect  = GL.GetUniformLocation(mShader.ShaderProgramID, "uMaterial.AmbientReflectivity");
            int uDiffuseLightReflect  = GL.GetUniformLocation(mShader.ShaderProgramID, "uMaterial.DiffuseReflectivity");
            int uSpecularLightReflect = GL.GetUniformLocation(mShader.ShaderProgramID, "uMaterial.SpecularReflectivity");
            int uShine = GL.GetUniformLocation(mShader.ShaderProgramID, "uMaterial.Shininess");

            GL.Uniform3(uAmbientLightReflect, this.material.Ambient);
            GL.Uniform3(uDiffuseLightReflect, this.material.Diffuse);
            GL.Uniform3(uSpecularLightReflect, this.material.Specular);
            GL.Uniform1(uShine, this.material.Shininess);
        }
Exemplo n.º 18
0
        public override void Draw(ref ShaderUtility mShader)
        {
            int uModel = GL.GetUniformLocation(mShader.ShaderProgramID, "uModel");

            mTransformations.M41 = vPosition.X;
            mTransformations.M42 = vPosition.Y;
            mTransformations.M43 = vPosition.Z;
            GL.UniformMatrix4(uModel, true, ref mTransformations);
            GL.BindVertexArray(VAO);
            base.Draw(ref mShader);
            GL.DrawElements(PrimitiveType.Triangles, mModelUtility.Indices.Length, DrawElementsType.UnsignedInt, 0);
            DistanceToNearestObject = 1000;
        }
Exemplo n.º 19
0
        protected override void OnLoad(EventArgs e)
        {
            mTimer = new Timer();
            mTimer.Start();
            // Set some GL state
            GL.ClearColor(Color4.White);
            GL.Enable(EnableCap.CullFace);
            #region mostly shader stuff, +camera matrix
            //Shader Initialisation/Lighting
            mShader = new ShaderUtility(@"ACW/Shaders/vLighting.vert", @"ACW/Shaders/fLighting.frag");
            GL.UseProgram(mShader.ShaderProgramID);

            mView = Matrix4.CreateTranslation(0, 3.5f, -10);

            Vector3[] colour = { new Vector3(2f, 0f, 0f), new Vector3(0f, 1.5f, 0f), new Vector3(1f, 1.4f, 1.5f) };
            for (int i = 0; i < 3; i++)
            {
                uLightPositionLocation[i] = GL.GetUniformLocation(mShader.ShaderProgramID, "uLight[" + i + "].Position");
                //Vector3 colour = new Vector3(0.1f, 0.0f, 0.0f);
                lightPosition[i] = lightOrigins[i];// new Vector4(2+ i, 4 - i, -8.5f, 1);
                lightPosition[i] = Vector4.Transform(lightPosition[i], mView);
                GL.Uniform4(uLightPositionLocation[i], lightPosition[i]);

                uAmbientLightLocation = GL.GetUniformLocation(mShader.ShaderProgramID, "uLight[" + i + "].AmbientLight");
                GL.Uniform3(uAmbientLightLocation, colour[i] / 10);
                uDiffuseLightLocation = GL.GetUniformLocation(mShader.ShaderProgramID, "uLight[" + i + "].DiffuseLight");
                GL.Uniform3(uDiffuseLightLocation, colour[i]);
                uSpecularLightLocation = GL.GetUniformLocation(mShader.ShaderProgramID, "uLight[" + i + "].SpecularLight");
                GL.Uniform3(uSpecularLightLocation, colour[i]);
            }

            int vPositionLocation = GL.GetAttribLocation(mShader.ShaderProgramID, "vPosition");
            int vNormal           = GL.GetAttribLocation(mShader.ShaderProgramID, "vNormal");

            uEyePos = GL.GetUniformLocation(mShader.ShaderProgramID, "uEyePosition");
            GL.Uniform4(uEyePos, mView.Row3);
            #endregion

            Surface.LoadSurface(ref mShader);
            Ball.LoadGeometry(ref mShader);
            Cylinder.LoadCylinder(ref mShader);
            Box.LoadSurface(ref mShader);
            GL.BindVertexArray(0);

            int uView = GL.GetUniformLocation(mShader.ShaderProgramID, "uView");
            GL.UniformMatrix4(uView, true, ref mView);
            World.InitRegions();
            cam = new Camera(mView);
            base.OnLoad(e);
        }
    private void Start()
    {
        if (currentFlips < flipCountActivate)
        {
            GetComponent <Transition>().enabled = false;
            GetComponent <Renderer>().enabled   = false;
        }

        player = Toolbox.Instance.GetPlayer();

        Material material = GetComponent <Renderer>().material;

        visibleInlaser = ShaderUtility.ShaderIsLaser(material);
    }
Exemplo n.º 21
0
    public override void Drop()
    {
        StopAllCoroutines();
        wait = false;
        currentPositionVelocity = originalVelocity;

        //put the object down with the right shader
        if (player.GetComponent <flipScript>().space)
        {
            ShaderUtility.ShaderToReal(_renderer.material);

            GetComponent <Transition>().SetStart(0f);
            SetMaterialFloatProp("_onHover", 1);

            //renderer.material.SetInt("_onHold", 0);
            this.gameObject.layer = 11;
        }

        else
        {
            ShaderUtility.ShaderToLaser(_renderer.material);

            GetComponent <Transition>().SetStart(1f);
            OffSelect();
            SetMaterialFloatProp("_onHover", 1);

            //renderer.material.SetInt("_onHold", 0);
            this.gameObject.layer = 10;
        }

        Vector3 currentVelocity = rigidbody.velocity;

        if (currentVelocity.magnitude > maxVelocity)
        {
            //.Log("before " + currentVelocity);
            rigidbody.velocity = Vector3.ClampMagnitude(currentVelocity, maxVelocity);
            //Debug.Log(rigidbody.velocity + ", " + rigidbody.velocity.magnitude);
        }

        FlipCore(false);
        _iconContainer.SetOpenHand();
        selected = false;
        OffSelect();
        rigidbody.freezeRotation = false;
        beenPickedUp             = true;
        rigidbody.constraints    = RigidbodyConstraints.None;
        rigidbody.useGravity     = true;
        ResetWalk();
    }
        protected override void OnLoad(EventArgs e)
        {
            GL.ClearColor(Color4.ForestGreen);

            float[] vertices = new float[] { 0.0f, 0.8f,
                                             0.8f, 0.4f,
                                             0.6f, -0.6f,
                                             -0.6f, -0.6f,
                                             -0.8f, 0.4f };

            uint[] indices = new uint[] { 0, 4, 1,
                                          3,
                                          2 };


            GL.GenBuffers(2, mVertexBufferObjectIDArray);

            GL.BindBuffer(BufferTarget.ArrayBuffer, mVertexBufferObjectIDArray[0]);
            GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(vertices.Length * sizeof(float)), vertices, BufferUsageHint.StaticDraw);

            int size;

            GL.GetBufferParameter(BufferTarget.ArrayBuffer, BufferParameterName.BufferSize, out size);

            if (vertices.Length * sizeof(float) != size)
            {
                throw new ApplicationException("Vertex data not loaded onto graphics card correctly");
            }

            GL.BindBuffer(BufferTarget.ElementArrayBuffer, mVertexBufferObjectIDArray[1]);
            GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(indices.Length * sizeof(uint)), indices, BufferUsageHint.StaticDraw);
            GL.GetBufferParameter(BufferTarget.ElementArrayBuffer, BufferParameterName.BufferSize, out size);

            if (indices.Length * sizeof(uint) != size)
            {
                throw new ApplicationException("Index data not loaded onto graphics card correctly");
            }

            #region Shader Loading Code - Can be ignored for now

            mShader = new ShaderUtility(@"Lab1/Shaders/vSimple.vert", @"Lab1/Shaders/fSimple.frag");

            #endregion

            GL.Enable(EnableCap.CullFace);

            base.OnLoad(e);
        }
Exemplo n.º 23
0
    public void Flip(bool dir)
    {
        //quick setup for if we're changing the core shader before the core itself has done the awake
        if (!renderMat)
        {
            renderMat = GetComponent <Renderer>().material;
        }

        if (dir)
        {
            ShaderUtility.ShaderToLaser(renderMat);
            GetComponent <Transition>().SetStart(1f);
        }
        else
        {
            ShaderUtility.ShaderToReal(renderMat);
            GetComponent <Transition>().SetStart(0f);
        }
    }
Exemplo n.º 24
0
    public bool GetTransitioning()
    {
        if (!mRenderer)
        {
            return(false);
        }

        mRenderer.GetPropertyBlock(_propBlock);
        float currentTransitionState = _propBlock.GetFloat("_TransitionState");

        if (Toolbox.Instance.PlayerInReal() && ShaderUtility.ShaderIsReal(material) && (currentTransitionState < .001f) ||
            Toolbox.Instance.PlayerInLaser() && ShaderUtility.ShaderIsLaser(material) && (currentTransitionState > .999f) ||
            (!ShaderUtility.ShaderIsReal(material) && !ShaderUtility.ShaderIsLaser(material)))
        {
            return(false);
        }

        return(true);
    }
Exemplo n.º 25
0
        private void RefreshShaderKeywords()
        {
            m_GlobalKeywords.Clear();
            for (int iKeyword = 0; iKeyword < UnityEngineReflectionUtility.ShaderKeyword.MAX_SHADER_KEYWORDS; iKeyword++)
            {
                ShaderKeyword iterKeyword = UnityEngineReflectionUtility.ShaderKeyword.NewShaderKeyword(iKeyword);
                string        keywordName = ShaderKeyword.GetGlobalKeywordName(iterKeyword);
                if (!ShaderUtility.IsValidAndUsed(iterKeyword, keywordName))
                {
                    continue;
                }

                KeywordItem keywordItem = new KeywordItem();
                keywordItem.KeywordName = keywordName;
                keywordItem.KeywordType = ShaderKeyword.GetGlobalKeywordType(iterKeyword);
                keywordItem.Enable      = Shader.IsKeywordEnabled(keywordItem.KeywordName);
                keywordItem.Content     = new GUIContent(keywordItem.KeywordName);
                m_GlobalKeywords.Add(keywordItem);
            }
        }
Exemplo n.º 26
0
    public void FlipInternalRenderers(renderersAndProps[] internals, bool dir)
    {
        float currentTransitionState = internals[0].renderer.material.GetFloat("_TransitionState");

        foreach (renderersAndProps r in internals)
        {
            ShaderUtility.ShaderWorldChange(r.renderer.material, dir);
            r.renderer.GetPropertyBlock(r.propertyBlock);

            if (dir)
            {
                r.propertyBlock.SetFloat("_TransitionState", 1f - currentTransitionState);
            }
            else
            {
                r.propertyBlock.SetFloat("_TransitionState", currentTransitionState);
            }

            r.renderer.SetPropertyBlock(r.propertyBlock);
        }
    }
Exemplo n.º 27
0
        public void SimulateFrame(float timestep, ShaderUtility mShader)
        {
            foreach (Ball b in SpatialRegion.OverheadController_AllBalls)
            {
                b.vOldPosition = b.vPosition;
                PositionUpdate(b, timestep);

                CheckFor_SpherePlane_Collision(b);
            }
            SpatialRegion.SpatialPartitioningController();
            foreach (SpatialRegion space in SpatialRegion.AllRegions)
            {
                space.DoCollisionChecks(); //Each Spatial Segment Handles it's own collision detection calls.
            }
            //Remove dead objects from simlation. Go on Garbage Collector, do your thing.
            while (cleanupList.Count > 0)
            {
                cleanupList[0].KillRegions();
                SpatialRegion.OverheadController_AllBalls.Remove(cleanupList[0]);
                cleanupList.Remove(cleanupList[0]);
            }
        }
Exemplo n.º 28
0
        protected override void OnLoad(EventArgs e)
        {
            // Set some GL state
            GL.ClearColor(Color4.Firebrick);
            mTimer.Start();

            string     filepath = @"Lab5/texture.jpg";
            Bitmap     TextureBitmap;
            BitmapData TextureData;

            if (System.IO.File.Exists(filepath))
            {
                TextureBitmap = new Bitmap(filepath);
                TextureBitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
                TextureData = TextureBitmap.LockBits(new System.Drawing.Rectangle(0, 0, TextureBitmap.Width, TextureBitmap.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
            }
            else
            {
                throw new Exception("Could not find file " + filepath);
            }
            int mTexture_ID;

            GL.ActiveTexture(TextureUnit.Texture0);
            GL.GenTextures(1, out mTexture_ID);
            GL.BindTexture(TextureTarget.Texture2D, mTexture_ID);
            GL.TexImage2D(TextureTarget.Texture2D,
                          0, PixelInternalFormat.Rgba, TextureData.Width, TextureData.Height,
                          0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra,
                          PixelType.UnsignedByte, TextureData.Scan0);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
            TextureBitmap.UnlockBits(TextureData);

            Bitmap     TextureBitmap2;
            BitmapData TextureData2;

            filepath = @"Lab5/textureDisolveMap.jpg";
            if (System.IO.File.Exists(filepath))
            {
                TextureBitmap2 = new Bitmap(filepath);
                TextureBitmap2.RotateFlip(RotateFlipType.RotateNoneFlipY);
                TextureData2 = TextureBitmap2.LockBits(new System.Drawing.Rectangle(0, 0, TextureBitmap2.Width, TextureBitmap2.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
            }
            else
            {
                throw new Exception("Could not find file " + filepath);
            }
            int mTexture_ID2;

            GL.ActiveTexture(TextureUnit.Texture1);
            GL.GenTextures(1, out mTexture_ID2);
            GL.BindTexture(TextureTarget.Texture2D, mTexture_ID2);
            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, TextureData2.Width, TextureData2.Height, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, TextureData2.Scan0);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
            TextureBitmap2.UnlockBits(TextureData2);



            float[] vertices = { -0.5f,  -0.5f,  0.0f, 0.0f,
                                 -0.25f, -0.5f, 0.25f,   0f,
                                 0.0f,   -0.5f,  0.5f, 0.0f,
                                 0.25f,  -0.5f, 0.75f,   0f,
                                 0.5f,   -0.5f,    1f,   0f,
                                 -0.5f,   0.0f,  0.0f, 0.5f,
                                 -0.25f,  0.0f, 0.25f, 0.5f,
                                 0.0f,    0.0f,  0.5f, 0.5f,
                                 0.25f,   0.0f, 0.75f, 0.5f,
                                 0.5f,    0.0f,    1f, 0.5f,
                                 -0.5f,   0.5f,    0f,   1f,
                                 -0.25f,  0.5f, 0.25f,   1f,
                                 0.0f,    0.5f,  0.5f,   1f,
                                 0.25f,   0.5f, 0.75f,   1f,
                                 0.5f,    0.5f,    1f, 1f };

            uint[] indices = { 5,  0,  1,
                               5,  1,  6,
                               6,  1,  2,
                               6,  2,  7,
                               7,  2,  3,
                               7,  3,  8,
                               8,  3,  4,
                               8,  4,  9,
                               10, 5,  6,
                               10, 6, 11,
                               11, 6,  7,
                               11, 7, 12,
                               12, 7,  8,
                               12, 8, 13,
                               13, 8,  9,
                               13, 9, 14 };

            GL.Enable(EnableCap.CullFace);

            mShader = new ShaderUtility(@"Lab5/Shaders/vTexture.vert", @"Lab5/Shaders/fTexture.frag");
            GL.UseProgram(mShader.ShaderProgramID);
            int vPositionLocation        = GL.GetAttribLocation(mShader.ShaderProgramID, "vPosition");
            int vTextCoordsLocation      = GL.GetAttribLocation(mShader.ShaderProgramID, "vTexCoords");
            int uTextureSamplerLocation  = GL.GetUniformLocation(mShader.ShaderProgramID, "uTextureSampler");
            int uTextureSamplerLocation2 = GL.GetUniformLocation(mShader.ShaderProgramID, "uTextureSampler2");
            int uThresholdLocation       = GL.GetUniformLocation(mShader.ShaderProgramID, "uThreshold");

            GL.Uniform1(uTextureSamplerLocation, 0);
            GL.Uniform1(uTextureSamplerLocation2, 1);
            GL.Uniform1(uThresholdLocation, 0.5f);

            mVAO_ID = GL.GenVertexArray();
            GL.GenBuffers(mVBO_IDs.Length, mVBO_IDs);

            GL.BindVertexArray(mVAO_ID);
            GL.BindBuffer(BufferTarget.ArrayBuffer, mVBO_IDs[0]);
            GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(vertices.Length * sizeof(float)), vertices, BufferUsageHint.StaticDraw);
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, mVBO_IDs[1]);
            GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(indices.Length * sizeof(uint)), indices, BufferUsageHint.StaticDraw);

            int size;

            GL.GetBufferParameter(BufferTarget.ArrayBuffer, BufferParameterName.BufferSize, out size);
            if (vertices.Length * sizeof(float) != size)
            {
                throw new ApplicationException("Vertex data not loaded onto graphics card correctly");
            }

            GL.GetBufferParameter(BufferTarget.ElementArrayBuffer, BufferParameterName.BufferSize, out size);
            if (indices.Length * sizeof(uint) != size)
            {
                throw new ApplicationException("Index data not loaded onto graphics card correctly");
            }

            GL.EnableVertexAttribArray(vPositionLocation);
            GL.EnableVertexAttribArray(vTextCoordsLocation);
            GL.VertexAttribPointer(vPositionLocation, 2, VertexAttribPointerType.Float, false, 4 * sizeof(float), 0);
            GL.VertexAttribPointer(vTextCoordsLocation, 2, VertexAttribPointerType.Float, false, 4 * sizeof(float), 2 * sizeof(float));


            GL.BindVertexArray(0);

            base.OnLoad(e);
        }
Exemplo n.º 29
0
        protected override void OnLoad(EventArgs e)
        {
            GL.ClearColor(Color4.CadetBlue);



            GL.Enable(EnableCap.DepthTest);
            //L21T5 Added depth by adding an extra vertex parameter, changing the shader variable and linking and enabling depth testing

            //Triangle data
            float[] tVertices = new float[] { -0.8f, 0.8f, 0.4f, 0.8f, 0.2f, 1.0f,
                                              -0.6f, -0.4f, 0.4f, 0.2f, 1.0f, 0.8f,
                                              0.2f, 0.2f, 0.4f, 1.0f, 0.8f, 0.2f };

            uint[] tIndices = new uint[] { 0, 1, 2 };

            //Square data
            float[] sVertices = new float[] { -0.2f, -0.4f, 0.2f, 1.0f, 0.5f, 0.9f,
                                              0.8f, -0.4f, 0.2f, 0.5f, 1.0f, 0.9f,
                                              -0.2f, 0.6f, 0.2f, 0.5f, 0.9f, 1.0f,
                                              0.8f, 0.6f, 0.2f, 0.0f, 0.0f, 0.0f };

            uint[] sIndices = new uint[] { 0, 1, 3, 2 };
            //L21T7 Changed vertex colours to see fragments colour values being blended together

            //Triangle buffers
            GL.GenBuffers(2, mVertexBufferObjectIDArray);
            GL.BindBuffer(BufferTarget.ArrayBuffer, mVertexBufferObjectIDArray[0]);
            GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(tVertices.Length * sizeof(float)), tVertices, BufferUsageHint.StaticDraw);

            int size;

            GL.GetBufferParameter(BufferTarget.ArrayBuffer, BufferParameterName.BufferSize, out size);

            if (tVertices.Length * sizeof(float) != size)
            {
                throw new ApplicationException("Vertex data not loaded onto graphics card correctly");
            }

            GL.BindBuffer(BufferTarget.ElementArrayBuffer, mVertexBufferObjectIDArray[1]);
            GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(tIndices.Length * sizeof(int)), tIndices, BufferUsageHint.StaticDraw);

            GL.GetBufferParameter(BufferTarget.ElementArrayBuffer, BufferParameterName.BufferSize, out size);

            if (tIndices.Length * sizeof(int) != size)
            {
                throw new ApplicationException("Index data not loaded onto graphics card correctly");
            }

            //Square Buffers
            GL.GenBuffers(2, mSquareBufferObjectIDArray);
            GL.BindBuffer(BufferTarget.ArrayBuffer, mSquareBufferObjectIDArray[0]);
            GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(sVertices.Length * sizeof(float)), sVertices, BufferUsageHint.StaticDraw);

            GL.GetBufferParameter(BufferTarget.ArrayBuffer, BufferParameterName.BufferSize, out size);

            if (sVertices.Length * sizeof(float) != size)
            {
                throw new ApplicationException("Vertex data not loaded onto graphics card correctly");
            }

            GL.BindBuffer(BufferTarget.ElementArrayBuffer, mSquareBufferObjectIDArray[1]);
            GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(sIndices.Length * sizeof(int)), sIndices, BufferUsageHint.StaticDraw);

            GL.GetBufferParameter(BufferTarget.ElementArrayBuffer, BufferParameterName.BufferSize, out size);

            if (sIndices.Length * sizeof(int) != size)
            {
                throw new ApplicationException("Index data not loaded onto graphics card correctly");
            }



            #region Shader Loading Code

            mShader = new ShaderUtility(@"Lab2/Shaders/vLab21.vert", @"Lab2/Shaders/fSimple.frag");

            #endregion
            int vColourLocation = GL.GetAttribLocation(mShader.ShaderProgramID, "vColour");
            GL.EnableVertexAttribArray(vColourLocation);
            int vPositionLocation = GL.GetAttribLocation(mShader.ShaderProgramID, "vPosition");
            GL.EnableVertexAttribArray(vPositionLocation);
            //Square buffer binding
            GL.GenVertexArrays(2, mVertexArrayObjectIDs);

            GL.BindVertexArray(mVertexArrayObjectIDs[1]);
            GL.BindBuffer(BufferTarget.ArrayBuffer, mSquareBufferObjectIDArray[0]);
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, mSquareBufferObjectIDArray[1]);
            GL.VertexAttribPointer(vPositionLocation, 3, VertexAttribPointerType.Float, false, 6 *
                                   sizeof(float), 0);
            GL.VertexAttribPointer(vColourLocation, 3, VertexAttribPointerType.Float, false, 6 *
                                   sizeof(float), 3 * sizeof(float));
            GL.EnableVertexAttribArray(vColourLocation);
            GL.EnableVertexAttribArray(vPositionLocation);

            //Triangle buffer binding

            GL.BindVertexArray(mVertexArrayObjectIDs[0]);
            GL.BindBuffer(BufferTarget.ArrayBuffer, mVertexBufferObjectIDArray[0]);
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, mVertexBufferObjectIDArray[1]);
            GL.VertexAttribPointer(vPositionLocation, 3, VertexAttribPointerType.Float, false, 6 *
                                   sizeof(float), 0);
            GL.VertexAttribPointer(vColourLocation, 3, VertexAttribPointerType.Float, false, 6 *
                                   sizeof(float), 3 * sizeof(float));
            GL.EnableVertexAttribArray(vColourLocation);
            GL.EnableVertexAttribArray(vPositionLocation);



            base.OnLoad(e);
        }
Exemplo n.º 30
0
        protected override void OnLoad(EventArgs e)
        {
            GL.ClearColor(Color4.Black);
            //Drawing triforce.

            /*
             *         float[] vertices = new float[] { -0.4f, 0.0f,
             *                                            0.4f, 0.0f,
             *                                            0.0f, 0.6f,
             *                                           -0.8f, -0.6f,
             *                                            0.0f, -0.6f,
             *                                            0.8f, -0.6f };
             *
             *          uint[] indices = new uint[] {0,1,2,0,3,4,1,4,5};
             */
            //Drawing house.

            /*
             * float[] vertices = new float[] { -0.4f, -0.2f,
             *                               -0.4f, -0.6f,
             *                                0.2f, -0.2f,
             *                                0.2f, -0.6f,
             *                               -0.6f, 0.2f,
             *                               -0.6f, -0.6f,
             *                               -0.4f, 0.2f,
             *                               -0.4f, 0.6f,
             *                                0.4f, 0.6f,
             *                                0.4f, 0.2f,
             *                                0.0f, 0.2f,
             *                                0.0f, -0.2f,
             *                                0.4f, -0.2f,
             *                                0.4f, -0.6f,
             *                                0.6f, 0.2f,
             *                                0.6f, -0.6f,
             *                                0.8f, 0.2f,
             *                               -0.8f, 0.2f,
             *                               -0.2f, 0.8f,
             *                               -0.2f, 0.6f,
             *                                0.0f, 0.8f,
             *                                0.0f, 0.6f };
             *
             * uint[] indices = new uint[] { 0, 1, 2, 2, 1, 3, 4, 5, 6, 6, 5, 1, 7, 6, 8, 8, 6, 9, 7, 17, 6, 8, 9, 16, 18, 19, 20, 20, 19, 21, 10, 11, 9, 9, 11, 12, 9, 13, 14, 14, 13, 15 };
             */

            float[] vertices = new float[] { 0.0f, 0.8f,
                                             0.8f, 0.4f,
                                             0.6f, -0.6f,
                                             -0.6f, -0.6f,
                                             -0.8f, 0.4f };

            uint[] indices = new uint[] { 4, 3, 0, 2, 1 };

            GL.GenBuffers(2, mVertexBufferObjectIDArray);

            GL.BindBuffer(BufferTarget.ArrayBuffer, mVertexBufferObjectIDArray[0]);
            GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(vertices.Length * sizeof(float)), vertices, BufferUsageHint.StaticDraw);
            GL.Enable(EnableCap.CullFace);

            int size;

            GL.GetBufferParameter(BufferTarget.ArrayBuffer, BufferParameterName.BufferSize, out size);

            if (vertices.Length * sizeof(float) != size)
            {
                throw new ApplicationException("Vertex data not loaded onto graphics card correctly");
            }

            GL.BindBuffer(BufferTarget.ElementArrayBuffer, mVertexBufferObjectIDArray[1]);
            GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(indices.Length * sizeof(uint)),
                          indices, BufferUsageHint.StaticDraw);
            GL.GetBufferParameter(BufferTarget.ElementArrayBuffer, BufferParameterName.BufferSize, out
                                  size);
            if (indices.Length * sizeof(uint) != size)
            {
                throw new ApplicationException("Index data not loaded onto graphics card correctly");
            }


            #region Shader Loading Code - Can be ignored for now

            mShader = new ShaderUtility(@"Lab1/Shaders/vSimple.vert", @"Lab1/Shaders/fSimple.frag");

            #endregion

            base.OnLoad(e);
        }
 public void OnEnable()
 {
     m_instance				= (target as ShaderUtility);
     m_shaderListProperty	= serializedObject.FindProperty("m_shaderList");
 }