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; }
public override void SetParameter(BillboardRenderParameter p) { var param = p as ToneMappingRenderParameter; if (param == null) { return; } RenderParam = param; }
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; }
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; }
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; }
public void Render(BillboardRenderParameter param) { var renderer = BillboardRendererFactoryXna.Instance.Create(param); renderer.Render(); }
public void RenderBillboard(IBillboard primitive, BillboardRenderParameter renderParam) { BillboardInfoList[Buffer].Add(new BillboardInfo() { Billboard = primitive, RenderParam = renderParam }); }
public void SetParameter(BillboardRenderParameter p) { }