15 #include "multitexReducer.h"
16 #include "pandaNode.h"
19 #include "geomTransformer.h"
20 #include "accumulatedAttribs.h"
21 #include "sceneGraphReducer.h"
22 #include "renderState.h"
23 #include "transformState.h"
24 #include "graphicsOutput.h"
25 #include "displayRegion.h"
27 #include "orthographicLens.h"
28 #include "cardMaker.h"
29 #include "colorAttrib.h"
30 #include "colorScaleAttrib.h"
31 #include "colorBlendAttrib.h"
32 #include "alphaTestAttrib.h"
33 #include "textureAttrib.h"
34 #include "config_grutil.h"
35 #include "config_gobj.h"
38 #include "geomVertexWriter.h"
39 #include "geomVertexReader.h"
50 _allow_tex_mat =
false;
71 _geom_node_list.clear();
91 if (grutil_cat.is_debug()) {
93 <<
"scan(" << *node <<
", " << *state <<
", " << *transform <<
")\n";
96 CPT(
RenderState) next_state = state->compose(node->get_state());
97 CPT(TransformState) next_transform = transform->compose(node->get_transform());
103 node->
set_state(node->get_state()->remove_attrib(TextureAttrib::get_class_slot()));
106 scan_geom_node(DCAST(
GeomNode, node), next_state, next_transform);
111 for (
int i = 0; i < num_children; i++) {
125 _target_stage = stage;
156 _use_geom = use_geom;
180 _allow_tex_mat = allow_tex_mat;
196 if (grutil_cat.is_debug()) {
198 <<
"Beginning flatten operation\n";
199 Stages::const_iterator mi;
200 for (mi = _stages.begin(); mi != _stages.end(); ++mi) {
201 const StageList &stage_list = (*mi).first;
202 const GeomList &geom_list = (*mi).second;
203 grutil_cat.debug(
false)
204 <<
"stage_list for:";
205 for (GeomList::const_iterator gi = geom_list.begin();
206 gi != geom_list.end();
208 const GeomInfo &geom_info = (*gi);
209 grutil_cat.debug(
false)
210 <<
" (" << geom_info._geom_node->get_name() <<
" g"
211 << geom_info._index <<
")";
213 grutil_cat.debug(
false) <<
":\n";
215 StageList::const_iterator si;
216 for (si = stage_list.begin(); si != stage_list.end(); ++si) {
217 const StageInfo &stage_info = (*si);
218 grutil_cat.debug(
false)
219 <<
" " << *stage_info._stage <<
" " << *stage_info._tex
220 <<
" " << *stage_info._tex_mat <<
"\n";
224 Stages::const_iterator mi;
225 for (mi = _stages.begin(); mi != _stages.end(); ++mi) {
226 const StageList &stage_list = (*mi).first;
227 const GeomList &geom_list = (*mi).second;
230 bool use_transparent_bg =
false;
231 if(stage_list.size() > 0) {
232 if(stage_list[0]._stage->get_mode() == TextureStage::M_decal)
233 use_transparent_bg =
true;
235 use_transparent_bg =
false;
237 grutil_cat.debug(
false) <<
"use transparent bg = " << use_transparent_bg <<
"\n";
245 const StageInfo &model_stage = stage_list[choose_model_stage(stage_list)];
247 Texture *model_tex = model_stage._tex;
249 SamplerState::FilterType minfilter = model_tex->
get_minfilter();
250 SamplerState::FilterType magfilter = model_tex->
get_magfilter();
254 determine_uv_range(min_uv, max_uv, model_stage, geom_list);
260 get_uv_scale(uv_scale, uv_trans, min_uv, max_uv);
269 choose_texture_size(x_size, y_size, model_stage, uv_scale,
272 static int multitex_id = 1;
274 multitex_name_strm <<
"multitex" << multitex_id;
278 (multitex_name_strm.str(), x_size, y_size, NULL,
false);
294 lens->set_film_size(1.0f, 1.0f);
295 lens->set_film_offset(0.5f, 0.5f);
296 lens->set_near_far(-1000.0f, 1000.0f);
297 lens->set_view_mat(
LMatrix4(uv_scale[0], 0.0f, 0.0, 0.0f,
298 0.0f, 1.0f, 0.0, 0.0f,
299 0.0f, 0.0f, uv_scale[1], 0.0f,
300 uv_trans[0], 0.0f, uv_trans[1], 1.0f));
301 cam_node->set_lens(lens);
317 bool force_use_geom = _use_geom;
318 bool bake_in_color = _use_geom;
319 LColor geom_color(1.0f, 1.0f, 1.0f, 1.0f);
322 if(use_transparent_bg)
323 geom_color =
LColor(0.0f,0.0f,0.0f,0.0f);
325 if (!force_use_geom) {
326 bool uses_decal = scan_decal(stage_list);
330 bake_in_color =
true;
344 if (!force_use_geom) {
349 cm.
set_frame(min_uv[0], max_uv[0], min_uv[1], max_uv[1]);
358 nassertv(bake_in_color);
360 transfer_geom(geom_node, NULL, geom_list,
true);
365 StageList::const_iterator si;
366 for (si = stage_list.begin(); si != stage_list.end(); ++si) {
367 const StageInfo &stage_info = (*si);
369 make_texture_layer(render, stage_info, geom_list,
370 min_uv, max_uv, force_use_geom, use_transparent_bg);
376 add_on_stage(_target_stage, tex);
378 GeomList::const_iterator gi;
379 for (gi = geom_list.begin(); gi != geom_list.end(); ++gi) {
380 const GeomInfo &geom_info = (*gi);
383 geom_info._geom_node->get_geom_state(geom_info._index);
384 int override = geom_info._geom_net_state->get_override(TextureAttrib::get_class_slot());
385 geom_state = geom_state->add_attrib(new_ta,
override);
390 geom_state = geom_state->add_attrib(ColorAttrib::make_flat(
LColor(1.0f, 1.0f, 1.0f, 1.0f)));
397 geom_info._geom_net_state->get_attrib(ColorScaleAttrib::get_class_slot());
400 geom_state = geom_state->add_attrib
401 (attrib->invert_compose(ColorScaleAttrib::make_identity()));
406 CPT(TransformState) tex_mat = TransformState::make_identity();
408 const RenderAttrib *ra = geom_info._state->get_attrib(TexMatrixAttrib::get_class_slot());
413 CPT(TransformState) tex_mat = tma->get_transform(_target_stage);
416 tex_mat = tex_mat->compose(TransformState::make_pos_hpr_scale
417 (
LVecBase3(uv_trans[0], uv_trans[1], 0.0f),
419 LVecBase3(uv_scale[0], uv_scale[1], 1.0f)));
421 if (tex_mat->is_identity()) {
423 geom_state = geom_state->remove_attrib(TexMatrixAttrib::get_class_slot());
427 (_target_stage, tex_mat->invert_compose(TransformState::make_identity()));
428 geom_state = geom_state->add_attrib(new_tma);
432 geom_info._geom_node->set_geom_state(geom_info._index, geom_state);
440 GeomNodeList::const_iterator gni;
441 for (gni = _geom_node_list.begin(); gni != _geom_node_list.end(); ++gni) {
442 const GeomNodeInfo &geom_node_info = (*gni);
445 geom_node_info._state->get_attrib(TextureAttrib::get_class_slot());
446 geom_node_info._geom_node->apply_attribs_to_vertices
447 (attribs, SceneGraphReducer::TT_tex_matrix, transformer);
457 void MultitexReducer::
459 const TransformState *transform) {
460 if (grutil_cat.is_debug()) {
462 <<
"scan_geom_node(" << *node <<
", " << *state <<
", "
463 << *transform <<
")\n";
466 _geom_node_list.push_back(GeomNodeInfo(state, node));
469 for (
int gi = 0; gi < num_geoms; gi++) {
471 state->compose(node->get_geom_state(gi));
473 if (grutil_cat.is_debug()) {
475 <<
"geom " << gi <<
" net_state =\n";
476 geom_net_state->write(cerr, 2);
483 attrib = geom_net_state->get_attrib(TextureAttrib::get_class_slot());
490 CPT(
RenderState) geom_state = node->get_geom_state(gi);
491 geom_state = geom_state->remove_attrib(
TextureAttrib::get_class_slot());
492 node->set_geom_state(gi, geom_state);
494 } else if (ta->get_num_on_stages() < 2) {
498 int override = geom_net_state->get_override(TextureAttrib::get_class_slot());
499 CPT(
RenderState) geom_state = node->get_geom_state(gi);
500 geom_state = geom_state->add_attrib(ta, override);
501 node->set_geom_state(gi, geom_state);
506 attrib = geom_net_state->get_attrib(TexMatrixAttrib::get_class_slot());
508 tma = DCAST(TexMatrixAttrib, attrib);
511 StageList stage_list;
513 int num_stages = ta->get_num_on_stages();
514 for (
int si = 0; si < num_stages; si++) {
516 Texture *tex = ta->get_on_texture(stage);
518 stage_list.push_back(StageInfo(stage, ta, tma));
522 <<
"Ignoring invalid texture stage " << stage->
get_name() <<
"\n";
526 if (stage_list.size() >= 2) {
527 record_stage_list(stage_list, GeomInfo(state, geom_net_state, node, gi));
539 void MultitexReducer::
541 const MultitexReducer::GeomInfo &geom_info) {
542 if (grutil_cat.is_debug()) {
544 <<
"record_stage_list for " << geom_info._geom_node->get_name() <<
" g"
545 << geom_info._index <<
":\n";
546 StageList::const_iterator si;
547 for (si = stage_list.begin(); si != stage_list.end(); ++si) {
548 const StageInfo &stage_info = (*si);
549 grutil_cat.debug(
false)
550 <<
" " << *stage_info._stage <<
" " << *stage_info._tex
551 <<
" " << *stage_info._tex_mat <<
"\n";
555 _stages[stage_list].push_back(geom_info);
565 size_t MultitexReducer::
567 for (
size_t si = 0; si < stage_list.size(); si++) {
568 const StageInfo &stage_info = stage_list[si];
569 if (stage_info._stage == _target_stage) {
586 bool MultitexReducer::
588 const MultitexReducer::StageInfo &model_stage,
590 const InternalName *model_name = model_stage._stage->get_texcoord_name();
591 bool got_any =
false;
593 GeomList::const_iterator gi;
594 for (gi = geom_list.begin(); gi != geom_list.end(); ++gi) {
595 const GeomInfo &geom_info = (*gi);
598 geom_info._geom_node->get_geom(geom_info._index)->make_copy();
601 CPT(GeomVertexFormat) format = vdata->get_format();
602 if (format->has_column(model_name)) {
605 if (!texcoord.is_at_end()) {
606 const LVecBase2 &uv = texcoord.get_data2();
608 min_uv = max_uv = uv;
612 min_uv.set(min(min_uv[0], uv[0]), min(min_uv[1], uv[1]));
613 max_uv.set(max(max_uv[0], uv[0]), max(max_uv[1], uv[1]));
616 while (!texcoord.is_at_end()) {
617 const LVecBase2 &uv = texcoord.get_data2();
618 min_uv.set(min(min_uv[0], uv[0]), min(min_uv[1], uv[1]));
619 max_uv.set(max(max_uv[0], uv[0]), max(max_uv[1], uv[1]));
626 min_uv.set(0.0f, 0.0f);
627 max_uv.set(1.0f, 1.0f);
644 void MultitexReducer::
647 if (max_uv[0] != min_uv[0]) {
648 uv_scale[0] = (max_uv[0] - min_uv[0]);
653 if (max_uv[1] != min_uv[1]) {
654 uv_scale[1] = (max_uv[1] - min_uv[1]);
659 uv_trans[0] = (min_uv[0] + max_uv[0]) / 2.0f - uv_scale[0] * 0.5f;
660 uv_trans[1] = (min_uv[1] + max_uv[1]) / 2.0f - uv_scale[1] * 0.5f;
670 void MultitexReducer::
671 choose_texture_size(
int &x_size,
int &y_size,
672 const MultitexReducer::StageInfo &model_stage,
675 Texture *model_tex = model_stage._tex;
686 LVecBase3 inherited_scale = model_stage._tex_mat->get_scale();
688 PN_stdfloat u_scale = cabs(inherited_scale[0]) * uv_scale[0];
689 if (u_scale != 0.0f) {
690 while (u_scale >= 2.0f) {
694 while (u_scale <= 0.5f && x_size > 0) {
700 PN_stdfloat v_scale = cabs(inherited_scale[1]) * uv_scale[1];
701 if (v_scale != 0.0f) {
702 while (v_scale >= 2.0f) {
706 while (v_scale <= 0.5f && y_size > 0) {
712 if (x_size == 0 || y_size == 0) {
714 <<
"Texture size " << model_tex->
get_x_size() <<
" "
716 << model_stage._tex_mat->get_scale() <<
", reduced to size "
717 << x_size <<
" " << y_size <<
"; constraining to 1 1.\n";
723 if (max_texture_dimension > 0) {
724 x_size = min(x_size, (
int)max_texture_dimension);
725 y_size = min(y_size, (
int)max_texture_dimension);
731 if (win_x_size != 0 && x_size > win_x_size) {
733 while (x_size > win_x_size) {
739 if (win_y_size != 0 && y_size > win_y_size) {
741 while (y_size > win_y_size) {
754 void MultitexReducer::
755 make_texture_layer(
const NodePath &render,
756 const MultitexReducer::StageInfo &stage_info,
759 bool force_use_geom,
bool transparent_base) {
762 switch (stage_info._stage->get_mode()) {
763 case TextureStage::M_normal:
764 case TextureStage::M_normal_height:
765 case TextureStage::M_glow:
766 case TextureStage::M_gloss:
767 case TextureStage::M_height:
768 case TextureStage::M_selector:
769 case TextureStage::M_normal_gloss:
774 case TextureStage::M_modulate_glow:
775 case TextureStage::M_modulate_gloss:
776 case TextureStage::M_modulate:
777 cba = ColorBlendAttrib::make
778 (ColorBlendAttrib::M_add, ColorBlendAttrib::O_fbuffer_color,
779 ColorBlendAttrib::O_zero);
782 case TextureStage::M_decal:
783 if(transparent_base) {
784 cba = AlphaTestAttrib::make
785 (AlphaTestAttrib::M_greater, 0.0f);
787 cba = ColorBlendAttrib::make
788 (ColorBlendAttrib::M_add, ColorBlendAttrib::O_incoming_alpha,
789 ColorBlendAttrib::O_one_minus_incoming_alpha);
793 case TextureStage::M_blend:
794 cba = ColorBlendAttrib::make
795 (ColorBlendAttrib::M_add, ColorBlendAttrib::O_constant_color,
796 ColorBlendAttrib::O_one_minus_incoming_color,
797 stage_info._stage->get_color());
800 case TextureStage::M_replace:
801 cba = ColorBlendAttrib::make_off();
804 case TextureStage::M_add:
805 cba = ColorBlendAttrib::make
806 (ColorBlendAttrib::M_add, ColorBlendAttrib::O_one,
807 ColorBlendAttrib::O_one);
810 case TextureStage::M_combine:
812 switch (stage_info._stage->get_combine_rgb_mode()) {
813 case TextureStage::CM_modulate:
815 TextureStage::CombineSource source0 = stage_info._stage->get_combine_rgb_source0();
816 TextureStage::CombineOperand operand0 = stage_info._stage->get_combine_rgb_operand0();
817 TextureStage::CombineSource source1 = stage_info._stage->get_combine_rgb_source1();
818 TextureStage::CombineOperand operand1 = stage_info._stage->get_combine_rgb_operand1();
822 if (source1 < source0) {
823 source0 = stage_info._stage->get_combine_rgb_source1();
824 operand0 = stage_info._stage->get_combine_rgb_operand1();
825 source1 = stage_info._stage->get_combine_rgb_source0();
826 operand1 = stage_info._stage->get_combine_rgb_operand0();
829 if (source0 == TextureStage::CS_primary_color &&
830 source1 == TextureStage::CS_previous) {
836 }
else if (source0 == TextureStage::CS_texture &&
837 source1 == TextureStage::CS_constant) {
839 cba = ColorBlendAttrib::make
840 (ColorBlendAttrib::M_add, ColorBlendAttrib::O_constant_color,
841 ColorBlendAttrib::O_zero, stage_info._stage->get_color());
843 }
else if (source0 == TextureStage::CS_texture &&
844 source1 == TextureStage::CS_previous) {
846 cba = ColorBlendAttrib::make
847 (ColorBlendAttrib::M_add, ColorBlendAttrib::O_fbuffer_color,
848 ColorBlendAttrib::O_zero);
863 case TextureStage::M_blend_color_scale:
865 cba = ColorBlendAttrib::make
866 (ColorBlendAttrib::M_add, ColorBlendAttrib::O_constant_color,
867 ColorBlendAttrib::O_one_minus_incoming_color,
868 stage_info._stage->get_color());
874 if (!force_use_geom && stage_info._stage->get_texcoord_name() == _target_stage->get_texcoord_name()) {
877 CardMaker cm(stage_info._tex->get_name());
878 cm.set_uv_range(min_uv, max_uv);
879 cm.set_has_uvs(
true);
880 cm.set_frame(min_uv[0], max_uv[0], min_uv[1], max_uv[1]);
891 transfer_geom(geom_node, stage_info._stage->get_texcoord_name(),
894 geom = render.attach_new_node(geom_node);
896 geom.set_color(
LColor(1.0f, 1.0f, 1.0f, 1.0f));
899 if (!stage_info._tex_mat->is_identity()) {
916 void MultitexReducer::
917 transfer_geom(
GeomNode *geom_node,
const InternalName *texcoord_name,
919 bool preserve_color) {
921 GeomList::const_iterator gi;
922 for (gi = geom_list.begin(); gi != geom_list.end(); ++gi) {
923 const GeomInfo &geom_info = (*gi);
924 const Geom *orig_geom = geom_info._geom_node->get_geom(geom_info._index);
928 PT(
Geom) geom = orig_geom->make_copy();
931 geom->set_vertex_data(geom->get_vertex_data(current_thread)->animate_vertices(true, current_thread));
937 vdata->set_usage_hint(
Geom::UH_stream);
939 if (vdata->has_column(_target_stage->get_texcoord_name())) {
941 GeomVertexReader texcoord(vdata, _target_stage->get_texcoord_name(), current_thread);
943 while (!texcoord.is_at_end()) {
944 const LVecBase2 &tc = texcoord.get_data2();
945 vertex.set_data3(tc[0], 0.0f, tc[1]);
949 if (texcoord_name != (
const InternalName *)NULL &&
950 texcoord_name != InternalName::get_texcoord()) {
954 vdata->
get_format()->get_column(texcoord_name);
956 vdata = vdata->replace_column
959 geom->set_vertex_data(vdata);
963 while (!from.is_at_end()) {
970 if (preserve_color) {
972 const RenderAttrib *ca = geom_info._geom_net_state->get_attrib(ColorAttrib::get_class_slot());
974 geom_state = geom_state->add_attrib(ca);
976 const RenderAttrib *csa = geom_info._geom_net_state->get_attrib(ColorScaleAttrib::get_class_slot());
978 geom_state = geom_state->add_attrib(csa);
982 geom_node->
add_geom(geom, geom_state);
999 void MultitexReducer::
1001 int &num_colors)
const {
1002 GeomList::const_iterator gi;
1003 for (gi = geom_list.begin(); gi != geom_list.end() && num_colors < 2; ++gi) {
1004 const GeomInfo &geom_info = (*gi);
1007 bool has_flat_color =
false;
1008 bool has_vertex_color =
false;
1010 LColor color_scale(1.0f, 1.0f, 1.0f, 1.0f);
1011 const RenderAttrib *csa = geom_info._geom_net_state->get_attrib(ColorScaleAttrib::get_class_slot());
1019 ColorAttrib::Type color_type = ColorAttrib::T_vertex;
1020 const RenderAttrib *ca = geom_info._geom_net_state->get_attrib(ColorAttrib::get_class_slot());
1022 color_type = DCAST(
ColorAttrib, ca)->get_color_type();
1025 if (color_type == ColorAttrib::T_flat) {
1028 has_flat_color =
true;
1030 }
else if (color_type == ColorAttrib::T_vertex) {
1032 const Geom *geom = geom_info._geom_node->get_geom(geom_info._index);
1033 if (geom->get_vertex_data()->has_column(InternalName::get_color())) {
1036 has_vertex_color =
true;
1040 if (has_vertex_color) {
1043 }
else if (has_flat_color) {
1044 flat_color.set(flat_color[0] * color_scale[0],
1045 flat_color[1] * color_scale[1],
1046 flat_color[2] * color_scale[2],
1047 flat_color[3] * color_scale[3]);
1049 if (num_colors == 0) {
1051 geom_color = flat_color;
1068 bool MultitexReducer::
1070 StageList::const_iterator si;
1071 for (si = stage_list.begin(); si != stage_list.end(); ++si) {
1072 const StageInfo &stage_info = (*si);
1074 if (stage_info._stage->get_mode() == TextureStage::M_decal) {
1088 MultitexReducer::StageInfo::
1092 _tex_mat(TransformState::make_identity())
1096 _tex_mat = tma->get_transform(stage);
bool almost_equal(const LVecBase4f &other, float threshold) const
Returns true if two vectors are memberwise equal within a specified tolerance.
void set_depth_test(bool depth_test, int priority=0)
Specifically sets or disables the testing of the depth buffer on this particular node.
A basic node of the scene graph or data graph.
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a)
Sets the color of the card.
void set_one_shot(bool one_shot)
Changes the current setting of the one-shot flag.
This is the base class for all three-component vectors and points.
virtual Texture * get_texture(int i=0) const
Returns the nth texture into which the GraphicsOutput renders.
This is the base class for a number of render attributes (other than transform) that may be set on sc...
A base class for any number of different kinds of lenses, linear and otherwise.
int get_anisotropic_degree() const
Returns the degree of anisotropic filtering that should be applied to the texture.
void set_depth_write(bool depth_write, int priority=0)
Specifically sets or disables the writing to the depth buffer on this particular node.
void set_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
Sets the size of the card.
void scan(const NodePath &node)
Starts scanning the hierarchy beginning at the indicated node.
PandaNode * get_child(int n) const
Returns the nth child of the node.
void set_target(TextureStage *stage)
Specifies the target TextureStage (and InternalName) that will be left on each multitexture node afte...
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
const string & get_name() const
Returns the name of this texture stage.
void add_data2(PN_stdfloat x, PN_stdfloat y)
Sets the write row to a particular 2-component value, and advances the write row. ...
bool has_scale() const
Returns true if the ColorScaleAttrib has a non-identity scale, false otherwise (in which case it migh...
PandaNode * node() const
Returns the referenced node of the path.
void set_magfilter(FilterType filter)
Sets the filtering method that should be used when viewing the texture up close.
int get_y_size() const
Returns the visible height of the window or buffer, if it is known.
int get_num_components() const
Returns the number of components of the column: the number of instances of the NumericType in each el...
DisplayRegion * make_display_region()
Creates a new DisplayRegion that covers the entire window.
This defines how a single column is interleaved within a vertex array stored within a Geom...
static Thread * get_current_thread()
Returns a pointer to the currently-executing Thread object.
void set_texture(Texture *tex, int priority=0)
Adds the indicated texture to the list of textures that will be rendered on the default texture stage...
Indicates the set of TextureStages and their associated Textures that should be applied to (or remove...
void flatten(GraphicsOutput *window)
Actually performs the reducing operations on the nodes that were previously scanned.
This is our own Panda specialization on the default STL vector.
void set_bin(const string &bin_name, int draw_order, int priority=0)
Assigns the geometry at this level and below to the named rendering bin.
This class is used by the SceneGraphReducer to maintain and accumulate the set of attributes we have ...
int get_num_children() const
Returns the number of children of the node.
This is a 4-by-4 transform matrix.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
const LVecBase4 & get_scale() const
Returns the scale to be applied to colors.
A container for geometry primitives.
void set_state(const RenderState *state, Thread *current_thread=Thread::get_current_thread())
Sets the complete RenderState that will be applied to all nodes at this level and below...
const GeomVertexFormat * get_format() const
Returns a pointer to the GeomVertexFormat structure that defines this data.
This is the base class for all two-component vectors and points.
Children get_children(Thread *current_thread=Thread::get_current_thread()) const
Returns an object that can be used to walk through the list of children of the node.
Texture * get_on_texture(TextureStage *stage) const
Returns the texture associated with the indicated stage, or NULL if no texture is associated...
void clear()
Removes the record of nodes that were previously discovered by scan().
This class generates 2-d "cards", that is, rectangular polygons, particularly useful for showing text...
void set_tex_transform(TextureStage *stage, const TransformState *transform)
Sets the texture matrix on the current node to the indicated transform for the given stage...
This is a base class for the various different classes that represent the result of a frame of render...
void set_attrib(const RenderAttrib *attrib, int override=0)
Adds the indicated render attribute to the scene graph on this node.
Applies a scale to colors in the scene graph and on vertices.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
bool has_stage(TextureStage *stage) const
Returns true if there is a transform associated with the indicated stage, or false otherwise (in whic...
SamplerState::FilterType get_magfilter() const
Returns the filter mode of the texture for magnification.
This is the base class for all three-component vectors and points.
Applies a transform matrix to UV's before they are rendered.
void set_anisotropic_degree(int anisotropic_degree)
Specifies the level of anisotropic filtering to apply to the texture.
int get_x_size() const
Returns the visible width of the window or buffer, if it is known.
virtual void set_camera(const NodePath &camera)
Sets the camera that is associated with this DisplayRegion.
A thread; that is, a lightweight process.
This object provides a high-level interface for quickly reading a sequence of numeric values from a v...
GraphicsOutput * make_texture_buffer(const string &name, int x_size, int y_size, Texture *tex=NULL, bool to_ram=false, FrameBufferProperties *fbp=NULL)
Creates and returns an offscreen buffer for rendering into, the result of which will be a texture sui...
Contents get_contents() const
Returns the token representing the semantic meaning of the stored value.
NumericType get_numeric_type() const
Returns the token representing the numeric type of the data storage.
void set_minfilter(FilterType filter)
Sets the filtering method that should be used when viewing the texture from a distance.
A rectangular subregion within a window for rendering into.
Indicates what color should be applied to renderable geometry.
void set_allow_tex_mat(bool allow_tex_mat)
Indicates whether the resulting texture should be expected to be animated beyond its current range vi...
This is a two-component point in space.
SamplerState::FilterType get_minfilter() const
Returns the filter mode of the texture for minification.
virtual bool is_geom_node() const
A simple downcast check.
A node that can be positioned around in the scene graph to represent a point of view for rendering a ...
static TextureStage * get_default()
Returns the default TextureStage that will be used for all texturing that does not name a particular ...
Defines the properties of a named stage of the multitexture pipeline.
void set_two_sided(bool two_sided, int priority=0)
Specifically sets or disables two-sided rendering mode on this particular node.
int get_y_size() const
Returns the height of the texture image in texels.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
int get_x_size() const
Returns the width of the texture image in texels.
A node that holds Geom objects, renderable pieces of geometry.
void add_geom(Geom *geom, const RenderState *state=RenderState::make_empty())
Adds a new Geom to the node.
NodePath attach_new_node(PandaNode *node, int sort=0, Thread *current_thread=Thread::get_current_thread()) const
Attaches a new node, with or without existing parents, to the scene graph below the referenced node o...
int get_num_geoms() const
Returns the number of geoms in the node.
void set_use_geom(bool use_geom)
Indicates whether the actual geometry will be used to generate the textures.