mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
minor interface tweaks
This commit is contained in:
parent
f4903270ea
commit
8eaa2efe72
@ -28,7 +28,7 @@ CData() {
|
||||
_render_mode = RopeNode::RM_thread;
|
||||
_uv_mode = RopeNode::UV_none;
|
||||
_u_dominant = true;
|
||||
_uv_scale.set(1.0f, 1.0f);
|
||||
_uv_scale = 1.0f;
|
||||
_use_vertex_color = false;
|
||||
_num_subdiv = 10;
|
||||
_thickness = 1.0f;
|
||||
@ -54,7 +54,7 @@ CData(const RopeNode::CData ©) :
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: set_curve
|
||||
// Access: Public
|
||||
// Access: Published
|
||||
// Description: Sets the particular curve represented by the
|
||||
// RopeNode.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -66,7 +66,7 @@ set_curve(NurbsCurveEvaluator *curve) {
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: get_curve
|
||||
// Access: Public
|
||||
// Access: Published
|
||||
// Description: Returns the curve represented by the RopeNode.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE NurbsCurveEvaluator *RopeNode::
|
||||
@ -77,7 +77,7 @@ get_curve() const {
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: set_render_mode
|
||||
// Access: Public
|
||||
// Access: Published
|
||||
// Description: Specifies the method used to render the rope. The
|
||||
// simplest is RM_thread, which just draws a one-pixel
|
||||
// line segment.
|
||||
@ -90,7 +90,7 @@ set_render_mode(RopeNode::RenderMode render_mode) {
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: get_render_mode
|
||||
// Access: Public
|
||||
// Access: Published
|
||||
// Description: Returns the method used to render the rope. See
|
||||
// set_render_mode().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -102,7 +102,7 @@ get_render_mode() const {
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: set_uv_mode
|
||||
// Access: Public
|
||||
// Access: Published
|
||||
// Description: Specifies the algorithm to use to generate UV's for
|
||||
// the rope.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -114,7 +114,7 @@ set_uv_mode(RopeNode::UVMode uv_mode) {
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: get_uv_mode
|
||||
// Access: Public
|
||||
// Access: Published
|
||||
// Description: Returns the algorithm to use to generate UV's for the
|
||||
// rope.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -126,7 +126,7 @@ get_uv_mode() const {
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: set_uv_direction
|
||||
// Access: Public
|
||||
// Access: Published
|
||||
// Description: Specify true to vary the U coordinate down the length
|
||||
// of the rope, or false to vary the V coordinate.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -138,7 +138,7 @@ set_uv_direction(bool u_dominant) {
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: get_uv_direction
|
||||
// Access: Public
|
||||
// Access: Published
|
||||
// Description: Returns true if the rope runs down the U coordinate
|
||||
// of the texture, or false if it runs down the V
|
||||
// coordinate.
|
||||
@ -151,23 +151,42 @@ get_uv_direction() const {
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: set_uv_scale
|
||||
// Access: Public
|
||||
// Access: Published
|
||||
// Description: Specifies an additional scaling factor to apply to
|
||||
// generated UV's for the rope.
|
||||
// generated UV's for the rope. This is a deprecated
|
||||
// interface; use set_uv_scale() that accepts a single
|
||||
// float, instead.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void RopeNode::
|
||||
set_uv_scale(const LVecBase2f &uv_scale) {
|
||||
if (get_uv_direction()) {
|
||||
set_uv_scale(uv_scale[0]);
|
||||
} else {
|
||||
set_uv_scale(uv_scale[1]);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: set_uv_scale
|
||||
// Access: Published
|
||||
// Description: Specifies an additional scaling factor to apply to
|
||||
// generated UV's along the rope. This scale factor is
|
||||
// applied in whichever direction is along the rope, as
|
||||
// specified by set_uv_direction().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void RopeNode::
|
||||
set_uv_scale(float uv_scale) {
|
||||
CDWriter cdata(_cycler);
|
||||
cdata->_uv_scale = uv_scale;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: get_uv_scale
|
||||
// Access: Public
|
||||
// Access: Published
|
||||
// Description: Returns the scaling factor to apply to generated UV's
|
||||
// for the rope.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const LVecBase2f &RopeNode::
|
||||
INLINE float RopeNode::
|
||||
get_uv_scale() const {
|
||||
CDReader cdata(_cycler);
|
||||
return cdata->_uv_scale;
|
||||
@ -175,7 +194,7 @@ get_uv_scale() const {
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: set_use_vertex_color
|
||||
// Access: Public
|
||||
// Access: Published
|
||||
// Description: Sets the "use vertex color" flag. When this is true,
|
||||
// the R, G, B, A vertex color is assumed to be stored
|
||||
// as the dimensions 0, 1, 2, 3, respectively, of the
|
||||
@ -191,7 +210,7 @@ set_use_vertex_color(bool flag) {
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: get_use_vertex_color
|
||||
// Access: Public
|
||||
// Access: Published
|
||||
// Description: Returns the "use vertex color" flag. See
|
||||
// set_use_vertex_color().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -203,7 +222,7 @@ get_use_vertex_color() const {
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: set_num_subdiv
|
||||
// Access: Public
|
||||
// Access: Published
|
||||
// Description: Specifies the number of subdivisions per cubic
|
||||
// segment (that is, per unique knot value) to draw in a
|
||||
// fixed uniform tesselation of the curve.
|
||||
@ -217,7 +236,7 @@ set_num_subdiv(int num_subdiv) {
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: get_num_subdiv
|
||||
// Access: Public
|
||||
// Access: Published
|
||||
// Description: Returns the number of subdivisions per cubic segment
|
||||
// to draw. See set_num_subdiv().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -229,7 +248,7 @@ get_num_subdiv() const {
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: set_thickness
|
||||
// Access: Public
|
||||
// Access: Published
|
||||
// Description: Specifies the thickness of the rope, in pixels or in
|
||||
// spatial units, depending on the render mode. See
|
||||
// set_render_mode().
|
||||
@ -243,7 +262,7 @@ set_thickness(float thickness) {
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: get_thickness
|
||||
// Access: Public
|
||||
// Access: Published
|
||||
// Description: Returns the thickness of the rope. See
|
||||
// set_thickness().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
@ -267,7 +267,7 @@ void RopeNode::
|
||||
render_thread(CullTraverser *trav, CullTraverserData &data,
|
||||
NurbsCurveResult *result) {
|
||||
UVMode uv_mode = get_uv_mode();
|
||||
LVecBase2f uv_scale = get_uv_scale();
|
||||
float uv_scale = get_uv_scale();
|
||||
bool u_dominant = get_uv_direction();
|
||||
bool use_vertex_color = get_use_vertex_color();
|
||||
|
||||
@ -300,9 +300,9 @@ render_thread(CullTraverser *trav, CullTraverserData &data,
|
||||
|
||||
case UV_parametric:
|
||||
if (u_dominant) {
|
||||
uvs.push_back(TexCoordf(t * uv_scale[0], 0.0f));
|
||||
uvs.push_back(TexCoordf(t * uv_scale, 0.0f));
|
||||
} else {
|
||||
uvs.push_back(TexCoordf(0.0f, t * uv_scale[1]));
|
||||
uvs.push_back(TexCoordf(0.0f, t * uv_scale));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -312,9 +312,9 @@ render_thread(CullTraverser *trav, CullTraverserData &data,
|
||||
dist += vec.length();
|
||||
}
|
||||
if (u_dominant) {
|
||||
uvs.push_back(TexCoordf(dist * uv_scale[0], 0.0f));
|
||||
uvs.push_back(TexCoordf(dist * uv_scale, 0.0f));
|
||||
} else {
|
||||
uvs.push_back(TexCoordf(0.0f, dist * uv_scale[1]));
|
||||
uvs.push_back(TexCoordf(0.0f, dist * uv_scale));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -324,9 +324,9 @@ render_thread(CullTraverser *trav, CullTraverserData &data,
|
||||
dist += vec.length_squared();
|
||||
}
|
||||
if (u_dominant) {
|
||||
uvs.push_back(TexCoordf(dist * uv_scale[0], 0.0f));
|
||||
uvs.push_back(TexCoordf(dist * uv_scale, 0.0f));
|
||||
} else {
|
||||
uvs.push_back(TexCoordf(0.0f, dist * uv_scale[1]));
|
||||
uvs.push_back(TexCoordf(0.0f, dist * uv_scale));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -381,7 +381,7 @@ render_billboard(CullTraverser *trav, CullTraverserData &data,
|
||||
float radius = thickness * 0.5f;
|
||||
UVMode uv_mode = get_uv_mode();
|
||||
bool u_dominant = get_uv_direction();
|
||||
LVecBase2f uv_scale = get_uv_scale();
|
||||
float uv_scale = get_uv_scale();
|
||||
|
||||
// We can't just build one tristrip per segment. Instead, we should
|
||||
// build one continuous tristrip for all connected segments, so we
|
||||
@ -462,11 +462,11 @@ render_billboard(CullTraverser *trav, CullTraverserData &data,
|
||||
|
||||
case UV_parametric:
|
||||
if (u_dominant) {
|
||||
uvs.push_back(TexCoordf(t * uv_scale[0], uv_scale[1]));
|
||||
uvs.push_back(TexCoordf(t * uv_scale[0], 0.0f));
|
||||
uvs.push_back(TexCoordf(t * uv_scale, 1.0f));
|
||||
uvs.push_back(TexCoordf(t * uv_scale, 0.0f));
|
||||
} else {
|
||||
uvs.push_back(TexCoordf(uv_scale[0], t * uv_scale[1]));
|
||||
uvs.push_back(TexCoordf(0.0f, t * uv_scale[1]));
|
||||
uvs.push_back(TexCoordf(1.0f, t * uv_scale));
|
||||
uvs.push_back(TexCoordf(0.0f, t * uv_scale));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -476,11 +476,11 @@ render_billboard(CullTraverser *trav, CullTraverserData &data,
|
||||
dist += vec.length();
|
||||
}
|
||||
if (u_dominant) {
|
||||
uvs.push_back(TexCoordf(dist * uv_scale[0], thickness * uv_scale[1]));
|
||||
uvs.push_back(TexCoordf(dist * uv_scale[0], 0.0f));
|
||||
uvs.push_back(TexCoordf(dist * uv_scale, 1.0f));
|
||||
uvs.push_back(TexCoordf(dist * uv_scale, 0.0f));
|
||||
} else {
|
||||
uvs.push_back(TexCoordf(thickness * uv_scale[0], dist * uv_scale[1]));
|
||||
uvs.push_back(TexCoordf(0.0f, dist * uv_scale[1]));
|
||||
uvs.push_back(TexCoordf(1.0f, dist * uv_scale));
|
||||
uvs.push_back(TexCoordf(0.0f, dist * uv_scale));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -490,11 +490,11 @@ render_billboard(CullTraverser *trav, CullTraverserData &data,
|
||||
dist += vec.length_squared();
|
||||
}
|
||||
if (u_dominant) {
|
||||
uvs.push_back(TexCoordf(dist * uv_scale[0], thickness * uv_scale[1]));
|
||||
uvs.push_back(TexCoordf(dist * uv_scale[0], 0.0f));
|
||||
uvs.push_back(TexCoordf(dist * uv_scale, 1.0f));
|
||||
uvs.push_back(TexCoordf(dist * uv_scale, 0.0f));
|
||||
} else {
|
||||
uvs.push_back(TexCoordf(thickness * uv_scale[0], dist * uv_scale[1]));
|
||||
uvs.push_back(TexCoordf(0.0f, dist * uv_scale[1]));
|
||||
uvs.push_back(TexCoordf(1.0f, dist * uv_scale));
|
||||
uvs.push_back(TexCoordf(0.0f, dist * uv_scale));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -96,7 +96,8 @@ PUBLISHED:
|
||||
INLINE bool get_uv_direction() const;
|
||||
|
||||
INLINE void set_uv_scale(const LVecBase2f &uv_scale);
|
||||
INLINE const LVecBase2f &get_uv_scale() const;
|
||||
INLINE void set_uv_scale(float scale);
|
||||
INLINE float get_uv_scale() const;
|
||||
|
||||
INLINE void set_use_vertex_color(bool flag);
|
||||
INLINE bool get_use_vertex_color() const;
|
||||
@ -133,7 +134,7 @@ private:
|
||||
RenderMode _render_mode;
|
||||
UVMode _uv_mode;
|
||||
bool _u_dominant;
|
||||
LVecBase2f _uv_scale;
|
||||
float _uv_scale;
|
||||
bool _use_vertex_color;
|
||||
int _num_subdiv;
|
||||
float _thickness;
|
||||
|
Loading…
x
Reference in New Issue
Block a user