mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
Added cardcenter
This commit is contained in:
parent
907dbec68b
commit
7e1df6e67c
@ -351,7 +351,7 @@ unbind()
|
||||
void CLP(ShaderContext)::
|
||||
issue_cg_auto_bind(const ShaderAutoBind &bind, GSG *gsg)
|
||||
{
|
||||
LVecBase4f t;
|
||||
LVecBase4f t; float xhi,yhi; int px,py;
|
||||
|
||||
CGparameter p = bind.parameter;
|
||||
switch(bind.value) {
|
||||
@ -387,6 +387,17 @@ issue_cg_auto_bind(const ShaderAutoBind &bind, GSG *gsg)
|
||||
t[3] = 1;
|
||||
cgGLSetParameter4fv(p, t.get_data());
|
||||
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
|
||||
@ -1118,6 +1129,14 @@ compile_cg_parameter(CGparameter p)
|
||||
_cg_auto_param.push_back(bind);
|
||||
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");
|
||||
return false;
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ private:
|
||||
// From this point forward, it's okay to insert stuff.
|
||||
SIC_sys_windowsize,
|
||||
SIC_sys_pixelsize,
|
||||
SIC_sys_cardcenter,
|
||||
};
|
||||
struct ShaderAutoBind {
|
||||
CGparameter parameter;
|
||||
|
Loading…
x
Reference in New Issue
Block a user