Exemplo n.º 1
0
 public CameraParameters(IUniformBuffer bufferGL /*, IUniformBuffer bufferRL*/)
 {
     NearFar             = new MultiFloats(CameraUniformBlock.NearFar, new Floats(4, 1), bufferGL /*, bufferRL*/);
     FovXFovYAspect      = new MultiFloats(CameraUniformBlock.FovXFovYAspect, new Floats(4, 1), bufferGL /*, bufferRL*/);
     Viewport            = new MultiFloats(CameraUniformBlock.Viewport, new Floats(4, 1), bufferGL /*, bufferRL*/);
     WorldToClip         = new MultiFloats(CameraUniformBlock.WorldToClip, new Floats(16, 1), bufferGL /*, bufferRL*/);
     ClipToWorld         = new MultiFloats(CameraUniformBlock.ClipToWorld, new Floats(16, 1), bufferGL /*, bufferRL*/);
     ViewToWorld         = new MultiFloats(CameraUniformBlock.ViewToWorld, new Floats(16, 1), bufferGL /*, bufferRL*/);
     WorldToView         = new MultiFloats(CameraUniformBlock.WorldToView, new Floats(16, 1), bufferGL /*, bufferRL*/);
     ViewToClip          = new MultiFloats(CameraUniformBlock.ViewToClip, new Floats(16, 1), bufferGL /*, bufferRL*/);
     ClipToView          = new MultiFloats(CameraUniformBlock.ClipToView, new Floats(16, 1), bufferGL /*, bufferRL*/);
     ViewPositionInWorld = new MultiFloats(CameraUniformBlock.ViewPositionInWorld, new Floats(4, 1), bufferGL /*, bufferRL*/);
 }
Exemplo n.º 2
0
        //public static UniformBufferRL   UniformBufferRL;

        public static void Initialize(
            string blockName,
            int maxLightCount
            )
        {
            UniformBlockGL = new UniformBlockGL(blockName);
            UniformBlockGL.AddInt(spec.Count);
            UniformBlockGL.AddVec4(spec.Exposure);
            UniformBlockGL.AddVec4(spec.Bias);
            UniformBlockGL.AddVec4(spec.AmbientLightColor);
            UniformBlockGL.AddVec4(spec.Color, maxLightCount);
            UniformBlockGL.AddVec4(spec.Direction, maxLightCount);
            UniformBlockGL.AddMat4(spec.WorldToLight, maxLightCount);
            UniformBlockGL.AddMat4(spec.WorldToShadow, maxLightCount);
            UniformBlockGL.Seal();
            var bufferGL = UniformBufferGL = new UniformBufferGL(UniformBlockGL);

#if false
            IUniformBuffer bufferRL = null;
            if (Configuration.useOpenRL)
            {
                UniformBlockRL = new UniformBlockRL(blockName);
                UniformBlockRL.AddInt(spec.Count);
                UniformBlockRL.AddVec4(spec.Exposure);
                UniformBlockRL.AddVec4(spec.Bias);
                UniformBlockRL.AddVec4(spec.AmbientLightColor);
                UniformBlockRL.AddVec4(spec.Color, maxLightCount);
                UniformBlockRL.AddVec4(spec.Direction, maxLightCount);
                UniformBlockRL.AddMat4(spec.WorldToLight, maxLightCount);
                UniformBlockRL.AddMat4(spec.WorldToShadow, maxLightCount);
                UniformBlockRL.Seal();
                UniformBufferRL = new UniformBufferRL(UniformBlockRL);
            }
#endif

            Count             = new MultiInts(spec.Count, new Ints(1, 1), bufferGL /*bufferRL*/);
            Exposure          = new MultiFloats(spec.Exposure, new Floats(4, 1), bufferGL /*bufferRL*/);
            Bias              = new MultiFloats(spec.Bias, new Floats(4, 1), bufferGL /*bufferRL*/);
            AmbientLightColor = new MultiFloats(spec.AmbientLightColor, new Floats(4, 1), bufferGL /*bufferRL*/);
            WorldToLight      = new MultiFloats(spec.WorldToLight, new Floats(16, maxLightCount), bufferGL /*bufferRL*/);
            WorldToShadow     = new MultiFloats(spec.WorldToShadow, new Floats(16, maxLightCount), bufferGL /*bufferRL*/);
            Direction         = new MultiFloats(spec.Direction, new Floats(4, maxLightCount), bufferGL /*bufferRL*/);
            Color             = new MultiFloats(spec.Color, new Floats(4, maxLightCount), bufferGL /*bufferRL*/);
        }