mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
Merge branch 'master' of github.com:panda3d/panda3d
This commit is contained in:
commit
8998fef903
@ -936,13 +936,13 @@ fetch_specified_value(Shader::ShaderMatSpec &spec, int altered) {
|
|||||||
LVecBase3 v;
|
LVecBase3 v;
|
||||||
|
|
||||||
if (altered & spec._dep[0]) {
|
if (altered & spec._dep[0]) {
|
||||||
const LMatrix4 *t = fetch_specified_part(spec._part[0], spec._arg[0], spec._cache[0]);
|
const LMatrix4 *t = fetch_specified_part(spec._part[0], spec._arg[0], spec._cache[0], spec._index);
|
||||||
if (t != &spec._cache[0]) {
|
if (t != &spec._cache[0]) {
|
||||||
spec._cache[0] = *t;
|
spec._cache[0] = *t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (altered & spec._dep[1]) {
|
if (altered & spec._dep[1]) {
|
||||||
const LMatrix4 *t = fetch_specified_part(spec._part[1], spec._arg[1], spec._cache[1]);
|
const LMatrix4 *t = fetch_specified_part(spec._part[1], spec._arg[1], spec._cache[1], spec._index);
|
||||||
if (t != &spec._cache[1]) {
|
if (t != &spec._cache[1]) {
|
||||||
spec._cache[1] = *t;
|
spec._cache[1] = *t;
|
||||||
}
|
}
|
||||||
@ -987,8 +987,9 @@ fetch_specified_value(Shader::ShaderMatSpec &spec, int altered) {
|
|||||||
// Description: See fetch_specified_value
|
// Description: See fetch_specified_value
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
const LMatrix4 *GraphicsStateGuardian::
|
const LMatrix4 *GraphicsStateGuardian::
|
||||||
fetch_specified_part(Shader::ShaderMatInput part, InternalName *name, LMatrix4 &t) {
|
fetch_specified_part(Shader::ShaderMatInput part, InternalName *name,
|
||||||
switch(part) {
|
LMatrix4 &t, int index) {
|
||||||
|
switch (part) {
|
||||||
case Shader::SMO_identity: {
|
case Shader::SMO_identity: {
|
||||||
return &LMatrix4::ident_mat();
|
return &LMatrix4::ident_mat();
|
||||||
}
|
}
|
||||||
@ -1223,6 +1224,25 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name, LMatrix4 &
|
|||||||
t = LMatrix4(0,0,0,0,0,0,0,0,0,0,0,0,p[0],p[1],p[2],p[3]);
|
t = LMatrix4(0,0,0,0,0,0,0,0,0,0,0,0,p[0],p[1],p[2],p[3]);
|
||||||
return &t;
|
return &t;
|
||||||
}
|
}
|
||||||
|
case Shader::SMO_apiview_clipplane_i: {
|
||||||
|
const ClipPlaneAttrib *cpa = DCAST(ClipPlaneAttrib, _target_rs->get_attrib_def(ClipPlaneAttrib::get_class_slot()));
|
||||||
|
if (index >= cpa->get_num_on_planes()) {
|
||||||
|
return &LMatrix4::zeros_mat();
|
||||||
|
}
|
||||||
|
|
||||||
|
const NodePath &plane = cpa->get_on_plane(index);
|
||||||
|
nassertr(!plane.is_empty(), &LMatrix4::zeros_mat());
|
||||||
|
const PlaneNode *plane_node;
|
||||||
|
DCAST_INTO_R(plane_node, plane.node(), &LMatrix4::zeros_mat());
|
||||||
|
|
||||||
|
CPT(TransformState) transform =
|
||||||
|
get_scene()->get_cs_world_transform()->compose(
|
||||||
|
plane.get_transform(_scene_setup->get_scene_root().get_parent()));
|
||||||
|
|
||||||
|
LPlane xformed_plane = plane_node->get_plane() * transform->get_mat();
|
||||||
|
t.set_row(3, xformed_plane);
|
||||||
|
return &t;
|
||||||
|
}
|
||||||
case Shader::SMO_mat_constant_x: {
|
case Shader::SMO_mat_constant_x: {
|
||||||
return &_target_shader->get_shader_input_matrix(name, t);
|
return &_target_shader->get_shader_input_matrix(name, t);
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,8 @@ public:
|
|||||||
virtual void clear(DrawableRegion *clearable);
|
virtual void clear(DrawableRegion *clearable);
|
||||||
|
|
||||||
const LMatrix4 *fetch_specified_value(Shader::ShaderMatSpec &spec, int altered);
|
const LMatrix4 *fetch_specified_value(Shader::ShaderMatSpec &spec, int altered);
|
||||||
const LMatrix4 *fetch_specified_part(Shader::ShaderMatInput input, InternalName *name, LMatrix4 &t);
|
const LMatrix4 *fetch_specified_part(Shader::ShaderMatInput input, InternalName *name,
|
||||||
|
LMatrix4 &t, int index);
|
||||||
const Shader::ShaderPtrData *fetch_ptr_parameter(const Shader::ShaderPtrSpec& spec);
|
const Shader::ShaderPtrData *fetch_ptr_parameter(const Shader::ShaderPtrSpec& spec);
|
||||||
|
|
||||||
virtual void prepare_display_region(DisplayRegionPipelineReader *dr);
|
virtual void prepare_display_region(DisplayRegionPipelineReader *dr);
|
||||||
|
@ -8811,6 +8811,11 @@ set_state_and_transform(const RenderState *target,
|
|||||||
//PStatGPUTimer timer(this, _draw_set_state_clip_plane_pcollector);
|
//PStatGPUTimer timer(this, _draw_set_state_clip_plane_pcollector);
|
||||||
do_issue_clip_plane();
|
do_issue_clip_plane();
|
||||||
_state_mask.set_bit(clip_plane_slot);
|
_state_mask.set_bit(clip_plane_slot);
|
||||||
|
#ifndef OPENGLES_1
|
||||||
|
if (_current_shader_context) {
|
||||||
|
_current_shader_context->issue_parameters(Shader::SSD_clip_planes);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int color_slot = ColorAttrib::get_class_slot();
|
int color_slot = ColorAttrib::get_class_slot();
|
||||||
|
@ -412,6 +412,25 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext
|
|||||||
s->_mat_spec.push_back(bind);
|
s->_mat_spec.push_back(bind);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (noprefix == "ClipPlane") {
|
||||||
|
for (int i = 0; i < param_size; ++i) {
|
||||||
|
Shader::ShaderMatSpec bind;
|
||||||
|
bind._id = arg_id;
|
||||||
|
bind._id._seqno = seqno++;
|
||||||
|
bind._piece = Shader::SMP_row3;
|
||||||
|
bind._func = Shader::SMF_first;
|
||||||
|
bind._index = i;
|
||||||
|
bind._part[0] = Shader::SMO_apiview_clipplane_i;
|
||||||
|
bind._arg[0] = NULL;
|
||||||
|
bind._dep[0] = Shader::SSD_general | Shader::SSD_clip_planes;
|
||||||
|
bind._part[1] = Shader::SMO_identity;
|
||||||
|
bind._arg[1] = NULL;
|
||||||
|
bind._dep[1] = Shader::SSD_NONE;
|
||||||
|
s->_mat_spec.push_back(bind);
|
||||||
|
_glsl_parameter_map.push_back(p + i);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (noprefix == "LightModel.ambient") {
|
if (noprefix == "LightModel.ambient") {
|
||||||
Shader::ShaderMatSpec bind;
|
Shader::ShaderMatSpec bind;
|
||||||
bind._id = arg_id;
|
bind._id = arg_id;
|
||||||
|
@ -424,7 +424,6 @@ cp_dependency(ShaderMatInput inp) {
|
|||||||
(inp == SMO_mat_constant_x) ||
|
(inp == SMO_mat_constant_x) ||
|
||||||
(inp == SMO_vec_constant_x) ||
|
(inp == SMO_vec_constant_x) ||
|
||||||
(inp == SMO_vec_constant_x_attrib) ||
|
(inp == SMO_vec_constant_x_attrib) ||
|
||||||
(inp == SMO_clipplane_x) ||
|
|
||||||
(inp == SMO_view_x_to_view) ||
|
(inp == SMO_view_x_to_view) ||
|
||||||
(inp == SMO_view_to_view_x) ||
|
(inp == SMO_view_to_view_x) ||
|
||||||
(inp == SMO_apiview_x_to_view) ||
|
(inp == SMO_apiview_x_to_view) ||
|
||||||
@ -444,6 +443,10 @@ cp_dependency(ShaderMatInput inp) {
|
|||||||
(inp == SMO_light_product_i_specular)) {
|
(inp == SMO_light_product_i_specular)) {
|
||||||
dep |= (SSD_light | SSD_material);
|
dep |= (SSD_light | SSD_material);
|
||||||
}
|
}
|
||||||
|
if ((inp == SMO_clipplane_x) ||
|
||||||
|
(inp == SMO_apiview_clipplane_i)) {
|
||||||
|
dep |= SSD_clip_planes;
|
||||||
|
}
|
||||||
|
|
||||||
return dep;
|
return dep;
|
||||||
}
|
}
|
||||||
|
@ -183,6 +183,9 @@ public:
|
|||||||
SMO_light_product_i_diffuse,
|
SMO_light_product_i_diffuse,
|
||||||
SMO_light_product_i_specular,
|
SMO_light_product_i_specular,
|
||||||
|
|
||||||
|
// SMO_clipplane_x is world coords, GLSL needs eye coords
|
||||||
|
SMO_apiview_clipplane_i,
|
||||||
|
|
||||||
SMO_INVALID
|
SMO_INVALID
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -261,6 +264,7 @@ public:
|
|||||||
SSD_shaderinputs = 0x020,
|
SSD_shaderinputs = 0x020,
|
||||||
SSD_fog = 0x040,
|
SSD_fog = 0x040,
|
||||||
SSD_light = 0x080,
|
SSD_light = 0x080,
|
||||||
|
SSD_clip_planes = 0x100,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ShaderBug {
|
enum ShaderBug {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user