*** empty log message ***

This commit is contained in:
David Rose 2000-10-24 02:38:00 +00:00
parent bbc7e5df98
commit 231e357952
76 changed files with 470 additions and 268 deletions

View File

@ -108,7 +108,7 @@
// $[target_ipath] is the proper ipath to put on the command line,
// from the context of a particular target.
#defer target_ipath $[other_trees:%=%/include] $[TOPDIR] $[sort $[complete_ipath]] $[get_ipath]
#defer target_ipath $[TOPDIR] $[sort $[complete_ipath]] $[other_trees:%=%/include] $[get_ipath]
// $[file_ipath] is the ipath from the context of a particular source
// file, given in $[file]. It uses the all_sources map to look up
@ -129,7 +129,7 @@
// $[lpath] is like $[target_ipath]: it's the list of directories we
// should add to our -L list, from the context of a particular target.
#defer lpath $[other_trees:%=%/lib] $[sort $[complete_lpath]] $[get_lpath]
#defer lpath $[sort $[complete_lpath]] $[other_trees:%=%/lib] $[get_lpath]
// And $[libs] is the set of libraries we will link with.
#defer libs $[unique $[complete_local_libs] $[patsubst %:m,,%:c %,%,$[OTHER_LIBS]] $[get_libs]]

View File

@ -28,8 +28,8 @@ template<class SwitchType>
INLINE MovingPart<SwitchType>::
MovingPart(const MovingPart<SwitchType> &copy) :
MovingPartBase(copy),
_initial_value(copy._initial_value),
_value(copy._value)
_value(copy._value),
_initial_value(copy._initial_value)
{
}
@ -41,10 +41,11 @@ MovingPart(const MovingPart<SwitchType> &copy) :
template<class SwitchType>
INLINE MovingPart<SwitchType>::
MovingPart(PartGroup *parent, const string &name,
const ValueType &initial_value)
: MovingPartBase(parent, name),
_initial_value(initial_value),
_value(initial_value) {
const ValueType &initial_value) :
MovingPartBase(parent, name),
_value(initial_value),
_initial_value(initial_value)
{
}
////////////////////////////////////////////////////////////////////

View File

