示例#1
0
 public SceneEntity(Mesh mesh, Transform transform, BaseMaterial material)
 {
     Children = new List<SceneEntity>();
     Mesh = mesh;
     Transform = transform;
     Material = material;
 }
示例#2
0
        public void SetUniforms(Camera camera, Light light, Matrix4 model, BaseMaterial material)
        {
            //Matrix uniforms
            SetUniform("mvpMat", model * camera.ViewMatrix * camera.ProjectionMatrix);
            SetUniform("mvMat", model * camera.ViewMatrix);
            SetUniform("normalMat", Matrix4.Transpose(Matrix4.Invert(model)));

            //Light uniforms
            if (light != null)
            {
                if (light is PointLight)
                {
                    SetUniform("light.position", ((PointLight)light).Position);
                }

                SetUniform("light.diffuse", light.Diffuse);
                SetUniform("light.ambient", light.Ambient);
                SetUniform("light.specular", light.Specular);
            }

            //Material uniforms
            SetUniform("material.diffuse", material.Diffuse);
            SetUniform("material.ambient", material.Ambient);
            SetUniform("material.specular", material.Specular);
            SetUniform("material.emissive", material.Emissive);
        }