Panda3D
Loading...
Searching...
No Matches
meshDrawer.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file meshDrawer.cxx
10 * @author treeform
11 * @date 2008-12-19
12 */
13
14#include "meshDrawer.h"
15
16#include "geomVertexFormat.h"
18#include "geomVertexData.h"
19#include "geomVertexWriter.h"
20#include "geomVertexRewriter.h"
21#include "camera.h"
22#include "boundingSphere.h"
23#include "geomTristrips.h"
24#include "geomTriangles.h"
25#include "geom.h"
26#include "geomNode.h"
27#include "pnmPainter.h"
28#include "pnmBrush.h"
29#include "lvecBase4.h"
30#include "lvector3.h"
31#include "pandaNode.h"
32
33TypeHandle MeshDrawer::_type_handle;
34
35PN_stdfloat randFloat() {
36 return ((PN_stdfloat)rand() / (PN_stdfloat)RAND_MAX);
37}
38
39/**
40 * Creates a system with a given budget.
41 */
42void MeshDrawer::generator(int budget) {
43 // create enough triangles for budget:
44 _vdata = new GeomVertexData(_root.get_name(), GeomVertexFormat::get_v3n3c4t2(), Geom::UH_static);//UH_dynamic);
45 _vdata->unclean_set_num_rows(budget * 3);
46
47 {
48 GeomVertexWriter tvertex(_vdata, "vertex");
49 GeomVertexWriter tnormal(_vdata, "normal");
50 GeomVertexWriter tuv(_vdata, "texcoord");
51 GeomVertexWriter tcolor(_vdata, "color");
52
53 // iterate and fill _up a geom with random data so that it will not be
54 // optimized out by panda3d system
55 for (int i = 0; i < budget; i++) {
56 for (int vert = 0; vert < 3; vert++) {
57 LVector3 vec3 = LVector3(randFloat()+1000,randFloat(),randFloat())*.001;
58 LVector4 vec4 = LVector4(1,1,1,randFloat());
59 LVector2 vec2 = LVector2(0,randFloat());
60 tvertex.set_data3(vec3);
61 tcolor.set_data4(vec4);
62 tuv.set_data2(vec2);
63 tnormal.set_data3(vec3);
64 }
65 }
66 }
67
68 // create our node and attach it to this node path
69 _prim = new GeomTriangles(Geom::UH_static);
70 _prim->add_next_vertices(budget * 3);
71 _prim->close_primitive();
72 _geom = new Geom(_vdata);
73 _geom->add_primitive(_prim);
74 if (_geomnode == nullptr) {
75 _geomnode = new GeomNode("__MeshDrawer_GeomNode");
76 _root.attach_new_node(_geomnode);
77 } else {
78 _geomnode->remove_all_geoms();
79 }
80 _geomnode->add_geom(_geom);
81 _last_clear_index = budget;
82}
83
84/**
85 * Pass the current camera node and the root node. Passing the camera is
86 * required to generate bill boards that face it.
87 */
88void MeshDrawer::begin(NodePath camera, NodePath render) {
89 // sanity check
90 assert(render.get_error_type() == NodePath::ET_ok);
91 assert(camera.get_error_type() == NodePath::ET_ok);
92
93 // remember our arguments
94 _camera = camera;
95 _render = render;
96
97 // compute some help vectors
98 _eyePos = camera.get_pos();
99 _up = _render.get_relative_vector(camera, LVector3(0, 0, 1));
100 _right = _render.get_relative_vector(camera, LVector3(1, 0, 0));
101 _b1 = - _right - _up;
102 _b2 = _right - _up;
103 _b3 = _right + _up;
104 _b4 = - _right + _up;
105
106 // recreate our rewriters
107 if (_vertex != nullptr) delete _vertex;
108 if (_normal != nullptr) delete _normal;
109 if (_uv != nullptr) delete _uv;
110 if (_color != nullptr) delete _color;
111
112 if (_vdata == nullptr) {
113 generator(_budget);
114 }
115
116 _vertex = new GeomVertexRewriter(_vdata, "vertex");
117 _uv = new GeomVertexRewriter(_vdata, "texcoord");
118 _normal = new GeomVertexRewriter(_vdata, "normal");
119 _color = new GeomVertexRewriter(_vdata, "color");
120 _dprim = _prim->decompose();
121
122 // reseta our clearning indexes
123 _start_clear_index = 0;
124 _end_clear_index = _budget;
125 _clear_index = _start_clear_index;
126
127}
128
129/**
130 * Finish the drawing and clearing off the remaining vertexes.
131 */
133
134 // clear the unused triangles at the end of the buffer
135 for(int i = _clear_index ; i < _last_clear_index; i ++ ) {
136 _vertex->add_data3(0,0,0);
137 _vertex->add_data3(0,0,0);
138 _vertex->add_data3(0,0,0);
139 }
140 // don't clear more then you have too
141 _last_clear_index = _clear_index;
142
143 // delete the re writers
144 delete _vertex; _vertex = nullptr;
145 delete _uv; _uv = nullptr;
146 delete _normal; _normal = nullptr;
147 delete _color; _color = nullptr;
148
149}
150
151/**
152 * Draws a particle that is sort of like a bill board but has an extra
153 * rotation component. Frame contains u,v,u-size,v-size quadruple.
154 */
155void MeshDrawer::particle(const LVector3 &pos, const LVector4 &frame, PN_stdfloat size,
156 const LVector4 &color, PN_stdfloat rotation) {
157
158 rotation = rotation / 57.29578;
159
160 LVector3 v1 = pos + _b1*size*sin(rotation) + _b2*size*cos(rotation);
161 LVector3 v2 = pos + _b2*size*sin(rotation) + _b3*size*cos(rotation);
162 LVector3 v3 = pos + _b3*size*sin(rotation) + _b4*size*cos(rotation);
163 LVector3 v4 = pos + _b4*size*sin(rotation) + _b1*size*cos(rotation);
164
165 PN_stdfloat u = frame.get_x();
166 PN_stdfloat v = frame.get_y();
167 PN_stdfloat us = frame.get_z();
168 PN_stdfloat vs = frame.get_w();
169
170 tri(
171 v1, color, LVector2(u,v),
172 v2, color, LVector2(u+us,v),
173 v3, color, LVector2(u+us,v+vs));
174 tri(
175 v3, color, LVector2(u+us,v+vs),
176 v4, color, LVector2(u,v+vs),
177 v1, color, LVector2(u,v));
178}
179
180/**
181 * Works just like particle but accepts 2 frames and a blend (from 0 to 1)
182 * component between them Frame contains u,v,u-size,v-size quadruple.
183 */
184void MeshDrawer::blended_particle(const LVector3 &pos, const LVector4 &frame1,
185 const LVector4 &frame2, PN_stdfloat blend, PN_stdfloat size, const LVector4 &color, PN_stdfloat rotation) {
186
187 LVector4 c2 = color;
188 PN_stdfloat original_w = c2.get_w();
189 c2.set_w((1.f-blend)*original_w);
190 particle(pos,frame1,size,c2,rotation);
191 c2.set_w(blend*original_w);
192 particle(pos,frame2,size,c2,rotation);
193
194}
195
196/**
197 * Draws a billboard - particle with no rotation. Billboards always face the
198 * camera. Frame contains u,v,u-size,v-size quadruple.
199 */
200void MeshDrawer::billboard(const LVector3 &pos, const LVector4 &frame, PN_stdfloat size,
201 const LVector4 &_color) {
202
203 LVector3 v1 = pos + _b1*size;
204 LVector3 v2 = pos + _b2*size;
205 LVector3 v3 = pos + _b3*size;
206 LVector3 v4 = pos + _b4*size;
207
208 PN_stdfloat u = frame.get_x();
209 PN_stdfloat v = frame.get_y();
210 PN_stdfloat us = frame.get_z();
211 PN_stdfloat vs = frame.get_w();
212
213 tri(
214 v1, _color, LVector2(u,v),
215 v2, _color, LVector2(u+us,v),
216 v3, _color, LVector2(u+us,v+vs));
217 tri(
218 v3, _color, LVector2(u+us,v+vs),
219 v4, _color, LVector2(u,v+vs),
220 v1, _color, LVector2(u,v));
221}
222
223
224/**
225 * Draws a segment a line with a thickness. That has billboarding effect.
226 * Frame contains u,v,u-size,v-size quadruple.
227 */
228void MeshDrawer::segment(const LVector3 &start, const LVector3 &stop, const LVector4 &frame,
229 PN_stdfloat thickness, const LVector4 &color) {
230 link_segment(start, frame, thickness, color);
231 link_segment(stop, frame, thickness, color);
232 link_segment_end(frame, color);
233}
234/**
235 * Draws a segment a line with a thickness. This segment does not use the
236 * bill boarding behavior and instead draws 2 planes in a cross. Stars at
237 * start and ends at stop. Frame contains u,v,u-size,v-size quadruple.
238 */
239void MeshDrawer::cross_segment(const LVector3 &start, const LVector3 &stop, const LVector4 &frame,
240 PN_stdfloat thickness, const LVector4 &color) {
241
242 PN_stdfloat u = frame.get_x();
243 PN_stdfloat v = frame.get_y();
244 PN_stdfloat us = frame.get_z();
245 PN_stdfloat vs = frame.get_w();
246
247 LVector3 v1 = start - _up*thickness;
248 LVector3 v2 = stop - _up*thickness;
249 LVector3 v3 = stop + _up*thickness;
250 LVector3 v4 = start + _up*thickness;
251
252 tri(v1, color, LVector2(u,v),
253 v2, color, LVector2(u+us,v),
254 v3, color, LVector2(u+us,v+vs));
255 tri(v3, color, LVector2(u+us,v+vs),
256 v4, color, LVector2(u,v+vs),
257 v1, color, LVector2(u,v));
258
259 v1 = start - _right*thickness;
260 v2 = stop - _right*thickness;
261 v3 = stop + _right*thickness;
262 v4 = start + _right*thickness;
263
264 tri(v1, color, LVector2(u,v),
265 v2, color, LVector2(u+us,v),
266 v3, color, LVector2(u+us,v+vs));
267 tri(v3, color, LVector2(u+us,v+vs),
268 v4, color, LVector2(u,v+vs),
269 v1, color, LVector2(u,v));
270
271}
272
273
274
275
276/**
277 * Draws a segment a line with different thickness and color on both sides.
278 * Stars at start and ends at stop. Frame contains u,v,u-size,v-size
279 * quadruple.
280 */
281void MeshDrawer::uneven_segment(const LVector3 &start, const LVector3 &stop,
282 const LVector4 &frame, PN_stdfloat thickness_start, const LVector4 &color_start,
283 PN_stdfloat thickness_stop, const LVector4 &color_stop) {
284
285 PN_stdfloat u = frame.get_x();
286 PN_stdfloat v = frame.get_y();
287 PN_stdfloat us = frame.get_z();
288 PN_stdfloat vs = frame.get_w();
289
290 LVector3 v1 = start - _up*thickness_start;
291 LVector3 v2 = stop - _up*thickness_stop;
292 LVector3 v3 = stop + _up*thickness_stop;
293 LVector3 v4 = start + _up*thickness_start;
294
295 tri(v1, color_start, LVector2(u,v),
296 v2, color_stop, LVector2(u+us,v),
297 v3, color_stop, LVector2(u+us,v+vs));
298 tri(v3, color_stop, LVector2(u+us,v+vs),
299 v4, color_start, LVector2(u,v+vs),
300 v1, color_start, LVector2(u,v));
301
302 v1 = start - _right*thickness_start;
303 v2 = stop - _right*thickness_stop;
304 v3 = stop + _right*thickness_stop;
305 v4 = start + _right*thickness_start;
306
307 tri(v1, color_start, LVector2(u,v),
308 v2, color_stop, LVector2(u+us,v),
309 v3, color_stop, LVector2(u+us,v+vs));
310 tri(v3, color_stop, LVector2(u+us,v+vs),
311 v4, color_start, LVector2(u,v+vs),
312 v1, color_start, LVector2(u,v));
313}
314
315/**
316 * Draws number of particles in a sphere like emitter. Frame contains
317 * u,v,u-size,v-size quadruple.
318 */
320 const LVector3 &pos, const LVector4 &frame, PN_stdfloat size, const LVector4 &_color,
321 int seed, int number, PN_stdfloat distance) {
322 srand(seed);
323 LVector3 relative_pos;
324 for(int i = 0; i < number; i++) {
325 relative_pos = LVector3(randFloat()-.5f,randFloat()-.5f,randFloat()-.5f);
326 relative_pos.normalize();
327 relative_pos *= randFloat()*distance;
328 particle(relative_pos+pos,frame,size,_color,randFloat()*360.0f);
329 }
330}
331
332/**
333 * Draws a number of particles in a big line with a shift dictated by the
334 * offset. Frame contains u,v,u-size,v-size quadruple.
335 */
336void MeshDrawer::stream(const LVector3 &start, const LVector3 &stop, const LVector4 &frame, PN_stdfloat size, const LVector4 &_color,
337 int number, PN_stdfloat offset) {
338
339 offset = offset-floor(offset);
340 LVector3 relative_pos = stop;
341 LVector3 vec = stop - start;
342 PN_stdfloat distance = vec.length();
343 vec.normalize();
344 for(int i = 0; i < number; i++) {
345 relative_pos = start + vec * ((i+offset)*(distance/PN_stdfloat(number)));
346 billboard(relative_pos,frame,size,_color);
347 }
348}
349
350
351
352/**
353 * Draws the geometry that is inside this node path into the MeshDrawer
354 * object. This performs a similar functions as RigidBodyCombiner but for
355 * very dynamic situations that share the same texture like physcal chunks of
356 * explosions. It can be a little slow
357 */
359 assert(_render.get_error_type() == NodePath::ET_ok);
360
361 LVector4 color = LVector4(1,1,1,1);
362 LVector3 vec[3];
363 LVector2 uv[3];
364
365 // process node
366 NodePathCollection geom_collection = draw_node.find_all_matches("**/+GeomNode");
367 for(int i=0; i < geom_collection.get_num_paths(); i++ ) {
368 NodePath current_node_path = geom_collection.get_path(i);
369 PT(GeomNode) geomNode = DCAST(GeomNode, current_node_path.node());
370
371 // process geom node
372 for(int j=0; j<geomNode->get_num_geoms(); j++) {
373 CPT(Geom) geom = geomNode->get_geom(j);
374 CPT(GeomVertexData) v_data = geom->get_vertex_data();
375 GeomVertexReader *prim_vertex_reader = new GeomVertexReader(v_data, "vertex");
376 GeomVertexReader *prim_uv_reader = new GeomVertexReader(v_data, "texcoord");
377 for (size_t k = 0; k < geom->get_num_primitives(); ++k) {
378 CPT(GeomPrimitive) prim1 = geom->get_primitive(k);
379 CPT(GeomPrimitive) _prim = prim1->decompose();
380
381 // process primitive
382 for(int p=0; p < _prim->get_num_primitives();p++) {
383 int s = _prim->get_primitive_start(p);
384 int e = _prim->get_primitive_end(p);
385 int indx_over = 0;
386
387 // process polygon
388 for(int idx=s; idx<e; idx++) {
389 int vidx = _prim->get_vertex(idx);
390 prim_vertex_reader->set_row_unsafe(vidx);
391 prim_uv_reader->set_row_unsafe(vidx);
392 vec[indx_over] = _render.get_relative_point(
393 current_node_path,prim_vertex_reader->get_data3());
394 uv[indx_over] = prim_uv_reader->get_data2();
395 indx_over++;
396 if (indx_over > 2) break;
397 }
398
399 // draw polygon
400 tri(vec[0],color,uv[0],
401 vec[1],color,uv[1],
402 vec[2],color,uv[2]);
403 }
404 // if we are over budget just quit
405 if( _clear_index > _end_clear_index) return;
406 }
407 // delete our reders
408 delete prim_vertex_reader;
409 delete prim_uv_reader;
410 }
411 }
412}
413
414
415
416/**
417 * Stars or continues linked segment. Control position, frame, thickness and
418 * color with parameters. Frame contains u,v,u-size,v-size quadruple.
419 * Note that for the first two calls to this method, the "frame" parameter is
420 * ignored; it first takes effect as of the third call.
421 * Similarly, note that in the second call to this method, the "color" parameter
422 * is ignored; it only has effect in the first call and calls from the third
423 * onwards.
424 */
426link_segment(const LVector3 &pos, const LVector4 &frame,
427 PN_stdfloat thickness, const LVector4 &color) {
428 assert(_render.get_error_type() == NodePath::ET_ok);
429 assert(_camera.get_error_type() == NodePath::ET_ok);
430 /*
431 * X
432 * ---X
433 * ===0---X
434 * ===0===0---X
435 * ===0===0===O---X
436 * ===0===0===0===End
437 *
438 * first call marks position X
439 * second call moves position and promises to draw segment
440 * it can't draw it yet because next segment might bend it
441 * third call finally draws segment
442 * and the chain continues till
443 * link_segment_end to flush the linking segments is called.
444 */
445
446 // mark 1st position
447 if(_at_start==0) {
448 _last_pos = pos;
449 _last_thickness = thickness;
450 _last_color = color;
451 _at_start=1;
452 return;
453 }
454
455 LVector3 start = _last_pos;
456 LVector3 stop = pos;
457
458 LVector3 cam_start3d = _camera.get_relative_point(_render, start);
459 LPoint2 cam_start2d = LVector2();
460 LVector3 cam_stop3d = _camera.get_relative_point(_render, stop);
461 LPoint2 cam_stop2d = LVector2();
462
463 const Camera *camera;
464 DCAST_INTO_V(camera, _camera.node());
465 const Lens *lens = camera->get_lens();
466
467 lens->project(cam_start3d, cam_start2d);
468 lens->project(cam_stop3d, cam_stop2d);
469
470 LVector2 dif = cam_stop2d - cam_start2d;
471 PN_stdfloat rotation = atan2(dif.get_x(),dif.get_y());
472
473 LVector3 now_v1 = start + _b1*(PN_stdfloat)(thickness*sin(rotation)) + _b2*(PN_stdfloat)(thickness*cos(rotation));
474 LVector3 now_v4 = start + _b4*(PN_stdfloat)(thickness*sin(rotation)) + _b1*(PN_stdfloat)(thickness*cos(rotation));
475 LVector3 now_v2 = stop + _b2*(PN_stdfloat)(thickness*sin(rotation)) + _b3*(PN_stdfloat)(thickness*cos(rotation));
476 LVector3 now_v3 = stop + _b3*(PN_stdfloat)(thickness*sin(rotation)) + _b4*(PN_stdfloat)(thickness*cos(rotation));
477
478 // mark the segment we going to draw we need to draw it when we know what
479 // the next segment looks like because it can bend it a little
480 if(_at_start==1) {
481 _last_v1 = now_v1;
482 _last_v2 = now_v2;
483 _last_v3 = now_v3;
484 _last_v4 = now_v4;
485 _at_start = 2;
486 return;
487 }
488
489 // draw the last segment a little bent
490 LVector3 v1 = _last_v1;
491 LVector3 v2 = (_last_v2+now_v1)/2.0f;
492 LVector3 v3 = (_last_v3+now_v4)/2.0f;
493 LVector3 v4 = _last_v4;
494
495 // compute this frame
496 PN_stdfloat u = frame.get_x();
497 PN_stdfloat v = frame.get_y();
498 PN_stdfloat us = frame.get_z();
499 PN_stdfloat vs = frame.get_w();
500
501 tri(v1, _last_color, LVector2(u,v),
502 v2, color, LVector2(u+us,v),
503 v3, color, LVector2(u+us,v+vs));
504 tri(v3, color, LVector2(u+us,v+vs),
505 v4, _last_color, LVector2(u,v+vs),
506 v1, _last_color, LVector2(u,v));
507
508 // save this segment
509 _last_v1 = v2;
510 _last_v2 = now_v2;
511 _last_v3 = now_v3;
512 _last_v4 = v3;
513
514 // make this position
515 _last_pos = pos;
516 _last_thickness = thickness;
517 _last_color = color;
518}
519
520/**
521 * Finish drawing linked segments, needs at least two calls to link_segment
522 * before it can end the linked segment. Frame contains u,v,u-size,v-size
523 * quadruple.
524 */
525void MeshDrawer::link_segment_end(const LVector4 &frame, const LVector4 &color)
526{
527 PN_stdfloat u = frame.get_x();
528 PN_stdfloat v = frame.get_y();
529 PN_stdfloat us = frame.get_z();
530 PN_stdfloat vs = frame.get_w();
531
532 tri(_last_v1, _last_color, LVector2(u,v),
533 _last_v2, color, LVector2(u+us,v),
534 _last_v3, color, LVector2(u+us,v+vs));
535 tri(_last_v3, color, LVector2(u+us,v+vs),
536 _last_v4, _last_color, LVector2(u,v+vs),
537 _last_v1, _last_color, LVector2(u,v));
538
539 _at_start = 0;
540}
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A node that can be positioned around in the scene graph to represent a point of view for rendering a ...
Definition camera.h:35
A node that holds Geom objects, renderable pieces of geometry.
Definition geomNode.h:34
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
Defines a series of disconnected triangles.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
static const GeomVertexFormat * get_v3n3c4t2()
Returns a standard vertex format with a 2-component texture coordinate pair, a 4-component color,...
This object provides a high-level interface for quickly reading a sequence of numeric values from a v...
void set_row_unsafe(int row)
Sets the start row to the indicated value, without internal checks.
const LVecBase2 & get_data2()
Returns the data associated with the read row, expressed as a 2-component value, and advances the rea...
const LVecBase3 & get_data3()
Returns the data associated with the read row, expressed as a 3-component value, and advances the rea...
This object provides the functionality of both a GeomVertexReader and a GeomVertexWriter,...
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
void add_data3(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Sets the write row to a particular 3-component value, and advances the write row.
A container for geometry primitives.
Definition geom.h:54
Lens * get_lens(int index=0) const
Returns a pointer to the particular Lens associated with this LensNode, or NULL if there is not yet a...
Definition lensNode.I:47
A base class for any number of different kinds of lenses, linear and otherwise.
Definition lens.h:41
bool project(const LPoint3 &point3d, LPoint3 &point2d) const
Given a 3-d point in space, determine the 2-d point this maps to, in the range (-1,...
Definition lens.I:131
void particle(const LVector3 &pos, const LVector4 &frame, PN_stdfloat size, const LVector4 &color, PN_stdfloat rotation)
Draws a particle that is sort of like a bill board but has an extra rotation component.
void link_segment_end(const LVector4 &frame, const LVector4 &color)
Finish drawing linked segments, needs at least two calls to link_segment before it can end the linked...
void explosion(const LVector3 &pos, const LVector4 &frame, PN_stdfloat size, const LVector4 &color, int seed, int number, PN_stdfloat distance)
Draws number of particles in a sphere like emitter.
void billboard(const LVector3 &pos, const LVector4 &frame, PN_stdfloat size, const LVector4 &color)
Draws a billboard - particle with no rotation.
void uneven_segment(const LVector3 &start, const LVector3 &stop, const LVector4 &frame, PN_stdfloat thickness_start, const LVector4 &color_start, PN_stdfloat thickness_stop, const LVector4 &color_stop)
Draws a segment a line with different thickness and color on both sides.
void geometry(NodePath node)
Draws the geometry that is inside this node path into the MeshDrawer object.
void cross_segment(const LVector3 &start, const LVector3 &stop, const LVector4 &frame, PN_stdfloat thickness, const LVector4 &color)
Draws a segment a line with a thickness.
void begin(NodePath camera, NodePath render)
Pass the current camera node and the root node.
void blended_particle(const LVector3 &pos, const LVector4 &frame1, const LVector4 &frame2, PN_stdfloat blend, PN_stdfloat size, const LVector4 &color, PN_stdfloat rotation)
Works just like particle but accepts 2 frames and a blend (from 0 to 1) component between them Frame ...
void end()
Finish the drawing and clearing off the remaining vertexes.
void tri(const LVector3 &v1, const LVector4 &c1, const LVector2 &uv1, const LVector3 &v2, const LVector4 &c2, const LVector2 &uv2, const LVector3 &v3, const LVector4 &c3, const LVector2 &uv3)
Draws a triangle with the given parameters.
Definition meshDrawer.I:75
void link_segment(const LVector3 &pos, const LVector4 &frame, PN_stdfloat thickness, const LVector4 &color)
Stars or continues linked segment.
void segment(const LVector3 &start, const LVector3 &stop, const LVector4 &frame, PN_stdfloat thickness, const LVector4 &color)
Draws a segment a line with a thickness.
void stream(const LVector3 &start, const LVector3 &stop, const LVector4 &frame, PN_stdfloat size, const LVector4 &color, int number, PN_stdfloat offset)
Draws a number of particles in a big line with a shift dictated by the offset.
This is a set of zero or more NodePaths.
get_num_paths
Returns the number of NodePaths in the collection.
get_path
Returns the nth NodePath in the collection.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition nodePath.h:159
LPoint3 get_relative_point(const NodePath &other, const LVecBase3 &point) const
Given that the indicated point is in the coordinate system of the other node, returns the same point ...
LPoint3 get_pos() const
Retrieves the translation component of the transform.
LVector3 get_relative_vector(const NodePath &other, const LVecBase3 &vec) const
Given that the indicated vector is in the coordinate system of the other node, returns the same vecto...
get_error_type
If is_empty() is true, this returns a code that represents the reason why the NodePath is empty.
Definition nodePath.h:211
NodePathCollection find_all_matches(const std::string &path) const
Returns the complete set of all NodePaths that begin with this NodePath and can be extended by path.
Definition nodePath.cxx:357
PandaNode * node() const
Returns the referenced node of the path.
Definition nodePath.I:227
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...
Definition nodePath.cxx:599
get_name
Returns the name of the referenced node.
Definition nodePath.h:951
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.