示例#1
0
        public override void SetParameter(BillboardRenderParameter p)
        {
            var param = p as DirectionalLightRenderParameter;
            if (param == null)
            {
                return;
            }

            Shader.World = MathUtilXna.ToXnaMatrix(Matrix.Identity);
            Shader.View = MathUtilXna.ToXnaMatrix(param.Camera.View);   // Viewの逆行列が必要になる
            Shader.Projection = MathUtilXna.ToXnaMatrix(GetScreenProjectionMatrix());

            Shader.DirectionalLightDirection = MathUtilXna.ToXnaVector(param.DirectionalLight.Direction);
            Shader.DirectionalLightColor = MathUtilXna.ToXnaVector(param.DirectionalLight.Color.ToVector3());

            Shader.EyePosition = MathUtilXna.ToXnaVector(param.Camera.Eye);

            if (param.Camera is PerspectiveCamera)
            {
                var perspectiveCamera = param.Camera as PerspectiveCamera;

                var nearPlaneSize = new Vector2();

                nearPlaneSize.Y = param.Camera.Near * MathUtil.Tan(MathUtil.ToRadians(perspectiveCamera.FovY / 2.0f));
                nearPlaneSize.X = nearPlaneSize.Y * perspectiveCamera.Aspect;

                Shader.NearPlaneSize = MathUtilXna.ToXnaVector(nearPlaneSize);
            }
            Shader.Near = param.Camera.Near;
            Shader.Far = param.Camera.Far;

            Shader.NormalMap = (param.NormalMap as ITextureXna).Texture;
            Shader.DepthMap = (param.DepthMap as ITextureXna).Texture;
        }
示例#2
0
        public override void SetParameter(BillboardRenderParameter p)
        {
            var param = p as ToneMappingRenderParameter;
            if (param == null)
            {
                return;
            }

            RenderParam = param;
        }
示例#3
0
        public void SetParameter(BillboardRenderParameter p)
        {
            var param = p as SimpleBillboardRenderParameter;
            if (param == null)
            {
                return;
            }

            ConstantShader.World = MathUtilXna.ToXnaMatrix(CalcWorldMatrix(param.AffineTransform, param.Camera));
            
            ConstantShader.View = MathUtilXna.ToXnaMatrix(param.Camera.View);
            ConstantShader.Projection = MathUtilXna.ToXnaMatrix(param.Camera.Projection);
            ConstantShader.Alpha = param.Alpha;
            ConstantShader.Texture = (param.Texture as ITextureXna).Texture;
        }
示例#4
0
        public void SetParameter(BillboardRenderParameter p)
        {
            var param = p as HudBillboardRenderParameter;
            if (param == null)
            {
                return;
            }

            Shader.Texture = (param.Texture as ITextureXna).Texture;
            Shader.RectOffset = MathUtilXna.ToXnaVector(param.RectOffset);
            Shader.RectSize = MathUtilXna.ToXnaVector(param.RectSize);
            Shader.World = MathUtilXna.ToXnaMatrix(param.Transform);
            Shader.View = MathUtilXna.ToXnaMatrix(GetViewMatrix());
            Shader.Projection = MathUtilXna.ToXnaMatrix(GetProjMatrix());
            Shader.Alpha = param.Alpha;
        }
示例#5
0
        public override void SetParameter(BillboardRenderParameter p)
        {
            var param = p as DeferredBillboardRenderParameter;
            if (param == null)
            {
                return;
            }

            Shader.World = MathUtilXna.ToXnaMatrix(Matrix.Identity);
            Shader.View = MathUtilXna.ToXnaMatrix(Matrix.Identity);
            Shader.Projection = MathUtilXna.ToXnaMatrix(GetScreenProjectionMatrix());

            Shader.DirLight0Direction = MathUtilXna.ToXnaVector(param.DirectionalLight.Direction);
            Shader.DirLight0DiffuseColor = MathUtilXna.ToXnaVector(param.DirectionalLight.Color.ToVector3());

            Shader.AlbedoMap = (param.AlbedoMap as ITextureXna).Texture;
            Shader.PositionMap = (param.PositionMap as ITextureXna).Texture;
            Shader.NormalDepthMap = (param.NormalDepthMap as ITextureXna).Texture;
        }
示例#6
0
 public void Render(BillboardRenderParameter param)
 {
     var renderer = BillboardRendererFactoryXna.Instance.Create(param);
     renderer.Render();
 }
示例#7
0
 public void RenderBillboard(IBillboard primitive, BillboardRenderParameter renderParam)
 {
     BillboardInfoList[Buffer].Add(new BillboardInfo() { Billboard = primitive, RenderParam = renderParam });
 }
示例#8
0
 public void SetParameter(BillboardRenderParameter p)
 {
 }