__forceinline void SetFogColor(float4 v) { FUNCLOG SetShaderCaller("SetFogColor"); ZZshSetParameter4fv(g_fparamFogColor, v, "g_fParamFogColor"); }
// used for transformation from vertex position in GS window.coords (I hope) // to view coordinates (in range 0, 1). float4 CRenderTarget::DefaultBitBltPos() { float4 v = float4(1, -1, 0.5f / (float)RW(fbw), 0.5f / (float)RH(fbh)); v *= 1.0f / 32767.0f; ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltPos, v, "g_sBitBltPos"); return v; }
// Used to transform texture coordinates from GS (when 0,0 is upper left) to // OpenGL (0,0 - lower left). float4 CRenderTarget::DefaultBitBltTex() { // I really sure that -0.5 is correct, because OpenGL have no half-offset // issue, DirectX known for. float4 v = float4(1, -1, 0.5f / (float)RW(fbw), -0.5f / (float)RH(fbh)); ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltTex, v, "g_sBitBltTex"); return v; }
void CRenderTarget::SetTarget(int fbplocal, const Rect2& scissor, int context) { FUNCLOG int dy = 0; if (fbplocal != fbp) { float4 v; // will be rendering to a subregion u32 bpp = PSMT_ISHALF(psm) ? 2 : 4; assert(((256 / bpp)*(fbplocal - fbp)) % fbw == 0); assert(fbplocal >= fbp); dy = ((256 / bpp) * (fbplocal - fbp)) / fbw; v.x = vposxy.x; v.y = vposxy.y; v.z = vposxy.z; v.w = vposxy.w - dy * 2.0f / (float)fbh; ZZshSetParameter4fv(g_vparamPosXY[context], v, "g_fPosXY"); } else { ZZshSetParameter4fv(g_vparamPosXY[context], vposxy, "g_fPosXY"); } // set render states // Bleh. I *really* need to fix this. << 3 when setting the scissors, then >> 3 when using them... --Arcum42 scissorrect.x = scissor.x0 >> 3; scissorrect.y = (scissor.y0 >> 3) + dy; scissorrect.w = (scissor.x1 >> 3) + 1; scissorrect.h = (scissor.y1 >> 3) + 1 + dy; scissorrect.w = min(scissorrect.w, fbw) - scissorrect.x; scissorrect.h = min(scissorrect.h, fbh) - scissorrect.y; scissorrect.x = RW(scissorrect.x); scissorrect.y = RH(scissorrect.y); scissorrect.w = RW(scissorrect.w); scissorrect.h = RH(scissorrect.h); }
// The same stuff, but also with retry of param, name should be USED name of param for prog. void ZZshSetParameter4fvWithRetry(ZZshParameter* param, ZZshShaderLink& prog, const float* v, const char* name) { ZZshSetParameter4fv(prog, *param, v, name); }
// Used sometimes for color 1. void ZZshDefaultOneColor( FRAGMENTSHADER& ptr ) { // return; ShaderHandleName = "Set Default One colot"; float4 v = float4 ( 1, 1, 1, 1 ); ZZshSetParameter4fv(ptr.prog, ptr.sOneColor, v, "DegaultOne"); }
// The same stuff, but also with retry of param, name should be USED name of param for prog. void ZZshSetParameter4fvWithRetry(ZZshParameter* param, ZZshProgram& prog, const float* v, const char* name) { if (param != NULL) ZZshSetParameter4fv(prog, param[0], v, name); else ZZshSetParameter4fv(prog, cgGetNamedParameter(prog, name), v, name); }