mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 01:44:06 -04:00
Support for optional TransformState when adding a Geom to a triangle mesh or convex mesh.
This commit is contained in:
parent
248e4f2672
commit
b7eb296cff
@ -78,7 +78,12 @@ add_array(const PTA_LVecBase3 &points) {
|
|||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void BulletConvexHullShape::
|
void BulletConvexHullShape::
|
||||||
add_geom(const Geom *geom) {
|
add_geom(const Geom *geom, CPT(TransformState) ts) {
|
||||||
|
|
||||||
|
nassertv(geom);
|
||||||
|
nassertv(ts);
|
||||||
|
|
||||||
|
LMatrix4 m = ts->get_mat();
|
||||||
|
|
||||||
// Collect points
|
// Collect points
|
||||||
pvector<LPoint3> points;
|
pvector<LPoint3> points;
|
||||||
@ -87,7 +92,7 @@ add_geom(const Geom *geom) {
|
|||||||
GeomVertexReader reader = GeomVertexReader(vdata, InternalName::get_vertex());
|
GeomVertexReader reader = GeomVertexReader(vdata, InternalName::get_vertex());
|
||||||
|
|
||||||
while (!reader.is_at_end()) {
|
while (!reader.is_at_end()) {
|
||||||
points.push_back(reader.get_data3());
|
points.push_back(m.xform_point(reader.get_data3()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create shape
|
// Create shape
|
||||||
|
@ -38,7 +38,8 @@ PUBLISHED:
|
|||||||
|
|
||||||
void add_point(const LPoint3 &p);
|
void add_point(const LPoint3 &p);
|
||||||
void add_array(const PTA_LVecBase3 &points);
|
void add_array(const PTA_LVecBase3 &points);
|
||||||
void add_geom(const Geom *geom);
|
void add_geom(const Geom *geom,
|
||||||
|
CPT(TransformState) ts=TransformState::make_identity());
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual btCollisionShape *ptr() const;
|
virtual btCollisionShape *ptr() const;
|
||||||
|
@ -101,7 +101,12 @@ get_welding_distance() const {
|
|||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void BulletTriangleMesh::
|
void BulletTriangleMesh::
|
||||||
add_geom(const Geom *geom, bool remove_duplicate_vertices) {
|
add_geom(const Geom *geom, bool remove_duplicate_vertices, CPT(TransformState) ts) {
|
||||||
|
|
||||||
|
nassertv(geom);
|
||||||
|
nassertv(ts);
|
||||||
|
|
||||||
|
LMatrix4 m = ts->get_mat();
|
||||||
|
|
||||||
// Collect points
|
// Collect points
|
||||||
pvector<LPoint3> points;
|
pvector<LPoint3> points;
|
||||||
@ -110,7 +115,7 @@ add_geom(const Geom *geom, bool remove_duplicate_vertices) {
|
|||||||
GeomVertexReader reader = GeomVertexReader(vdata, InternalName::get_vertex());
|
GeomVertexReader reader = GeomVertexReader(vdata, InternalName::get_vertex());
|
||||||
|
|
||||||
while (!reader.is_at_end()) {
|
while (!reader.is_at_end()) {
|
||||||
points.push_back(reader.get_data3());
|
points.push_back(m.xform_point(reader.get_data3()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert points
|
// Convert points
|
||||||
|
@ -45,7 +45,8 @@ PUBLISHED:
|
|||||||
const PTA_int &indices,
|
const PTA_int &indices,
|
||||||
bool remove_duplicate_vertices=false);
|
bool remove_duplicate_vertices=false);
|
||||||
void add_geom(const Geom *geom,
|
void add_geom(const Geom *geom,
|
||||||
bool remove_duplicate_vertices=false);
|
bool remove_duplicate_vertices=false,
|
||||||
|
CPT(TransformState) ts=TransformState::make_identity());
|
||||||
|
|
||||||
void set_welding_distance(PN_stdfloat distance);
|
void set_welding_distance(PN_stdfloat distance);
|
||||||
void preallocate(int num_verts, int num_indices);
|
void preallocate(int num_verts, int num_indices);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user