예제 #1
0
        // --------------------------------------------------------------------

        private void PrepareMaterials(Scene scene, UBO <CameraUBufferData> camUBO, UBO <LightingUBufferData> lightUBO)
        {
            HashSet <Material> materials = GetMaterialsFromRenderers(scene);

            // TODO - improve this so we only check a template once!
            foreach (EntityRenderer er in scene.RenderData.EntityRenderers)
            {
                if (!er.SceneObject.Active)
                {
                    return;
                }

                foreach (MeshRenderer mr in er.Renderers)
                {
                    if (!mr.SceneObject.Active)
                    {
                        return;
                    }
                    materials.Add(mr.Material);
                }
            }

            foreach (Material m in materials)
            {
                if (m == null)
                {
                    return;
                }

                m.Shader.BindUBO(camUBO);
                m.Shader.BindUBO(lightUBO);
            }
        }
예제 #2
0
 public Camera(string id, float near = 0.1f, float far = 1000) : base(id)
 {
     Near         = near;
     Far          = far;
     mUBufferData = new CameraUBufferData();
     mCameraUBO   = new UBO <CameraUBufferData>(mUBufferData, "CameraData");
 }
예제 #3
0
        // --------------------------------------------------------------------

        public override void Dispose()
        {
            base.Dispose();

            mCameraUBO.Dispose();
            mCameraUBO = null;
        }
예제 #4
0
        // --------------------------------------------------------------------

        public Lighting()
        {
            mUBufferData.PointLight       = new LightUBufferData[8];
            mUBufferData.SpotLight        = new LightUBufferData[8];
            mUBufferData.DirectionalLight = new LightUBufferData[2];

            mLightingUBO = new UBO <LightingUBufferData>(mUBufferData, "LightingData");
        }
예제 #5
0
        public void BindUBO(UBO ubo)
        {
            int idx = GL.GetUniformBlockIndex(Program, ubo.BlockName);

            GL.UniformBlockBinding(Program, idx, ubo.BindingPoint);
        }
예제 #6
0
        // --------------------------------------------------------------------

        public void Dispose()
        {
            mLightingUBO.Dispose();
            mLightingUBO = null;
        }
예제 #7
0
 public void Dispose()
 {
     mSkyUBO.Dispose();
     mSkyUBO = null;
 }
예제 #8
0
 public Sky()
 {
     mSkyUBO = new UBO <SkyUBufferData>(mUBufferData, "SkyData");
 }