@ -189,7 +189,11 @@ SetupFOV ChanResolveFOV(SetupFOV& fov, float sizeX, float sizeY) {
chancfg_cat->debug() << "ChanResolveFOV:: setting horiz = " << horiz
<< " and vert = " << vert << endl;
break;
default:
break;
}
ret.setFOV(horiz, vert);
return ret;
}
@ -340,7 +344,7 @@ PT(GraphicsWindow) ChanConfig(GraphicsPipe* pipe, std::string cfg,
bool border = !chanconfig.GetBool("no-border", !W.getBorder());
bool fullscreen = chanconfig.GetBool("fullscreen", false);
bool cursor = chanconfig.GetBool("cursor-visible", W.getCursor());
// bool cursor = chanconfig.GetBool("cursor-visible", W.getCursor());
int want_depth_bits = chanconfig.GetInt("want-depth-bits", 1);
int want_color_bits = chanconfig.GetInt("want-color-bits", 1);

View File

@ -45,6 +45,6 @@ get_num_parts() const {
////////////////////////////////////////////////////////////////////
INLINE PartGroup *Character::
get_part(int n) const {
nassertr(n >= 0 && n < _parts.size(), NULL);
nassertr(n >= 0 && n < (int)_parts.size(), NULL);
return _parts[n];
}

View File

@ -79,12 +79,12 @@ write_datagram(Datagram &dest)
dest.add_int16(_joint_index);
dest.add_float64(_effect);
dest.add_uint16(_vindex.size());
for(i = 0; i < _vindex.size(); i++)
for(i = 0; i < (int)_vindex.size(); i++)
{
dest.add_uint16(_vindex[i]);
}
dest.add_uint16(_nindex.size());
for(i = 0; i < _nindex.size(); i++)
for(i = 0; i < (int)_nindex.size(); i++)
{
dest.add_uint16(_nindex[i]);
}
@ -158,7 +158,9 @@ update(Character *character) {
// We have some uv morphs. These don't particularly need to be
// done before the joints are computed, but do them now anyway.
int table_size = sizeof(TexCoordf) * _orig_texcoords.size();
TexCoordf *morphed_texcoords = (TexCoordf *)alloca(table_size);
// **** Is this right? Test it!
// TexCoordf *morphed_texcoords = (TexCoordf *)alloca(table_size);
memcpy(character->_cv._texcoords, _orig_texcoords, table_size);
compute_morphs(character->_cv._texcoords.p(), _texcoord_morphs, character);
@ -167,7 +169,9 @@ update(Character *character) {
if (!_color_morphs.empty()) {
// We have some color morphs. Do these now too.
int table_size = sizeof(Colorf) * _orig_colors.size();
Colorf *morphed_colors = (Colorf *)alloca(table_size);
// **** Is this right? Test it!
// Colorf *morphed_colors = (Colorf *)alloca(table_size);
memcpy(character->_cv._colors, _orig_colors, table_size);
compute_morphs(character->_cv._colors.p(), _color_morphs, character);
@ -308,27 +312,27 @@ write_datagram(BamWriter *manager, Datagram &me)
int i;
me.add_uint16(_transforms.size());
for(i = 0; i < _transforms.size(); i++){
for(i = 0; i < (int)_transforms.size(); i++){
_transforms[i].write_datagram(me);
}
me.add_uint16(_vertex_morphs.size());
for(i = 0; i < _vertex_morphs.size(); i++){
for(i = 0; i < (int)_vertex_morphs.size(); i++){
_vertex_morphs[i].write_datagram(me);
}
me.add_uint16(_normal_morphs.size());
for(i = 0; i < _normal_morphs.size(); i++){
for(i = 0; i < (int)_normal_morphs.size(); i++){
_normal_morphs[i].write_datagram(me);
}
me.add_uint16(_texcoord_morphs.size());
for(i = 0; i < _texcoord_morphs.size(); i++){
for(i = 0; i < (int)_texcoord_morphs.size(); i++){
_texcoord_morphs[i].write_datagram(me);
}
me.add_uint16(_color_morphs.size());
for(i = 0; i < _color_morphs.size(); i++){
for(i = 0; i < (int)_color_morphs.size(); i++){
_color_morphs[i].write_datagram(me);
}

View File

@ -111,7 +111,7 @@ write_datagram(Datagram &dest)
{
dest.add_int16(_slider_index);
dest.add_uint16(_morphs.size());
for(int i = 0; i < _morphs.size(); i++)
for(int i = 0; i < (int)_morphs.size(); i++)
{
_morphs[i].write_datagram(dest);
}

View File

@ -73,7 +73,7 @@ void ChatInput::transmit_data(NodeAttributes &data) {
char ch = be._button.get_ascii_equivalent();
if (isprint(ch)) {
if (has_max_chars() && _str.size() >= get_max_chars()) {
if (has_max_chars() && (int)_str.size() >= get_max_chars()) {
throw_event("chat_overflow");
} else {
_str += ch;

View File

@ -138,7 +138,9 @@ set_into_intersection_point(const LPoint3f &point) {
////////////////////////////////////////////////////////////////////
// Function: CollisionEntry::has_into_intersection_point
// Access: Public
// Description:
// Description: Returns true if the detected collision knows its
// intersection point in the coordinate space of the
// collided-into object, false otherwise.
////////////////////////////////////////////////////////////////////
INLINE bool CollisionEntry::
has_into_intersection_point() const {
@ -148,7 +150,10 @@ has_into_intersection_point() const {
////////////////////////////////////////////////////////////////////
// Function: CollisionEntry::get_into_intersection_point
// Access: Public
// Description:
// Description: Returns the intersection point in the coordinate
// space of the collided-into object. It is an error to
// call this if has_into_intersection_point() returns
// false.
////////////////////////////////////////////////////////////////////
INLINE const LPoint3f &CollisionEntry::
get_into_intersection_point() const {
@ -156,6 +161,33 @@ get_into_intersection_point() const {
return _into_intersection_point;
}
////////////////////////////////////////////////////////////////////
// Function: CollisionEntry::has_from_intersection_point
// Access: Public
// Description: Returns true if the detected collision knows its
// intersection point in the coordinate space of the
// colliding object, false otherwise.
////////////////////////////////////////////////////////////////////
INLINE bool CollisionEntry::
has_from_intersection_point() const {
// Since we derive the from_intersection_point from the
// into_intersection_point, this is really the same question.
return has_into_intersection_point();
}
////////////////////////////////////////////////////////////////////
// Function: CollisionEntry::get_from_intersection_point
// Access: Public
// Description: Returns the intersection point in the coordinate
// space of the colliding object. It is an error to
// call this if has_from_intersection_point() returns
// false.
////////////////////////////////////////////////////////////////////
INLINE LPoint3f CollisionEntry::
get_from_intersection_point() const {
return get_into_intersection_point() * get_inv_wrt_space();
}
////////////////////////////////////////////////////////////////////
// Function: CollisionEntry::set_into_surface_normal
// Access: Public
@ -170,7 +202,9 @@ set_into_surface_normal(const LVector3f &normal) {
////////////////////////////////////////////////////////////////////
// Function: CollisionEntry::has_into_surface_normal
// Access: Public
// Description:
// Description: Returns true if the detected collision knows the
// surface normal of the collided-into object at the
// point of the collision, false otherwise.
////////////////////////////////////////////////////////////////////
INLINE bool CollisionEntry::
has_into_surface_normal() const {
@ -180,7 +214,10 @@ has_into_surface_normal() const {
////////////////////////////////////////////////////////////////////
// Function: CollisionEntry::get_into_surface_normal
// Access: Public
// Description:
// Description: Returns the surface normal of the collided-into
// object at the point of the collision. It is an error
// to call this if has_into_surface_normal() returns
// false.
////////////////////////////////////////////////////////////////////
INLINE const LVector3f &CollisionEntry::
get_into_surface_normal() const {
@ -203,7 +240,10 @@ set_into_depth(float depth) {
////////////////////////////////////////////////////////////////////
// Function: CollisionEntry::has_into_depth
// Access: Public
// Description:
// Description: Returns true if the collision entry knows how "deep"
// the collision was into the collided-into object; that
// is, how far into the surface of the collided-into
// object the colliding object has penetrated.
////////////////////////////////////////////////////////////////////
INLINE bool CollisionEntry::
has_into_depth() const {
@ -213,7 +253,11 @@ has_into_depth() const {
////////////////////////////////////////////////////////////////////
// Function: CollisionEntry::get_into_depth
// Access: Public
// Description:
// Description: Returns how "deep" the collision was into the
// collided-into object; that is, how far into the
// surface of the collided-into object the colliding
// object has penetrated. It is an error to call this
// if has_into_depth() returns false.
////////////////////////////////////////////////////////////////////
INLINE float CollisionEntry::
get_into_depth() const {

View File

@ -51,6 +51,9 @@ public:
INLINE bool has_into_intersection_point() const;
INLINE const LPoint3f &get_into_intersection_point() const;
INLINE bool has_from_intersection_point() const;
INLINE LPoint3f get_from_intersection_point() const;
INLINE void set_into_surface_normal(const LVector3f &normal);
INLINE bool has_into_surface_normal() const;
INLINE const LVector3f &get_into_surface_normal() const;

View File

@ -22,6 +22,18 @@ operator () (const PT(CollisionEntry) &a,
return false;
}
////////////////////////////////////////////////////////////////////
// Function: CollisionHandlerEvent::SortEntries::operator =
// Access: Public
// Description: The assignment operator does absolutely nothing,
// since this is just a function object class that
// stores no data. We define it just to quiet up g++ in
// -Wall mode.
////////////////////////////////////////////////////////////////////
INLINE void CollisionHandlerEvent::SortEntries::
operator = (const CollisionHandlerEvent::SortEntries &) {
}
////////////////////////////////////////////////////////////////////
// Function: CollisionHandlerEvent::set_in_pattern
// Access: Public

View File

@ -49,6 +49,7 @@ private:
INLINE bool
operator () (const PT(CollisionEntry) &a,
const PT(CollisionEntry) &b) const;
INLINE void operator = (const SortEntries &other);
};
typedef set<PT(CollisionEntry), SortEntries> Colliding;

View File

@ -8,6 +8,21 @@
TypeHandle CollisionHandlerQueue::_type_handle;
// This class is used in sort_entries(), below.
class CollisionEntrySorter {
public:
CollisionEntrySorter(CollisionEntry *entry) {
_entry = entry;
_dist = (entry->get_from_intersection_point() - LPoint3f::origin()).length();
}
bool operator < (const CollisionEntrySorter &other) const {
return _dist < other._dist;
}
CollisionEntry *_entry;
double _dist;
};
////////////////////////////////////////////////////////////////////
// Function: CollisionHandlerQueue::Constructor
// Access: Public
@ -42,6 +57,40 @@ add_entry(CollisionEntry *entry) {
_entries.push_back(entry);
}
////////////////////////////////////////////////////////////////////
// Function: CollisionHandlerQueue::sort_entries
// Access: Public
// Description: Sorts all the detected collisions front-to-back by
// from_intersection_point() so that those intersection
// points closest to the origin appear first.
////////////////////////////////////////////////////////////////////
void CollisionHandlerQueue::
sort_entries() {
// Build up a temporary vector of entries so we can sort the
// pointers. This uses the class defined above.
typedef vector<CollisionEntrySorter> Sorter;
Sorter sorter;
sorter.reserve(_entries.size());
Entries::const_iterator ei;
for (ei = _entries.begin(); ei != _entries.end(); ++ei) {
sorter.push_back(CollisionEntrySorter(*ei));
}
sort(sorter.begin(), sorter.end());
nassertv(sorter.size() == _entries.size());
// Now that they're sorted, get them back.
Entries sorted_entries;
sorted_entries.reserve(sorter.size());
Sorter::const_iterator si;
for (si = sorter.begin(); si != sorter.end(); ++si) {
sorted_entries.push_back((*si)._entry);
}
_entries.swap(sorted_entries);
}
////////////////////////////////////////////////////////////////////
// Function: CollisionHandlerQueue::get_num_entries
// Access: Public

View File

@ -27,6 +27,8 @@ public:
virtual void begin_group();
virtual void add_entry(CollisionEntry *entry);
void sort_entries();
int get_num_entries() const;
CollisionEntry *get_entry(int n) const;

View File

@ -21,7 +21,7 @@ get_num_colliders() const {
////////////////////////////////////////////////////////////////////
INLINE bool CollisionLevelState::
has_collider(int n) const {
nassertr(n >= 0 && n < _colliders.size(), false);
nassertr(n >= 0 && n < (int)_colliders.size(), false);
return (_current & get_mask(n)) != 0;
}
@ -34,7 +34,7 @@ has_collider(int n) const {
////////////////////////////////////////////////////////////////////
INLINE bool CollisionLevelState::
has_collider_with_geom(int n) const {
nassertr(n >= 0 && n < _colliders.size(), false);
nassertr(n >= 0 && n < (int)_colliders.size(), false);
return (_current & _colliders_with_geom & get_mask(n)) != 0;
}
@ -80,7 +80,7 @@ reached_collision_node() {
////////////////////////////////////////////////////////////////////
INLINE CollisionSolid *CollisionLevelState::
get_collider(int n) const {
nassertr(n >= 0 && n < _colliders.size(), NULL);
nassertr(n >= 0 && n < (int)_colliders.size(), NULL);
nassertr(has_collider(n), NULL);
return _colliders[n]._collider;
@ -93,7 +93,7 @@ get_collider(int n) const {
////////////////////////////////////////////////////////////////////
INLINE CollisionNode *CollisionLevelState::
get_node(int n) const {
nassertr(n >= 0 && n < _colliders.size(), NULL);
nassertr(n >= 0 && n < (int)_colliders.size(), NULL);
nassertr(has_collider(n), NULL);
return _colliders[n]._node;
@ -106,7 +106,7 @@ get_node(int n) const {
////////////////////////////////////////////////////////////////////
INLINE const LMatrix4f &CollisionLevelState::
get_space(int n) const {
nassertr(n >= 0 && n < _colliders.size(), LMatrix4f::ident_mat());
nassertr(n >= 0 && n < (int)_colliders.size(), LMatrix4f::ident_mat());
nassertr(has_collider(n), LMatrix4f::ident_mat());
return _colliders[n]._space;
@ -119,7 +119,7 @@ get_space(int n) const {
////////////////////////////////////////////////////////////////////
INLINE const LMatrix4f &CollisionLevelState::
get_inv_space(int n) const {
nassertr(n >= 0 && n < _colliders.size(), LMatrix4f::ident_mat());
nassertr(n >= 0 && n < (int)_colliders.size(), LMatrix4f::ident_mat());
nassertr(has_collider(n), LMatrix4f::ident_mat());
return _colliders[n]._inv_space;
@ -132,9 +132,9 @@ get_inv_space(int n) const {
////////////////////////////////////////////////////////////////////
INLINE const GeometricBoundingVolume *CollisionLevelState::
get_local_bound(int n) const {
nassertr(n >= 0 && n < _colliders.size(), NULL);
nassertr(n >= 0 && n < (int)_colliders.size(), NULL);
nassertr(has_collider(n), NULL);
nassertr(n >= 0 && n < _local_bounds.size(), NULL);
nassertr(n >= 0 && n < (int)_local_bounds.size(), NULL);
return _local_bounds[n];
}
@ -145,7 +145,7 @@ get_local_bound(int n) const {
////////////////////////////////////////////////////////////////////
INLINE void CollisionLevelState::
omit_collider(int n) {
nassertv(n >= 0 && n < _colliders.size());
nassertv(n >= 0 && n < (int)_colliders.size());
nassertv(has_collider(n));
_current &= ~get_mask(n);

View File

@ -128,7 +128,8 @@ get_solid(int n) const {
////////////////////////////////////////////////////////////////////
// Function: CollisionNode::remove_solid
// Access: Public
// Description:
// Description: Removes the solid with the indicated index. This
// will shift all subsequent indices down by one.
////////////////////////////////////////////////////////////////////
INLINE void CollisionNode::
remove_solid(int n) {
@ -140,7 +141,9 @@ remove_solid(int n) {
////////////////////////////////////////////////////////////////////
// Function: CollisionNode::add_solid
// Access: Public
// Description:
// Description: Adds the indicated solid to the node. Returns the
// index of the new solid within the node's list of
// solids.
////////////////////////////////////////////////////////////////////
INLINE int CollisionNode::
add_solid(CollisionSolid *solid) {

View File

@ -53,3 +53,38 @@ CollisionPolygon(const LPoint3f *begin, const LPoint3f *end) {
INLINE CollisionPolygon::
CollisionPolygon(void) {
}
////////////////////////////////////////////////////////////////////
// Function: CollisionPolygon::verify_points
// Access: Public, Static
// Description: Verifies that the indicated set of points will define
// a valid CollisionPolygon: that is, at least three
// non-collinear points, with no points repeated.
////////////////////////////////////////////////////////////////////
INLINE bool CollisionPolygon::
verify_points(const LPoint3f &a, const LPoint3f &b,
const LPoint3f &c) {
LPoint3f array[3];
array[0] = a;
array[1] = b;
array[2] = c;
return verify_points(array, array + 3);
}
////////////////////////////////////////////////////////////////////
// Function: CollisionPolygon::verify_points
// Access: Public, Static
// Description: Verifies that the indicated set of points will define
// a valid CollisionPolygon: that is, at least three
// non-collinear points, with no points repeated.
////////////////////////////////////////////////////////////////////
INLINE bool CollisionPolygon::
verify_points(const LPoint3f &a, const LPoint3f &b,
const LPoint3f &c, const LPoint3f &d) {
LPoint3f array[4];
array[0] = a;
array[1] = b;
array[2] = c;
array[3] = d;
return verify_points(array, array + 4);
}

View File

@ -60,6 +60,45 @@ make_copy() {
return new CollisionPolygon(*this);
}
////////////////////////////////////////////////////////////////////
// Function: CollisionPolygon::verify_points
// Access: Public, Static
// Description: Verifies that the indicated set of points will define
// a valid CollisionPolygon: that is, at least three
// non-collinear points, with no points repeated.
////////////////////////////////////////////////////////////////////
bool CollisionPolygon::
verify_points(const LPoint3f *begin, const LPoint3f *end) {
int num_points = end - begin;
if (num_points < 3) {
return false;
}
// Create a plane to determine the planarity of the first three
// points.
Planef plane(begin[0], begin[1], begin[2]);
LVector3f normal = plane.get_normal();
float normal_length = normal.length();
bool all_ok = IS_THRESHOLD_EQUAL(normal_length, 1.0, 0.001);
const LPoint3f *pi;
for (pi = begin; pi != end && all_ok; ++pi) {
if ((*pi).is_nan()) {
all_ok = false;
} else {
// Make sure no points are repeated.
const LPoint3f *pj;
for (pj = begin; pj != pi && all_ok; ++pj) {
if ((*pj).almost_equal(*pi)) {
all_ok = false;
}
}
}
}
return all_ok;
}
////////////////////////////////////////////////////////////////////
// Function: CollisionPolygon::test_intersection
// Access: Public, Virtual
@ -360,7 +399,7 @@ is_inside(const LPoint2f &p) const {
// order, a point is interior to the polygon iff the point is not right of
// each of the edges.
for (int i = 0; i < _points.size() - 1; i++) {
for (int i = 0; i < (int)_points.size() - 1; i++) {
if (is_right(p - _points[i], _points[i+1] - _points[i])) {
return false;
}
@ -396,33 +435,16 @@ setup_points(const LPoint3f *begin, const LPoint3f *end) {
#ifndef NDEBUG
// Make sure all the source points are good.
{
float normal_length = normal.length();
bool all_ok = IS_THRESHOLD_EQUAL(normal_length, 1.0, 0.001);
const LPoint3f *pi;
for (pi = begin; pi != end && all_ok; ++pi) {
if ((*pi).is_nan()) {
all_ok = false;
} else {
// Make sure no points are repeated.
const LPoint3f *pj;
for (pj = begin; pj != pi && all_ok; ++pj) {
if ((*pj).almost_equal(*pi)) {
all_ok = false;
}
}
}
}
if (!all_ok) {
collide_cat.error() << "Invalid points passed to CollisionPolygon:\n";
if (!verify_points(begin, end)) {
collide_cat.error() << "Invalid points in CollisionPolygon:\n";
const LPoint3f *pi;
for (pi = begin; pi != end; ++pi) {
collide_cat.error(false) << " " << (*pi) << "\n";
}
collide_cat.error(false)
<< " normal " << normal << " with length " << normal_length << "\n";
<< " normal " << normal << " with length " << normal.length() << "\n";
nassertv(false);
return;
}
}
@ -497,7 +519,7 @@ setup_points(const LPoint3f *begin, const LPoint3f *end) {
// be convex) is also a point within the polygon.
_median = _points[0];
for (int n = 1; n < _points.size(); n++) {
for (int n = 1; n < (int)_points.size(); n++) {
_median += _points[n];
}
_median /= _points.size();
@ -580,7 +602,7 @@ write_datagram(BamWriter *manager, Datagram &me)
CollisionPlane::write_datagram(manager, me);
me.add_uint16(_points.size());
for(i = 0; i < _points.size(); i++)
for(i = 0; i < (int)_points.size(); i++)
{
_points[i].write_datagram(me);
}

View File

@ -27,6 +27,13 @@ public:
virtual CollisionSolid *make_copy();
INLINE static bool verify_points(const LPoint3f &a, const LPoint3f &b,
const LPoint3f &c);
INLINE static bool verify_points(const LPoint3f &a, const LPoint3f &b,
const LPoint3f &c, const LPoint3f &d);
static bool verify_points(const LPoint3f *begin, const LPoint3f *end);
virtual int
test_intersection(CollisionHandler *record,
const CollisionEntry &entry,

View File

@ -541,12 +541,16 @@ compare_collider_to_geom(CollisionEntry &entry, Geom *geom,
PTA_ushort tris = geom->get_tris();
for (int i = 0; i < (int)tris.size(); i += 3) {
// Generate a temporary CollisionPolygon on the fly for each
// triangle in the Geom.
CollisionPolygon poly(coords[tris[i]], coords[tris[i + 1]],
coords[tris[i + 2]]);
if (entry.get_from()->test_intersection((*ci).second, entry, &poly) != 0) {
return;
if (CollisionPolygon::verify_points(coords[tris[i]],
coords[tris[i + 1]],
coords[tris[i + 2]])) {
// Generate a temporary CollisionPolygon on the fly for each
// triangle in the Geom.
CollisionPolygon poly(coords[tris[i]], coords[tris[i + 1]],
coords[tris[i + 2]]);
if (entry.get_from()->test_intersection((*ci).second, entry, &poly) != 0) {
return;
}
}
}
}

View File

@ -39,8 +39,6 @@ void GeomBinBackToFront::
record_current_state(GraphicsStateGuardian *gsg, CullState *cs, int,
CullTraverser *trav) {
// Get the transform matrix from the state.
LMatrix4f mat;
TransformAttribute *trans_attrib = NULL;
get_attribute_into(trans_attrib, cs->get_attributes(),
TransformTransition::get_class_type());

View File

@ -40,8 +40,6 @@ void GeomBinFixed::
record_current_state(GraphicsStateGuardian *, CullState *cs,
int draw_order, CullTraverser *) {
// Get the transform matrix from the state.
LMatrix4f mat;
TransformAttribute *trans_attrib = NULL;
get_attribute_into(trans_attrib, cs->get_attributes(),
TransformTransition::get_class_type());

View File

@ -68,7 +68,6 @@ void GeomBinUnsorted::
draw(CullTraverser *trav) {
PStatTimer timer(CullTraverser::_draw_pcollector);
GraphicsStateGuardian *gsg = trav->get_gsg();
TypeHandle graph_type = trav->get_graph_type();
if (cull_cat.is_spam()) {
cull_cat.spam()

View File

@ -30,7 +30,7 @@ TypeHandle ADInputNode::_channels_type;
////////////////////////////////////////////////////////////////////
ADInputNode::
ADInputNode(PT(ClientBase) client, const string &adinput) :
DataNode(adinput), _adinput(adinput), _client(client)
DataNode(adinput), _client(client), _adinput(adinput)
{
_client->add_remote_analog(_adinput);
_client->add_remote_button(_adinput);

View File

@ -17,8 +17,8 @@ TypeHandle ClientBase::_type_handle;
////////////////////////////////////////////////////////////////////
ClientBase::
ClientBase(const string &server) :
_server(server), _sleep_time(1000000/60),
_shutdown(false), _forked(false)
_sleep_time(1000000/60), _server(server),
_forked(false), _shutdown(false)
{
}

View File

@ -33,7 +33,7 @@ TypeHandle TrackerNode::_aquat_dt_type;
TrackerNode::
TrackerNode(PT(ClientBase) client, const string &tracker,
int sensor) :
DataNode(tracker), _tracker(tracker), _client(client), _sensor(sensor)
DataNode(tracker), _client(client), _tracker(tracker), _sensor(sensor)
{
_client->add_remote_tracker(_tracker, _sensor);

View File

@ -16,8 +16,10 @@
// Description:
////////////////////////////////////////////////////////////////////
DisplayRegion::
DisplayRegion(GraphicsLayer *layer) : _layer(layer),
_l(0.), _r(1.), _b(0.), _t(1.), _active(true)
DisplayRegion(GraphicsLayer *layer) :
_l(0.), _r(1.), _b(0.), _t(1.),
_layer(layer),
_active(true)
{
}
@ -29,7 +31,9 @@ DisplayRegion(GraphicsLayer *layer) : _layer(layer),
DisplayRegion::
DisplayRegion(GraphicsLayer *layer, const float l,
const float r, const float b, const float t)
: _layer(layer), _l(l), _r(r), _b(b), _t(t), _active(true)
: _l(l), _r(r), _b(b), _t(t),
_layer(layer),
_active(true)
{
}
@ -42,9 +46,9 @@ DisplayRegion(GraphicsLayer *layer, const float l,
////////////////////////////////////////////////////////////////////
DisplayRegion::
DisplayRegion(int xsize, int ysize) :
_layer((GraphicsLayer *)0L),
_l(0.), _r(1.), _b(0.), _t(1.),
_pl(0), _pr(xsize), _pb(0), _pt(ysize),
_layer((GraphicsLayer *)0L),
_active(true)
{
}

View File

@ -68,7 +68,7 @@ public:
class EXPCL_PANDA PipeSpec : public PipeParam {
public:
INLINE PipeSpec(void) : PipeParam() {}
INLINE PipeSpec(PipeSpecifier& p) : _p(p), PipeParam() {}
INLINE PipeSpec(PipeSpecifier& p) : PipeParam(), _p(p) {}
virtual ~PipeSpec(void);
INLINE const PipeSpecifier &get_specifier(void) { return _p; }
public:

View File

@ -164,7 +164,7 @@ public:
// Make a factory parameter type for the window pointer
class EXPCL_PANDA GsgWindow : public GsgParam {
public:
INLINE GsgWindow(GraphicsWindow* w) : _w(w), GsgParam() {}
INLINE GsgWindow(GraphicsWindow* w) : GsgParam(), _w(w) {}
virtual ~GsgWindow(void);
INLINE GraphicsWindow* get_window(void) { return _w; }
public:

View File

@ -1,4 +1,3 @@
ignoreconstruct GraphicsWindow
ignoremember get_properties
ignoremember set_draw_callback
ignoremember set_idle_callback

View File

@ -313,9 +313,9 @@ flag_redisplay() {
void GraphicsWindow::
declare_channel(int index, GraphicsChannel *chan) {
nassertv(index >= 0);
if (index >= _channels.size()) {
if (index >= (int)_channels.size()) {
_channels.reserve(index);
while (index >= _channels.size()) {
while (index >= (int)_channels.size()) {
_channels.push_back(NULL);
}
}

View File

@ -202,7 +202,7 @@ public:
class EXPCL_PANDA WindowProps : public FactoryParam {
public:
INLINE WindowProps(void) : WindowParam() {}
INLINE WindowProps(const Properties& p) : _p(p), WindowParam() {}
INLINE WindowProps(const Properties& p) : WindowParam(), _p(p) {}
virtual ~WindowProps(void);
INLINE Properties get_properties(void) { return _p; }
public:
@ -217,7 +217,7 @@ public:
// make a factory parameter type for the GraphicsPipe*
class EXPCL_PANDA WindowPipe : public FactoryParam {
public:
INLINE WindowPipe(GraphicsPipe* p) : _p(p), WindowParam() {}
INLINE WindowPipe(GraphicsPipe* p) : WindowParam(), _p(p) {}
virtual ~WindowPipe(void);
INLINE GraphicsPipe* get_pipe(void) { return _p; }
public:

View File

@ -23,7 +23,7 @@
class EXPCL_PANDAEXPRESS AsyncUtility {
public:
AsyncUtility(float frequency = 0.2);
~AsyncUtility(void);
virtual ~AsyncUtility(void);
void create_thread(void);

View File

@ -301,7 +301,7 @@ decompress(Filename &source_file, Filename &dest_file) {
dest_buffer_length, write_stream);
if (ret == ZCompressorBase::S_error)
return false;
if (decompressor.get_total_in() == source_file_length &&
if ((int)decompressor.get_total_in() == source_file_length &&
avail_out == dest_buffer_length)
handled_all_input = true;
}

View File

@ -26,7 +26,7 @@ class EXPCL_PANDAEXPRESS Decompressor : public AsyncUtility {
public:
Decompressor(void);
Decompressor(PT(Buffer) buffer);
~Decompressor(void);
virtual ~Decompressor(void);
int request_decompress(const Filename &source_file,
const string &event_name);

View File

@ -30,7 +30,7 @@ class EXPCL_PANDAEXPRESS Downloader : public AsyncUtility {
public:
Downloader(void);
Downloader(PT(Buffer) buffer);
~Downloader(void);
virtual ~Downloader(void);
bool connect_to_server(const string &name, uint port=80);
void disconnect_from_server(void);

View File

@ -26,7 +26,7 @@ class EXPCL_PANDAEXPRESS Extractor : public AsyncUtility {
public:
Extractor(void);
Extractor(PT(Buffer) buffer);
~Extractor(void);
virtual ~Extractor(void);
int request_extract(const Filename &source_file,
const string &event_name, const Filename &rel_path = "");

View File

@ -26,7 +26,7 @@ class EXPCL_PANDAEXPRESS Patcher : public AsyncUtility {
public:
Patcher(void);
Patcher(PT(Buffer) buffer);
~Patcher(void);
virtual ~Patcher(void);
int request_patch(const Filename &patch,
const Filename &infile, const string &event_name);

View File

@ -110,7 +110,7 @@ set_geometry(GeomSprite *sprite, const PTA_float &geom_scales,
nassertv(geom_colors.size() == geom_offsets.size());
float world_scale = _texel_scale * _global_scale;
for(int i = 0; i < geom_scales.size(); i++)
for(int i = 0; i < (int)geom_scales.size(); i++)
{
LVector3f position = (delta * geom_offsets[i]) + light;
float view_scale;
@ -158,7 +158,7 @@ prepare_flares(const LVector3f &delta, const LPoint3f &light, const float &angle
{
if (_flares.size() > _flare_arcs.size())
{
for(int i = _flare_arcs.size(); i < _flares.size(); i++)
for(int i = _flare_arcs.size(); i < (int)_flares.size(); i++)
{
GeomSprite *sprite = new GeomSprite();
GeomNode *node = new GeomNode();
@ -187,7 +187,7 @@ prepare_flares(const LVector3f &delta, const LPoint3f &light, const float &angle
}
}
for(int i = 0; i < _flares.size(); i++)
for(int i = 0; i < (int)_flares.size(); i++)
{
GeomNode *node = DCAST(GeomNode, _flare_arcs[i]->get_child());
GeomSprite *sprite = DCAST(GeomSprite, node->get_geom(0));
@ -282,7 +282,7 @@ void LensFlareNode::
render_children(const vector_relation &arcs, const AllAttributesWrapper &attrib,
AllTransitionsWrapper &trans, GraphicsStateGuardian *gsg)
{
for(int i = 0; i < arcs.size(); i++)
for(int i = 0; i < (int)arcs.size(); i++)
{
render_child(arcs[i], attrib, trans, gsg);
}
@ -377,38 +377,38 @@ write_datagram(BamWriter *manager, Datagram &me) {
Node::write_datagram(manager, me);
me.add_uint16(_flares.size());
for(i = 0; i < _flares.size(); i++)
for(i = 0; i < (int)_flares.size(); i++)
{
manager->write_pointer(me, _flares[i]);
}
manager->write_pointer(me, _blind);
me.add_uint16(_flare_arcs.size());
for(i = 0; i < _flare_arcs.size(); i++)
for(i = 0; i < (int)_flare_arcs.size(); i++)
{
manager->write_pointer(me, _flare_arcs[i]);
}
me.add_uint16(_flare_scales.size());
for(i = 0; i < _flare_scales.size(); i++)
for(i = 0; i < (int)_flare_scales.size(); i++)
{
WRITE_PTA(manager, me, IPD_float::write_datagram, _flare_scales[i])
}
me.add_uint16(_flare_angle_scales.size());
for(i = 0; i < _flare_angle_scales.size(); i++)
for(i = 0; i < (int)_flare_angle_scales.size(); i++)
{
WRITE_PTA(manager, me, IPD_float::write_datagram, _flare_angle_scales[i])
}
me.add_uint16(_flare_offsets.size());
for(i = 0; i < _flare_offsets.size(); i++)
for(i = 0; i < (int)_flare_offsets.size(); i++)
{
WRITE_PTA(manager, me, IPD_float::write_datagram, _flare_offsets[i])
}
me.add_uint16(_flare_colors.size());
for(i = 0; i < _flare_colors.size(); i++)
for(i = 0; i < (int)_flare_colors.size(); i++)
{
WRITE_PTA(manager, me, IPD_Colorf::write_datagram, _flare_colors[i])
}

View File

@ -28,7 +28,7 @@ public:
_want_id = id;
}
bool operator()(PT(TokenType) tok) const {
return tok->_id == _want_id;
return (int)tok->_id == _want_id;
}
int _want_id;
};

View File

@ -490,8 +490,7 @@ void setup_framerate(void) {
if (framerate_font != (NamedNode *)0L) {
framerate_text = new TextNode("framerate_text");
RenderRelation *text_arc = new RenderRelation(framerate_node,
framerate_text);
new RenderRelation(framerate_node, framerate_text);
LMatrix4f mat = LMatrix4f::scale_mat(0.05) *
LMatrix4f::translate_mat(-0.95, 0.0, 0.95);

View File

@ -990,7 +990,7 @@ draw_sprite(const GeomSprite *geom) {
if (x_overall == true)
scaled_width = geom->_x_texel_ratio[0] * half_width;
else {
nassertv((geom->_x_texel_ratio.size() >= geom->get_num_prims()));
nassertv(((int)geom->_x_texel_ratio.size() >= geom->get_num_prims()));
x_walk = &geom->_x_texel_ratio[0];
}
@ -998,7 +998,7 @@ draw_sprite(const GeomSprite *geom) {
if (y_overall == true)
scaled_height = geom->_y_texel_ratio[0] * half_height * aspect_ratio;
else {
nassertv((geom->_y_texel_ratio.size() >= geom->get_num_prims()));
nassertv(((int)geom->_y_texel_ratio.size() >= geom->get_num_prims()));
y_walk = &geom->_y_texel_ratio[0];
}
@ -1007,7 +1007,7 @@ draw_sprite(const GeomSprite *geom) {
if (theta_overall == true)
theta = geom->_theta[0];
else {
nassertv((geom->_theta.size() >= geom->get_num_prims()));
nassertv(((int)geom->_theta.size() >= geom->get_num_prims()));
theta_walk = &geom->_theta[0];
}
}
@ -3455,9 +3455,11 @@ get_image_type(PixelBuffer::Type type) {
#endif
case PixelBuffer::T_float:
return GL_FLOAT;
default:
glgsg_cat.error() << "Invalid PixelBuffer::Type value!\n";
return GL_UNSIGNED_BYTE;
}
glgsg_cat.error() << "Invalid PixelBuffer::Type value!\n";
return GL_UNSIGNED_BYTE;
}
////////////////////////////////////////////////////////////////////
@ -3548,12 +3550,13 @@ get_internal_image_format(PixelBuffer::Format format) {
case PixelBuffer::F_blue:
case PixelBuffer::F_luminance:
return GL_LUMINANCE;
}
glgsg_cat.error()
<< "Invalid image format in get_internal_image_format(): "
<< (int)format << "\n";
return GL_RGB;
default:
glgsg_cat.error()
<< "Invalid image format in get_internal_image_format(): "
<< (int)format << "\n";
return GL_RGB;
}
}
////////////////////////////////////////////////////////////////////
@ -3586,20 +3589,21 @@ get_texture_apply_mode_type( TextureApplyProperty::Mode am ) const
GLenum GLGraphicsStateGuardian::
get_depth_func_type(DepthTestProperty::Mode m) const
{
switch(m)
{
case DepthTestProperty::M_never: return GL_NEVER;
case DepthTestProperty::M_less: return GL_LESS;
case DepthTestProperty::M_equal: return GL_EQUAL;
case DepthTestProperty::M_less_equal: return GL_LEQUAL;
case DepthTestProperty::M_greater: return GL_GREATER;
case DepthTestProperty::M_not_equal: return GL_NOTEQUAL;
case DepthTestProperty::M_greater_equal: return GL_GEQUAL;
case DepthTestProperty::M_always: return GL_ALWAYS;
}
switch(m) {
case DepthTestProperty::M_never: return GL_NEVER;
case DepthTestProperty::M_less: return GL_LESS;
case DepthTestProperty::M_equal: return GL_EQUAL;
case DepthTestProperty::M_less_equal: return GL_LEQUAL;
case DepthTestProperty::M_greater: return GL_GREATER;
case DepthTestProperty::M_not_equal: return GL_NOTEQUAL;
case DepthTestProperty::M_greater_equal: return GL_GEQUAL;
case DepthTestProperty::M_always: return GL_ALWAYS;
default:
glgsg_cat.error()
<< "Invalid DepthTestProperty::Mode value" << endl;
return GL_LESS;
}
}
////////////////////////////////////////////////////////////////////
@ -3610,19 +3614,21 @@ get_depth_func_type(DepthTestProperty::Mode m) const
GLenum GLGraphicsStateGuardian::
get_stencil_func_type(StencilProperty::Mode m) const
{
switch(m) {
case StencilProperty::M_never: return GL_NEVER;
case StencilProperty::M_less: return GL_LESS;
case StencilProperty::M_equal: return GL_EQUAL;
case StencilProperty::M_less_equal: return GL_LEQUAL;
case StencilProperty::M_greater: return GL_GREATER;
case StencilProperty::M_not_equal: return GL_NOTEQUAL;
case StencilProperty::M_greater_equal: return GL_GEQUAL;
case StencilProperty::M_always: return GL_ALWAYS;
}
switch(m) {
case StencilProperty::M_never: return GL_NEVER;
case StencilProperty::M_less: return GL_LESS;
case StencilProperty::M_equal: return GL_EQUAL;
case StencilProperty::M_less_equal: return GL_LEQUAL;
case StencilProperty::M_greater: return GL_GREATER;
case StencilProperty::M_not_equal: return GL_NOTEQUAL;
case StencilProperty::M_greater_equal: return GL_GEQUAL;
case StencilProperty::M_always: return GL_ALWAYS;
default:
glgsg_cat.error()
<< "Invalid StencilProperty::Mode value" << endl;
return GL_LESS;
}
}
////////////////////////////////////////////////////////////////////
@ -3660,9 +3666,11 @@ get_fog_mode_type(Fog::Mode m) const {
#ifdef GL_FOG_FUNC_SGIS
case Fog::M_spline: return GL_FOG_FUNC_SGIS;
#endif
default:
glgsg_cat.error() << "Invalid Fog::Mode value" << endl;
return GL_EXP;
}
glgsg_cat.error() << "Invalid Fog::Mode value" << endl;
return GL_EXP;
}
////////////////////////////////////////////////////////////////////

View File

@ -993,9 +993,6 @@ void glxGraphicsWindow::handle_changes(void)
////////////////////////////////////////////////////////////////////
void glxGraphicsWindow::process_event(XEvent event)
{
glxGraphicsPipe* pipe = DCAST(glxGraphicsPipe, _pipe);
bool down = false;
switch (event.type) {
case MappingNotify:
break;
@ -1096,7 +1093,7 @@ void glxGraphicsWindow::process_event(XEvent event)
////////////////////////////////////////////////////////////////////
void glxGraphicsWindow::process_events(void)
{
XEvent event, ahead;
XEvent event;
int got_event;
glxGraphicsWindow* window;

View File

@ -641,6 +641,9 @@ describe_attr(ostream &out, const Geom *geom,
case G_OVERALL:
out << "Overall:" << pad << array[0];
case G_OFF:
break;
}
out << "\n";
}

View File

@ -95,7 +95,7 @@ get_tris() const {
tris.push_back(indices[3]);
}
nassertr(tris.size() == num_tris * 3, PTA_ushort());
nassertr((int)tris.size() == num_tris * 3, PTA_ushort());
return tris;
}

View File

@ -198,7 +198,6 @@ get_tris() const {
int k = 0;
for (int i = 0; i < _numprims; i++) {
ushort indices[3];
if (_vindex.empty()) {
for (int j = 0; j < 3; j++) {
tris.push_back(k++);
@ -210,7 +209,7 @@ get_tris() const {
}
}
nassertr(tris.size() == num_tris * 3, PTA_ushort());
nassertr((int)tris.size() == num_tris * 3, PTA_ushort());
return tris;
}

View File

@ -356,7 +356,6 @@ get_tris() const {
v1 = _vindex[k++];
}
bool even = true;
int len = _primlengths[i] - 2;
for (int j = 0; j < len; j++) {
@ -374,7 +373,7 @@ get_tris() const {
}
}
nassertr(tris.size() == num_tris * 3, PTA_ushort());
nassertr((int)tris.size() == num_tris * 3, PTA_ushort());
return tris;
}

View File

@ -484,7 +484,7 @@ get_tris() const {
}
}
nassertr(tris.size() == num_tris * 3, PTA_ushort());
nassertr((int)tris.size() == num_tris * 3, PTA_ushort());
return tris;
}

View File

@ -320,7 +320,7 @@ set_uchar_rgb_texel(const uchar color[3], int x, int y, int width)
////////////////////////////////////////////////////////////////////
INLINE void PixelBuffer::
store_unsigned_byte(int &index, double value) {
nassertv(index >= 0 && index < _image.size());
nassertv(index >= 0 && index < (int)_image.size());
_image[index++] = (uchar)(value * 255.0);
}
@ -334,7 +334,7 @@ store_unsigned_byte(int &index, double value) {
////////////////////////////////////////////////////////////////////
INLINE void PixelBuffer::
store_unsigned_short(int &index, double value) {
nassertv(index >= 0 && index+1 < _image.size());
nassertv(index >= 0 && index+1 < (int)_image.size());
union {
ushort us;
uchar uc[2];
@ -354,7 +354,7 @@ store_unsigned_short(int &index, double value) {
////////////////////////////////////////////////////////////////////
INLINE double PixelBuffer::
get_unsigned_byte(int &index) const {
nassertr(index >= 0 && index < _image.size(), 0.0);
nassertr(index >= 0 && index < (int)_image.size(), 0.0);
return (double)_image[index++] / 255.0;
}
@ -368,7 +368,7 @@ get_unsigned_byte(int &index) const {
////////////////////////////////////////////////////////////////////
INLINE double PixelBuffer::
get_unsigned_short(int &index) const {
nassertr(index >= 0 && index+1 < _image.size(), 0.0);
nassertr(index >= 0 && index+1 < (int)_image.size(), 0.0);
union {
ushort us;
uchar uc[2];

View File

@ -14,39 +14,38 @@
////////////////////////////////////////////////////////////////////
template<class Visitor, class LevelState>
INLINE DFTraverser<Visitor, LevelState>::
DFTraverser(NodeRelation *arc,
Visitor &visitor,
DFTraverser(Visitor &visitor,
const AttributeWrapper &initial_render_state,
const LevelState &initial_level_state,
TypeHandle graph_type) :
_visitor(visitor),
_initial_render_state(initial_render_state),
_graph_type(graph_type)
{
}
////////////////////////////////////////////////////////////////////
// Function: DFTraverser::start
// Access: Public
// Description: Starts the traversal from the indicated arc.
////////////////////////////////////////////////////////////////////
template<class Visitor, class LevelState>
INLINE void DFTraverser<Visitor, LevelState>::
start(NodeRelation *arc, const LevelState &initial_level_state) {
traverse(arc, _initial_render_state, initial_level_state);
}
////////////////////////////////////////////////////////////////////
// Function: DFTraverser::Constructor
// Function: DFTraverser::start
// Access: Public
// Description:
// Description: Starts the traversal from the indicated node.
////////////////////////////////////////////////////////////////////
template<class Visitor, class LevelState>
INLINE DFTraverser<Visitor, LevelState>::
DFTraverser(Node *root,
Visitor &visitor,
const AttributeWrapper &initial_render_state,
const LevelState &initial_level_state,
TypeHandle graph_type) :
_visitor(visitor),
_initial_render_state(initial_render_state),
_graph_type(graph_type)
{
INLINE void DFTraverser<Visitor, LevelState>::
start(Node *root, const LevelState &initial_level_state) {
LevelState level_state(initial_level_state);
traverse(root, _initial_render_state, level_state);
}
////////////////////////////////////////////////////////////////////
// Function: DFTraverser::Traverse
// Access: Public

View File

@ -26,17 +26,13 @@ public:
typedef TYPENAME Visitor::TransitionWrapper TransitionWrapper;
typedef TYPENAME Visitor::AttributeWrapper AttributeWrapper;
INLINE DFTraverser(NodeRelation *arc,
Visitor &visitor,
INLINE DFTraverser(Visitor &visitor,
const AttributeWrapper &initial_render_state,
const LevelState &initial_level_state,
TypeHandle graph_type);
INLINE DFTraverser(Node *root,
Visitor &visitor,
const AttributeWrapper &initial_render_state,
const LevelState &initial_level_state,
TypeHandle graph_type);
INLINE void start(NodeRelation *arc, const LevelState &initial_level_state);
INLINE void start(Node *root, const LevelState &initial_level_state);
protected:
void traverse(NodeRelation *arc,
AttributeWrapper render_state,
@ -58,8 +54,8 @@ df_traverse(NodeRelation *arc, Visitor &visitor,
const LevelState &initial_level_state,
TypeHandle graph_type) {
DFTraverser<Visitor, LevelState>
dft(arc, visitor, initial_render_state,
initial_level_state, graph_type);
dft(visitor, initial_render_state, graph_type);
dft.start(arc, initial_level_state);
}
template<class Visitor, class AttributeWrapper, class LevelState>
@ -69,8 +65,8 @@ df_traverse(Node *root, Visitor &visitor,
const LevelState &initial_level_state,
TypeHandle graph_type) {
DFTraverser<Visitor, LevelState>
dft(root, visitor, initial_render_state,
initial_level_state, graph_type);
dft(visitor, initial_render_state, graph_type);
dft.start(root, initial_level_state);
}
#include "dftraverser.I"

View File

@ -328,8 +328,7 @@ uncached_wrt_base(const Node *from,
InputIterator2 to_arcs_begin, InputIterator2 to_arcs_end,
TransitionWrapper &result,
TypeHandle graph_type) {
UpdateSeq now = last_graph_update[graph_type];
// UpdateSeq now = last_graph_update[graph_type];
TransitionWrapper net_from_trans = TransitionWrapper::init_from(result);
get_uncached_net_transition(from, from_arcs_begin, from_arcs_end,

View File

@ -155,7 +155,7 @@ get_num_vertices() const {
////////////////////////////////////////////////////////////////////
INLINE Vertexf LineSegs::
get_vertex(int vertex) const {
nassertr(vertex >= 0 && vertex < _created_verts.size(),
nassertr(vertex >= 0 && vertex < (int)_created_verts.size(),
Vertexf(0.0, 0.0, 0.0));
return _created_verts[vertex];
}
@ -171,7 +171,7 @@ get_vertex(int vertex) const {
////////////////////////////////////////////////////////////////////
INLINE void LineSegs::
set_vertex(int vertex, const Vertexf &vert) {
nassertv(vertex >= 0 && vertex < _created_verts.size());
nassertv(vertex >= 0 && vertex < (int)_created_verts.size());
_created_verts[vertex] = vert;
}
@ -196,7 +196,7 @@ set_vertex(int vertex, float x, float y, float z) {
////////////////////////////////////////////////////////////////////
INLINE Colorf LineSegs::
get_vertex_color(int vertex) const {
nassertr(vertex >= 0 && vertex < _created_colors.size(),
nassertr(vertex >= 0 && vertex < (int)_created_colors.size(),
Colorf(0.0, 0.0, 0.0, 0.0));
return _created_colors[vertex];
}
@ -209,7 +209,7 @@ get_vertex_color(int vertex) const {
////////////////////////////////////////////////////////////////////
INLINE void LineSegs::
set_vertex_color(int vertex, const Colorf &color) {
nassertv(vertex >= 0 && vertex < _created_verts.size());
nassertv(vertex >= 0 && vertex < (int)_created_verts.size());
_created_colors[vertex] = color;
}

View File

@ -163,7 +163,7 @@ create(GeomNode *previous, bool) {
_created_verts.push_back((*sl)._point);
_created_colors.push_back((*sl)._color);
v++;
nassertr(v == _created_verts.size(), previous);
nassertr(v == (int)_created_verts.size(), previous);
}
}

View File

@ -20,13 +20,15 @@ static INLINE float scale_t(float t, float start, float end) {
}
Lerp::Lerp(LerpFunctor* func, float endt, LerpBlendType* blend)
: _func(func), _startt(0.), _endt(endt), _blend(blend), _t(0.),
_delta(1.) {}
: _blend(blend), _func(func), _startt(0.), _endt(endt),
_delta(1.), _t(0.) {}
Lerp::Lerp(LerpFunctor* func, float startt, float endt,
LerpBlendType* blend) : _func(func), _startt(startt),
_endt(endt), _blend(blend),
_t(startt), _delta(1.) {}
LerpBlendType* blend) : _blend(blend), _func(func),
_startt(startt),
_endt(endt),
_delta(1.),
_t(startt) {}
Lerp::Lerp(const Lerp& c) : _blend(c._blend), _func(c._func), _event(c._event),
_startt(c._startt), _endt(c._endt),
@ -93,13 +95,13 @@ std::string Lerp::get_end_event(void) const {
AutonomousLerp::AutonomousLerp(LerpFunctor* func, float endt,
LerpBlendType* blend, EventHandler* handler)
: _func(func), _startt(0.), _endt(endt), _blend(blend), _t(0.),
_handler(handler) {}
: _blend(blend), _func(func), _handler(handler),
_startt(0.), _endt(endt), _t(0.) {}
AutonomousLerp::AutonomousLerp(LerpFunctor* func, float startt, float endt,
LerpBlendType* blend, EventHandler* handler)
: _func(func), _startt(startt), _endt(endt), _blend(blend), _t(startt),
_handler(handler) {}
: _blend(blend), _func(func), _handler(handler),
_startt(startt), _endt(endt), _t(startt) {}
AutonomousLerp::AutonomousLerp(const AutonomousLerp& c) : _blend(c._blend),
_func(c._func),

View File

@ -148,7 +148,7 @@ private:
template <class value>
SimpleLerpFunctor<value>::SimpleLerpFunctor(const SimpleLerpFunctor<value>& c)
: _start(c._start), _end(c._end), _diff_cache(c._diff_cache), LerpFunctor(c)
: LerpFunctor(c), _start(c._start), _end(c._end), _diff_cache(c._diff_cache)
{}
template <class value>

View File

@ -28,7 +28,7 @@ class EXPCL_PANDA Light : virtual public ReferenceCount
public:
Light( void ) { _color.set(0.0, 0.0, 0.0, 1.0); }
~Light( void ) { }
virtual ~Light( void ) { }
virtual void apply( GraphicsStateGuardian* gsg ) = 0;

View File

@ -115,9 +115,9 @@ bool Spotlight::make_image(Texture* texture, float radius)
color[1] = (int)(_color[1] * 255.0f);
color[2] = (int)(_color[2] * 255.0f);
float cutoff = get_cutoff_angle();
float dist = 1 / (float)tan(cutoff);
int bufsize = size * size * 3;
// float cutoff = get_cutoff_angle();
// float dist = 1 / (float)tan(cutoff);
// int bufsize = size * size * 3;
int half_width = (size - 2) / 2;
float dXY = 1 / (float)half_width;
float Y = dXY + dXY;

View File

@ -14,7 +14,7 @@ void IoPtaDatagramLinMath<LinMathElement>::
write_datagram(Datagram &dest, CPTA(LinMathElement) array)
{
dest.add_uint32(array.size());
for(int i = 0; i < array.size(); i++)
for(int i = 0; i < (int)array.size(); i++)
{
array[i].write_datagram(dest);
}

View File

@ -821,8 +821,6 @@ translate_mat(NumType tx, NumType ty) {
template<class NumType>
LMatrix3<NumType> LMatrix3<NumType>::
rotate_mat(NumType angle) {
LMatrix3<NumType> mat;
double s = sin(deg_2_rad(angle));
double c = cos(deg_2_rad(angle));

View File

@ -1161,6 +1161,7 @@ convert_mat(CoordinateSystem from, CoordinateSystem to) {
case CS_yup_left: return z_to_y_up_mat();
case CS_zup_right: return scale_mat(1.0, -1.0, 1.0);
case CS_yup_right: return scale_mat(1.0, -1.0, 1.0) * z_to_y_up_mat();
default: break;
}
break;
@ -1170,6 +1171,7 @@ convert_mat(CoordinateSystem from, CoordinateSystem to) {
case CS_yup_left: return ident_mat();
case CS_zup_right: return scale_mat(1.0, 1.0, -1.0) * y_to_z_up_mat();
case CS_yup_right: return scale_mat(1.0, 1.0, -1.0);
default: break;
}
break;
@ -1179,6 +1181,7 @@ convert_mat(CoordinateSystem from, CoordinateSystem to) {
case CS_yup_left: return scale_mat(1.0, -1.0, 1.0) * z_to_y_up_mat();
case CS_zup_right: return ident_mat();
case CS_yup_right: return z_to_y_up_mat();
default: break;
}
break;
@ -1188,8 +1191,12 @@ convert_mat(CoordinateSystem from, CoordinateSystem to) {
case CS_yup_left: return scale_mat(1.0, 1.0, -1.0);
case CS_zup_right: return y_to_z_up_mat();
case CS_yup_right: return ident_mat();
default: break;
}
break;
default:
break;
}
linmath_cat.error()

View File

@ -275,10 +275,12 @@ up(CoordinateSystem cs) {
case CS_yup_right:
case CS_yup_left:
return LVector3<NumType>(0.0, 1.0, 0.0);
default:
linmath_cat.error()
<< "Invalid coordinate system!\n";
return LVector3<NumType>(0.0, 0.0, 0.0);
}
linmath_cat.error()
<< "Invalid coordinate system!\n";
return LVector3<NumType>(0.0, 0.0, 0.0);
}
////////////////////////////////////////////////////////////////////
@ -317,10 +319,12 @@ forward(CoordinateSystem cs) {
case CS_yup_left:
return LVector3<NumType>(0.0, 0.0, 1.0);
default:
linmath_cat.error()
<< "Invalid coordinate system!\n";
return LVector3<NumType>(0.0, 0.0, 0.0);
}
linmath_cat.error()
<< "Invalid coordinate system!\n";
return LVector3<NumType>(0.0, 0.0, 0.0);
}
////////////////////////////////////////////////////////////////////

View File

@ -76,18 +76,17 @@ get_user_alpha(void) const {
////////////////////////////////////////////////////////////////////
INLINE float BaseParticleRenderer::
get_cur_alpha(BaseParticle* bp) {
switch(_alpha_mode)
{
case PR_ALPHA_OUT:
return 1.0f - bp->get_parameterized_age();
break;
case PR_ALPHA_IN:
return bp->get_parameterized_age();
break;
case PR_ALPHA_USER:
return _user_alpha;
break;
switch(_alpha_mode) {
case PR_ALPHA_OUT:
return 1.0f - bp->get_parameterized_age();
case PR_ALPHA_IN:
return bp->get_parameterized_age();
case PR_ALPHA_USER:
return _user_alpha;
default:
return 1.0; // should not get here
}
return 1.0; // should not get here
}

View File

@ -17,7 +17,7 @@
GeomParticleRenderer::
GeomParticleRenderer(ParticleRendererAlphaMode am, Node *geom_node) :
_geom_node(geom_node), _pool_size(0), BaseParticleRenderer(am) {
BaseParticleRenderer(am), _geom_node(geom_node), _pool_size(0) {
_dead_particle_parent_node = new Node;
@ -33,7 +33,7 @@ GeomParticleRenderer(ParticleRendererAlphaMode am, Node *geom_node) :
GeomParticleRenderer::
GeomParticleRenderer(const GeomParticleRenderer& copy) :
_pool_size(0), BaseParticleRenderer(copy) {
BaseParticleRenderer(copy), _pool_size(0) {
_dead_particle_parent_node = new Node;
@ -133,7 +133,7 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
// run through the particle vector
for (i = 0; i < po_vector.size(); i++) {
for (i = 0; i < (int)po_vector.size(); i++) {
RenderRelation *cur_arc;
cur_particle = (BaseParticle *) po_vector[i].p();

View File

@ -31,8 +31,9 @@ LineParticleRenderer::
LineParticleRenderer(const Colorf& head,
const Colorf& tail,
ParticleRendererAlphaMode alpha_mode) :
_head_color(head), _tail_color(tail),
BaseParticleRenderer(alpha_mode) {
BaseParticleRenderer(alpha_mode),
_head_color(head), _tail_color(tail)
{
_line_primitive = new GeomLine;
init_geoms();
}
@ -140,7 +141,6 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
BaseParticle *cur_particle;
int cur_index = 0;
int remaining_particles = ttl_particles;
int i;
@ -154,7 +154,7 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
// run through the array
for (i = 0; i < po_vector.size(); i++) {
for (i = 0; i < (int)po_vector.size(); i++) {
cur_particle = (BaseParticle *) po_vector[i].p();
if (cur_particle->get_alive() == false)

View File

@ -29,7 +29,7 @@
////////////////////////////////////////////////////////////////////
ParticleSystem::
ParticleSystem(int pool_size) :
_particle_pool_size(pool_size), Physical(pool_size, false)
Physical(pool_size, false), _particle_pool_size(pool_size)
{
_birth_rate = 0.0f;
_tics_since_birth = _birth_rate;
@ -64,9 +64,10 @@ ParticleSystem(int pool_size) :
////////////////////////////////////////////////////////////////////
ParticleSystem::
ParticleSystem(const ParticleSystem& copy) :
Physical(copy),
_system_age(0.0f),
_template_system_flag(false),
Physical(copy) {
_template_system_flag(false)
{
_particle_pool_size = copy._particle_pool_size;
_birth_rate = copy._birth_rate;

View File

@ -67,7 +67,7 @@ do_particles(float dt) {
cur = _ps_list.begin();
// cout << "PSM::do_particles on a vector of size " << _ps_list.size() << endl;
int cs = 0;
// int cs = 0;
while (cur != _ps_list.end()) {
ParticleSystem *cur_ps = *cur;

View File

@ -18,11 +18,11 @@ PointParticleRenderer(ParticleRendererAlphaMode am,
PointParticleBlendType bt,
ParticleRendererBlendMethod bm,
const Colorf& sc, const Colorf& ec) :
_point_size(point_size),
_blend_type(bt), _blend_method(bm),
BaseParticleRenderer(am),
_start_color(sc), _end_color(ec),
BaseParticleRenderer(am) {
_point_size(point_size),
_blend_type(bt), _blend_method(bm)
{
_point_primitive = new GeomPoint;
init_geoms();
}
@ -35,9 +35,9 @@ PointParticleRenderer(ParticleRendererAlphaMode am,
PointParticleRenderer::
PointParticleRenderer(const PointParticleRenderer& copy) :
_max_pool_size(0),
BaseParticleRenderer(copy) {
BaseParticleRenderer(copy),
_max_pool_size(0)
{
_blend_type = copy._blend_type;
_blend_method = copy._blend_method;
_start_color = copy._start_color;
@ -197,7 +197,6 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
BaseParticle *cur_particle;
int cur_index = 0;
int remaining_particles = ttl_particles;
int i;
@ -211,7 +210,7 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
// run through every filled slot
for (i = 0; i < po_vector.size(); i++) {
for (i = 0; i < (int)po_vector.size(); i++) {
cur_particle = (BaseParticle *) po_vector[i].p();
if (cur_particle->get_alive() == false)

View File

@ -15,10 +15,11 @@
SparkleParticleRenderer::
SparkleParticleRenderer(void) :
BaseParticleRenderer(PR_ALPHA_NONE),
_center_color(Colorf(1.0f, 1.0f, 1.0f, 1.0f)),
_edge_color(Colorf(1.0f, 1.0f, 1.0f, 1.0f)),
_birth_radius(0.1f), _death_radius(0.1f),
BaseParticleRenderer(PR_ALPHA_NONE) {
_birth_radius(0.1f), _death_radius(0.1f)
{
_line_primitive = new GeomLine;
init_geoms();
}
@ -34,9 +35,10 @@ SparkleParticleRenderer(const Colorf& center, const Colorf& edge,
float birth_radius, float death_radius,
SparkleParticleLifeScale life_scale,
ParticleRendererAlphaMode alpha_mode) :
BaseParticleRenderer(alpha_mode),
_center_color(center), _edge_color(edge), _birth_radius(birth_radius),
_death_radius(death_radius), _life_scale(life_scale),
BaseParticleRenderer(alpha_mode) {
_death_radius(death_radius), _life_scale(life_scale)
{
_line_primitive = new GeomLine;
init_geoms();
}
@ -147,7 +149,6 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
BaseParticle *cur_particle;
int cur_index = 0;
int remaining_particles = ttl_particles;
int i;
@ -161,7 +162,7 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
// run through the array
for (i = 0; i < po_vector.size(); i++) {
for (i = 0; i < (int)po_vector.size(); i++) {
cur_particle = (BaseParticle *) po_vector[i].p();
if (cur_particle->get_alive() == false)

View File

@ -15,18 +15,19 @@
////////////////////////////////////////////////////////////////////
SpriteParticleRenderer::
SpriteParticleRenderer(Texture *tex) :
_animate_x_ratio(false),
_animate_y_ratio(false),
_animate_theta(false),
_blend_method(PP_BLEND_LINEAR),
_pool_size(0),
BaseParticleRenderer(PR_ALPHA_NONE),
_color(Colorf(1.0f, 1.0f, 1.0f, 1.0f)),
_initial_x_texel_ratio(0.02f),
_final_x_texel_ratio(0.02f),
_initial_y_texel_ratio(0.02f),
_final_y_texel_ratio(0.02f),
_theta(0.0f),
_color(Colorf(1.0f, 1.0f, 1.0f, 1.0f)),
BaseParticleRenderer(PR_ALPHA_NONE) {
_animate_x_ratio(false),
_animate_y_ratio(false),
_animate_theta(false),
_blend_method(PP_BLEND_LINEAR),
_pool_size(0)
{
_sprite_primitive = new GeomSprite(tex);
init_geoms();
}
@ -38,7 +39,7 @@ SpriteParticleRenderer(Texture *tex) :
////////////////////////////////////////////////////////////////////
SpriteParticleRenderer::
SpriteParticleRenderer(const SpriteParticleRenderer& copy) :
_pool_size(0), BaseParticleRenderer(copy) {
BaseParticleRenderer(copy), _pool_size(0) {
_animate_x_ratio = copy._animate_x_ratio;
_animate_y_ratio = copy._animate_y_ratio;
_animate_theta = copy._animate_theta;
@ -170,7 +171,6 @@ void SpriteParticleRenderer::
render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
BaseParticle *cur_particle;
int cur_index = 0;
int remaining_particles = ttl_particles;
int i;
@ -194,7 +194,7 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
_aabb_max.set(-99999.0f, -99999.0f, -99999.0f);
// run through every filled slot
for (i = 0; i < po_vector.size(); i++) {
for (i = 0; i < (int)po_vector.size(); i++) {
cur_particle = (BaseParticle *) po_vector[i].p();
if (cur_particle->get_alive() == false)

View File

@ -18,7 +18,7 @@ clear(void) {
////////////////////////////////////////////////////////////////////
INLINE BaseForce *ForceNode::
get_force(int index) const {
nassertr(index >= 0 && index < _forces.size(),
nassertr(index >= 0 && index < (int)_forces.size(),
(BaseForce *) NULL);
return _forces[index];
}

View File

@ -82,7 +82,7 @@ add_forces_from(const ForceNode &other) {
////////////////////////////////////////////////////////////////////
void ForceNode::
remove_force(int index) {
nassertv(index >= 0 && index <= _forces.size());
nassertv(index >= 0 && index <= (int)_forces.size());
vector< PT(BaseForce) >::iterator remove;
remove = _forces.begin() + index;

View File

@ -80,7 +80,7 @@ child_integrate(Physical *physical,
// run through each acting force and sum it
LVector3f f;
LMatrix4f force_to_object_xform;
// LMatrix4f force_to_object_xform;
ForceNode *force_node;
vector< PT(LinearForce) >::const_iterator f_cur;

View File

@ -18,7 +18,7 @@ clear(void) {
////////////////////////////////////////////////////////////////////
INLINE Physical *PhysicalNode::
get_physical(int index) const {
nassertr(index >= 0 && index < _physicals.size(),
nassertr(index >= 0 && index < (int)_physicals.size(),
(Physical *) NULL);
return _physicals[index];
}

View File

@ -82,7 +82,7 @@ add_physicals_from(const PhysicalNode &other) {
////////////////////////////////////////////////////////////////////
void PhysicalNode::
remove_physical(int index) {
nassertv(index >= 0 && index <= _physicals.size());
nassertv(index >= 0 && index <= (int)_physicals.size());
vector< PT(Physical) >::iterator remove;
remove = _physicals.begin() + index;

View File

@ -56,7 +56,7 @@ add_switch(float in, float out) {
////////////////////////////////////////////////////////////////////
INLINE bool LODNode::
set_switch(int index, float in, float out) {
nassertr(index >= 0 && index < _lod._switch_vector.size(), false);
nassertr(index >= 0 && index < (int)_lod._switch_vector.size(), false);
_lod._switch_vector[index].set_range(in, out);
return true;
}

View File

@ -707,6 +707,9 @@ apply(double x, double y, bool any_button) {
case CS_yup_left:
step[1] = 0.0;
break;
default:
break;
}
_xyz += step;