|
@@ -351,7 +351,7 @@ unbind()
|
|
|
void CLP(ShaderContext)::
|
|
void CLP(ShaderContext)::
|
|
|
issue_cg_auto_bind(const ShaderAutoBind &bind, GSG *gsg)
|
|
issue_cg_auto_bind(const ShaderAutoBind &bind, GSG *gsg)
|
|
|
{
|
|
{
|
|
|
- LVecBase4f t;
|
|
|
|
|
|
|
+ LVecBase4f t; float xhi,yhi; int px,py;
|
|
|
|
|
|
|
|
CGparameter p = bind.parameter;
|
|
CGparameter p = bind.parameter;
|
|
|
switch(bind.value) {
|
|
switch(bind.value) {
|
|
@@ -387,6 +387,17 @@ issue_cg_auto_bind(const ShaderAutoBind &bind, GSG *gsg)
|
|
|
t[3] = 1;
|
|
t[3] = 1;
|
|
|
cgGLSetParameter4fv(p, t.get_data());
|
|
cgGLSetParameter4fv(p, t.get_data());
|
|
|
return;
|
|
return;
|
|
|
|
|
+ case SIC_sys_cardcenter:
|
|
|
|
|
+ px = gsg->_current_display_region->get_pixel_width();
|
|
|
|
|
+ py = gsg->_current_display_region->get_pixel_height();
|
|
|
|
|
+ xhi = (px*1.0) / Texture::up_to_power_2(px);
|
|
|
|
|
+ yhi = (py*1.0) / Texture::up_to_power_2(py);
|
|
|
|
|
+ t[0] = xhi*0.5;
|
|
|
|
|
+ t[1] = yhi*0.5;
|
|
|
|
|
+ t[2] = 1;
|
|
|
|
|
+ t[3] = 1;
|
|
|
|
|
+ cgGLSetParameter4fv(p, t.get_data());
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
#endif
|
|
#endif
|
|
@@ -1118,6 +1129,14 @@ compile_cg_parameter(CGparameter p)
|
|
|
_cg_auto_param.push_back(bind);
|
|
_cg_auto_param.push_back(bind);
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
+ if (pieces[1] == "cardcenter") {
|
|
|
|
|
+ if (!errchk_cg_parameter_type(p, CG_FLOAT2)) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ bind.value = SIC_sys_cardcenter;
|
|
|
|
|
+ _cg_auto_param.push_back(bind);
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
errchk_cg_output(p,"unknown system parameter");
|
|
errchk_cg_output(p,"unknown system parameter");
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|