42Ogre::String SGBufferHigh::GetGBufferMaterialPixelOutputStructureTypeNameImpl()
44 return "SO3_GBufferHigh_PixelShaderOutput";
47Ogre::String SGBufferHigh::GetGBufferCompositorPixelInputStructureTypeNameImpl()
49 return "SO3_GBufferHigh_PixelShaderInput";
52Ogre::String SGBufferHigh::GenerateGBufferMaterialPixelOutputStructureImpl()
54 Ogre::StringStream ss;
57 ss <<
"struct SO3_GBufferHigh_PixelShaderOutput : I_GBufferPixelShaderOutput" << std::endl;
58 ss <<
"{" << std::endl;
59 ss <<
" float4 mrt0 : COLOR0; // Diffuse (rgb) + Emissive power (a)" << std::endl;
60 ss <<
" float4 mrt1 : COLOR1; // Specular (rgb) + Shininess power (a)" << std::endl;
61 ss <<
" float4 mrt2 : COLOR2; // Normal (rgb) + Depth (a)" << std::endl;
62 ss <<
" float4 mrt3 : COLOR3; // Velocity (rg) + material id (b). One empty channel for extension (a)." << std::endl;
65 ss <<
" void Reset()" << std::endl;
66 ss <<
" {" << std::endl;
67 ss <<
" mrt0 = float4(0, 0, 0, 0);" << std::endl;
68 ss <<
" mrt1 = float4(0, 0, 0, 0);" << std::endl;
69 ss <<
" mrt2 = float4(0, 0, 0, 0);" << std::endl;
70 ss <<
" mrt3 = float4(0, 0, 0, 0);" << std::endl;
71 ss <<
" }" << std::endl;
74 ss <<
" float3 GetDiffuse()" << std::endl;
75 ss <<
" {" << std::endl;
76 ss <<
" return mrt0.rgb;" << std::endl;
77 ss <<
" }" << std::endl;
80 ss <<
" void SetDiffuse(in float3 diffuse)" << std::endl;
81 ss <<
" {" << std::endl;
82 ss <<
" mrt0.rgb = diffuse;" << std::endl;
83 ss <<
" }" << std::endl;
86 ss <<
" float3 GetSpecular()" << std::endl;
87 ss <<
" {" << std::endl;
88 ss <<
" return mrt1.rgb;" << std::endl;
89 ss <<
" }" << std::endl;
92 ss <<
" void SetSpecular(in float3 specular)" << std::endl;
93 ss <<
" {" << std::endl;
94 ss <<
" mrt1.rgb = specular;" << std::endl;
95 ss <<
" }" << std::endl;
98 ss <<
" float GetShininess()" << std::endl;
99 ss <<
" {" << std::endl;
100 ss <<
" return mrt1.a;" << std::endl;
101 ss <<
" }" << std::endl;
104 ss <<
" void SetShininess(in float shininess)" << std::endl;
105 ss <<
" {" << std::endl;
106 ss <<
" mrt1.a = shininess;" << std::endl;
107 ss <<
" }" << std::endl;
110 ss <<
" float3 GetNormal()" << std::endl;
111 ss <<
" {" << std::endl;
112 ss <<
" return mrt2.rgb;" << std::endl;
113 ss <<
" }" << std::endl;
116 ss <<
" void SetNormal(in float3 normal)" << std::endl;
117 ss <<
" {" << std::endl;
118 ss <<
" mrt2.rgb = normal;" << std::endl;
119 ss <<
" }" << std::endl;
122 ss <<
" float GetDepth()" << std::endl;
123 ss <<
" {" << std::endl;
124 ss <<
" return mrt2.a;" << std::endl;
125 ss <<
" }" << std::endl;
128 ss <<
" void SetDepth(in float depth)" << std::endl;
129 ss <<
" {" << std::endl;
130 ss <<
" mrt2.a = depth;" << std::endl;
131 ss <<
" }" << std::endl;
134 ss <<
" float GetEmissive()" << std::endl;
135 ss <<
" {" << std::endl;
136 ss <<
" return mrt0.a;" << std::endl;
137 ss <<
" }" << std::endl;
140 ss <<
" void SetEmissive(in float emissive)" << std::endl;
141 ss <<
" {" << std::endl;
142 ss <<
" mrt0.a = emissive;" << std::endl;
143 ss <<
" }" << std::endl;
146 ss <<
" float GetMaterialID()" << std::endl;
147 ss <<
" {" << std::endl;
148 ss <<
" return mrt3.b;" << std::endl;
149 ss <<
" }" << std::endl;
152 ss <<
" void SetMaterialID(in float materialId)" << std::endl;
153 ss <<
" {" << std::endl;
154 ss <<
" mrt3.b = materialId;" << std::endl;
155 ss <<
" }" << std::endl;
158 ss <<
" float2 GetVelocity()" << std::endl;
159 ss <<
" {" << std::endl;
160 ss <<
" return mrt3.rg;" << std::endl;
161 ss <<
" }" << std::endl;
164 ss <<
" void SetVelocity(in float2 velocity)" << std::endl;
165 ss <<
" {" << std::endl;
166 ss <<
" mrt3.rg = velocity;" << std::endl;
167 ss <<
" }" << std::endl;
168 ss <<
"};" << std::endl;
174Ogre::String SGBufferHigh::GenerateGBufferCompositorPixelInputStructureImpl()
176 Ogre::StringStream ss;
179 ss <<
"struct SO3_GBufferHigh_PixelShaderInput : I_GBufferPixelShaderInput" << std::endl;
180 ss <<
"{" << std::endl;
181 ss <<
" uniform sampler2D mrt0 : register(s0); // Diffuse (rgb) + Emissive power (a)" << std::endl;
182 ss <<
" uniform sampler2D mrt1 : register(s1); // Specular (rgb) + Shininess power (a)" << std::endl;
183 ss <<
" uniform sampler2D mrt2 : register(s2); // Normal (rgb) + Depth (a)" << std::endl;
184 ss <<
" uniform sampler2D mrt3 : register(s3); // Velocity (rg) + material id (b). One empty channel for extension (a)" << std::endl;
187 ss <<
" float3 GetDiffuse(in float2 coordinate)" << std::endl;
188 ss <<
" {" << std::endl;
189 ss <<
" return tex2D(mrt0, coordinate).rgb;" << std::endl;
190 ss <<
" }" << std::endl;
193 ss <<
" float3 GetSpecular(in float2 coordinate)" << std::endl;
194 ss <<
" {" << std::endl;
195 ss <<
" return tex2D(mrt1, coordinate).rgb;" << std::endl;
196 ss <<
" }" << std::endl;
199 ss <<
" float GetShininess(in float2 coordinate)" << std::endl;
200 ss <<
" {" << std::endl;
201 ss <<
" return tex2D(mrt1, coordinate).a;" << std::endl;
202 ss <<
" }" << std::endl;
205 ss <<
" float3 GetNormal(in float2 coordinate)" << std::endl;
206 ss <<
" {" << std::endl;
207 ss <<
" return tex2D(mrt2, coordinate).rgb;" << std::endl;
208 ss <<
" }" << std::endl;
211 ss <<
" float GetDepth(in float2 coordinate)" << std::endl;
212 ss <<
" {" << std::endl;
213 ss <<
" return tex2D(mrt2, coordinate).a;" << std::endl;
214 ss <<
" }" << std::endl;
217 ss <<
" float GetEmissive(in float2 coordinate)" << std::endl;
218 ss <<
" {" << std::endl;
219 ss <<
" return tex2D(mrt0, coordinate).a;" << std::endl;
220 ss <<
" }" << std::endl;
223 ss <<
" float GetMaterialID(in float2 coordinate)" << std::endl;
224 ss <<
" {" << std::endl;
225 ss <<
" return tex2D(mrt3, coordinate).b;" << std::endl;
226 ss <<
" }" << std::endl;
229 ss <<
" float2 GetVelocity(in float2 coordinate)" << std::endl;
230 ss <<
" {" << std::endl;
231 ss <<
" return tex2D(mrt3, coordinate).rg;" << std::endl;
232 ss <<
" }" << std::endl;
233 ss <<
"};" << std::endl;
@ SO3_GBUFFER_MATERIAL_ID