mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -04:00
squelch some more compiler warnings
This commit is contained in:
parent
5cdc46bf0b
commit
4785161374
@ -714,7 +714,7 @@ $[cdefine USE_DELETED_CHAIN]
|
||||
$[cdefine WANT_NATIVE_NET]
|
||||
|
||||
/* Turn off warnings for using scanf and such */
|
||||
#if $[or $[eq $[USE_COMPILER],MSVC9], $[USE_COMPILER],MSVC9x64]
|
||||
#if $[or $[eq $[USE_COMPILER],MSVC9], $[eq $[USE_COMPILER],MSVC9x64]]
|
||||
#print Will ignore CRT_SECURE warnings for MSVC9
|
||||
$[cdefine _CRT_SECURE_NO_WARNINGS]
|
||||
# pragma warning( disable : 4996 4275 4267 4099 4049 4013 4005 )
|
||||
|
@ -336,9 +336,12 @@ seekoff(streamoff off, ios_seekdir dir, ios_openmode which) {
|
||||
}
|
||||
#else
|
||||
// Posix case.
|
||||
new_pos = lseek(_fd, off, SEEK_END);
|
||||
if (new_pos == -1) {
|
||||
return -1;
|
||||
{
|
||||
off_t li = lseek(_fd, off, SEEK_END);
|
||||
if (li == (size_t)-1) {
|
||||
return -1;
|
||||
}
|
||||
new_pos = (size_t)li;
|
||||
}
|
||||
#endif // _WIN32
|
||||
break;
|
||||
|
@ -398,7 +398,7 @@ get_call_str(const string &container, const vector_string &pexprs) const {
|
||||
if (_cpptype != NULL) {
|
||||
// Fix nested classes by replacing :: with __
|
||||
char* nested_name = strdup(_cpptype->get_local_name(&parser).c_str());
|
||||
for (int i = 0; i < strlen(nested_name); ++i) {
|
||||
for (size_t i = 0; i < strlen(nested_name); ++i) {
|
||||
if (nested_name[i] == ':') {
|
||||
nested_name[i] = '_';
|
||||
}
|
||||
@ -681,7 +681,7 @@ setup_properties(const InterrogateFunction &ifunc, InterfaceMaker *interface_mak
|
||||
}
|
||||
|
||||
} else if (fname == "size" || fname == "__len__") {
|
||||
if (_parameters.size() == first_param &&
|
||||
if ((int)_parameters.size() == first_param &&
|
||||
TypeManager::is_integer(_return_type->get_new_type())) {
|
||||
// It receives no parameters, and returns an integer.
|
||||
_flags |= F_size;
|
||||
|
@ -118,8 +118,6 @@ InterfaceMaker::Object::
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void InterfaceMaker::Object::
|
||||
check_protocols() {
|
||||
InterrogateDatabase *idb = InterrogateDatabase::get_ptr();
|
||||
|
||||
int flags = 0;
|
||||
|
||||
Functions::const_iterator fi;
|
||||
|
@ -46,38 +46,39 @@ OpenALAudioSound(OpenALAudioManager* manager,
|
||||
int mode) :
|
||||
_movie(movie),
|
||||
_sd(NULL),
|
||||
_loops_completed(0),
|
||||
_playing_rate(0.0),
|
||||
_playing_loops(0),
|
||||
_playing_rate(0.0),
|
||||
_loops_completed(0),
|
||||
_source(0),
|
||||
_manager(manager),
|
||||
_basename(movie->get_filename().get_basename()),
|
||||
_volume(1.0f),
|
||||
_balance(0),
|
||||
_loop_count(1),
|
||||
_length(0.0),
|
||||
_start_time(0.0),
|
||||
_play_rate(1.0),
|
||||
_positional(positional),
|
||||
_min_dist(3.28f),
|
||||
_max_dist(1000000000.0f),
|
||||
_drop_off_factor(1.0f),
|
||||
_length(0.0),
|
||||
_loop_count(1),
|
||||
_desired_mode(mode),
|
||||
_start_time(0.0),
|
||||
_current_time(0.0),
|
||||
_basename(movie->get_filename().get_basename()),
|
||||
_active(true),
|
||||
_paused(false),
|
||||
_desired_mode(mode)
|
||||
_paused(false)
|
||||
{
|
||||
_location[0] = 0;
|
||||
_location[1] = 0;
|
||||
_location[2] = 0;
|
||||
|
||||
_velocity[0] = 0;
|
||||
_velocity[1] = 0;
|
||||
_velocity[2] = 0;
|
||||
|
||||
_min_dist = 3.28f; _max_dist = 1000000000.0f;
|
||||
_drop_off_factor = 1.0f;
|
||||
|
||||
_positional = positional;
|
||||
|
||||
_location[0] = 0.0f;
|
||||
_location[1] = 0.0f;
|
||||
_location[2] = 0.0f;
|
||||
_velocity[0] = 0.0f;
|
||||
_velocity[1] = 0.0f;
|
||||
_velocity[2] = 0.0f;
|
||||
|
||||
require_sound_data();
|
||||
if (_manager == 0) return;
|
||||
if (_manager == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
_length = _sd->_length;
|
||||
if (positional) {
|
||||
if (_sd->_channels != 1) {
|
||||
@ -506,7 +507,7 @@ push_fresh_buffers() {
|
||||
int rate = cursor->audio_rate();
|
||||
|
||||
int fill = 0;
|
||||
for (int i=0; i<_stream_queued.size(); i++) {
|
||||
for (size_t i = 0; i < _stream_queued.size(); i++) {
|
||||
fill += _stream_queued[i]._samples;
|
||||
}
|
||||
|
||||
|
@ -22,9 +22,9 @@
|
||||
INLINE MovingPartBase::
|
||||
MovingPartBase(const MovingPartBase ©) :
|
||||
PartGroup(copy),
|
||||
_forced_channel(copy._forced_channel),
|
||||
_num_effective_channels(0),
|
||||
_effective_control(NULL)
|
||||
_effective_control(NULL),
|
||||
_forced_channel(copy._forced_channel)
|
||||
{
|
||||
// We don't copy the bound channels. We do copy the forced_channel,
|
||||
// though this is just a pointerwise copy.
|
||||
|
@ -84,12 +84,12 @@ INLINE CollisionBox::
|
||||
CollisionBox(const CollisionBox ©) :
|
||||
CollisionSolid(copy),
|
||||
_center(copy._center),
|
||||
_x( copy._x ),
|
||||
_y( copy._y ),
|
||||
_z( copy._z ),
|
||||
_min( copy._min),
|
||||
_max( copy._max),
|
||||
_radius( copy._radius )
|
||||
_min(copy._min),
|
||||
_max(copy._max),
|
||||
_x(copy._x ),
|
||||
_y(copy._y ),
|
||||
_z(copy._z ),
|
||||
_radius(copy._radius )
|
||||
{
|
||||
for(int v = 0; v < 8; v++)
|
||||
_vertex[v] = copy._vertex[v];
|
||||
@ -350,13 +350,13 @@ operator = (const CollisionBox::PointDef ©) {
|
||||
_p = copy._p;
|
||||
_v = copy._v;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CollisionBox::get_plane_points
|
||||
// Access: Public
|
||||
// Description: returns the points that form the nth plane
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE CollisionBox::Points CollisionBox::
|
||||
get_plane_points( int n ){
|
||||
return _points[n];
|
||||
get_plane_points(int n) {
|
||||
return _points[n];
|
||||
}
|
||||
|
@ -12,8 +12,6 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "collisionDSSolid.h"
|
||||
#include "collisionBox.h"
|
||||
#include "collisionLine.h"
|
||||
#include "collisionRay.h"
|
||||
@ -76,7 +74,7 @@ setup_box(){
|
||||
array[2] = get_point(plane_def[plane][2]);
|
||||
array[3] = get_point(plane_def[plane][3]);
|
||||
setup_points(array, array+4, plane);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -149,9 +147,9 @@ void CollisionBox::
|
||||
xform(const LMatrix4f &mat) {
|
||||
_center = _center * mat;
|
||||
for(int v = 0; v < 8; v++)
|
||||
_vertex[v] = _vertex[v] * mat;
|
||||
_vertex[v] = _vertex[v] * mat;
|
||||
for(int p = 0; p < 6 ; p++)
|
||||
_planes[p] = set_plane(p);
|
||||
_planes[p] = set_plane(p);
|
||||
_x = _vertex[0].get_x()-_center.get_x();
|
||||
_y = _vertex[0].get_y()-_center.get_y();
|
||||
_z = _vertex[0].get_z()-_center.get_z();
|
||||
@ -171,7 +169,7 @@ xform(const LMatrix4f &mat) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
LPoint3f CollisionBox::
|
||||
get_collision_origin() const {
|
||||
return _center;
|
||||
return _center;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -277,7 +275,8 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
|
||||
float from_radius = csqrt(from_radius_2);
|
||||
|
||||
int ip;
|
||||
float max_dist,dist;
|
||||
float max_dist = 0.0;
|
||||
float dist = 0.0;
|
||||
bool intersect;
|
||||
Planef plane;
|
||||
LVector3f normal;
|
||||
@ -288,57 +287,57 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
|
||||
continue;
|
||||
}
|
||||
if (wrt_prev_space != wrt_space) {
|
||||
// If we have a delta between the previous position and the
|
||||
// current position, we use that to determine some more properties
|
||||
// of the collision.
|
||||
LPoint3f b = from_center;
|
||||
LPoint3f a = sphere->get_center() * wrt_prev_space->get_mat();
|
||||
LVector3f delta = b - a;
|
||||
// If we have a delta between the previous position and the
|
||||
// current position, we use that to determine some more properties
|
||||
// of the collision.
|
||||
LPoint3f b = from_center;
|
||||
LPoint3f a = sphere->get_center() * wrt_prev_space->get_mat();
|
||||
LVector3f delta = b - a;
|
||||
|
||||
// First, there is no collision if the "from" object is definitely
|
||||
// moving in the same direction as the plane's normal.
|
||||
float dot = delta.dot(plane.get_normal());
|
||||
if (dot > 0.1f) {
|
||||
continue; // no intersection
|
||||
}
|
||||
// First, there is no collision if the "from" object is definitely
|
||||
// moving in the same direction as the plane's normal.
|
||||
float dot = delta.dot(plane.get_normal());
|
||||
if (dot > 0.1f) {
|
||||
continue; // no intersection
|
||||
}
|
||||
|
||||
if (IS_NEARLY_ZERO(dot)) {
|
||||
// If we're moving parallel to the plane, the sphere is tested
|
||||
// at its final point. Leave it as it is.
|
||||
if (IS_NEARLY_ZERO(dot)) {
|
||||
// If we're moving parallel to the plane, the sphere is tested
|
||||
// at its final point. Leave it as it is.
|
||||
|
||||
} else {
|
||||
// Otherwise, we're moving into the plane; the sphere is tested
|
||||
// at the point along its path that is closest to intersecting
|
||||
// the plane. This may be the actual intersection point, or it
|
||||
// may be the starting point or the final point.
|
||||
// dot is equal to the (negative) magnitude of 'delta' along the
|
||||
// direction of the plane normal
|
||||
// t = ratio of (distance from start pos to plane) to (distance
|
||||
// from start pos to end pos), along axis of plane normal
|
||||
float dist_to_p = plane.dist_to_plane(a);
|
||||
t = (dist_to_p / -dot);
|
||||
|
||||
// also compute the actual contact point and time of contact
|
||||
// for handlers that need it
|
||||
actual_t = ((dist_to_p - from_radius) / -dot);
|
||||
actual_t = min(1.0f, max(0.0f, actual_t));
|
||||
contact_point = a + (actual_t * delta);
|
||||
} else {
|
||||
// Otherwise, we're moving into the plane; the sphere is tested
|
||||
// at the point along its path that is closest to intersecting
|
||||
// the plane. This may be the actual intersection point, or it
|
||||
// may be the starting point or the final point.
|
||||
// dot is equal to the (negative) magnitude of 'delta' along the
|
||||
// direction of the plane normal
|
||||
// t = ratio of (distance from start pos to plane) to (distance
|
||||
// from start pos to end pos), along axis of plane normal
|
||||
float dist_to_p = plane.dist_to_plane(a);
|
||||
t = (dist_to_p / -dot);
|
||||
|
||||
// also compute the actual contact point and time of contact
|
||||
// for handlers that need it
|
||||
actual_t = ((dist_to_p - from_radius) / -dot);
|
||||
actual_t = min(1.0f, max(0.0f, actual_t));
|
||||
contact_point = a + (actual_t * delta);
|
||||
|
||||
if (t >= 1.0f) {
|
||||
// Leave it where it is.
|
||||
if (t >= 1.0f) {
|
||||
// Leave it where it is.
|
||||
|
||||
} else if (t < 0.0f) {
|
||||
} else if (t < 0.0f) {
|
||||
from_center = a;
|
||||
moved_from_center = true;
|
||||
} else {
|
||||
from_center = a + t * delta;
|
||||
moved_from_center = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
from_center = a + t * delta;
|
||||
moved_from_center = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
normal = (has_effective_normal() && sphere->get_respect_effective_normal()) ? get_effective_normal() : plane.get_normal();
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
/*if (!IS_THRESHOLD_EQUAL(normal.length_squared(), 1.0f, 0.001), NULL) {
|
||||
std::cout
|
||||
@ -349,14 +348,14 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
|
||||
}*/
|
||||
#endif
|
||||
|
||||
// The nearest point within the plane to our center is the
|
||||
// intersection of the line (center, center - normal) with the plane.
|
||||
|
||||
// The nearest point within the plane to our center is the
|
||||
// intersection of the line (center, center - normal) with the plane.
|
||||
|
||||
if (!plane.intersects_line(dist, from_center, -(plane.get_normal()))) {
|
||||
// No intersection with plane? This means the plane's effective
|
||||
// normal was within the plane itself. A useless polygon.
|
||||
continue;
|
||||
}
|
||||
// No intersection with plane? This means the plane's effective
|
||||
// normal was within the plane itself. A useless polygon.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dist > from_radius || dist < -from_radius) {
|
||||
// No intersection with the plane.
|
||||
@ -419,7 +418,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
|
||||
intersect = true;
|
||||
}
|
||||
if( !intersect )
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
if (collide_cat.is_debug()) {
|
||||
collide_cat.debug()
|
||||
@ -465,14 +464,15 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
|
||||
LVector3f from_direction = ray->get_direction() * wrt_mat;
|
||||
|
||||
int i, j;
|
||||
float t, near_t;
|
||||
float t;
|
||||
float near_t = 0.0;
|
||||
bool intersect;
|
||||
Planef plane;
|
||||
Planef near_plane;
|
||||
|
||||
//Returns the details about the first plane of the box that the ray
|
||||
//intersects.
|
||||
for(i = 0, intersect = false, t = 0, j = 0; i < 6 && j < 2; i++) {
|
||||
for (i = 0, intersect = false, t = 0, j = 0; i < 6 && j < 2; i++) {
|
||||
plane = get_plane(i);
|
||||
|
||||
if (!plane.intersects_line(t, from_origin, from_direction)) {
|
||||
@ -492,7 +492,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
|
||||
continue;
|
||||
}
|
||||
intersect = true;
|
||||
if(j) {
|
||||
if (j) {
|
||||
if(t < near_t) {
|
||||
near_plane = plane;
|
||||
near_t = t;
|
||||
@ -504,11 +504,11 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
|
||||
}
|
||||
++j;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(!intersect) {
|
||||
//No intersection with ANY of the box's planes has been detected
|
||||
return NULL;
|
||||
//No intersection with ANY of the box's planes has been detected
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (collide_cat.is_debug()) {
|
||||
@ -548,7 +548,8 @@ test_intersection_from_segment(const CollisionEntry &entry) const {
|
||||
LVector3f from_direction = from_extent - from_origin;
|
||||
|
||||
int i, j;
|
||||
float t, near_t;
|
||||
float t;
|
||||
float near_t = 0.0;
|
||||
bool intersect;
|
||||
Planef plane;
|
||||
Planef near_plane;
|
||||
@ -588,11 +589,11 @@ test_intersection_from_segment(const CollisionEntry &entry) const {
|
||||
}
|
||||
++j;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(!intersect) {
|
||||
//No intersection with ANY of the box's planes has been detected
|
||||
return NULL;
|
||||
//No intersection with ANY of the box's planes has been detected
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (collide_cat.is_debug()) {
|
||||
@ -986,7 +987,7 @@ point_is_inside(const LPoint2f &p, const CollisionBox::Points &points) const {
|
||||
}
|
||||
}
|
||||
if (is_right(p - points[points.size() - 1]._p,
|
||||
points[0]._p - points[points.size() - 1]._p)) {
|
||||
points[0]._p - points[points.size() - 1]._p)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ begin_group() {
|
||||
}
|
||||
_last_colliding.clear();
|
||||
if (_closest_collider) {
|
||||
bool inserted = _last_colliding.insert(_closest_collider).second;
|
||||
_last_colliding.insert(_closest_collider);
|
||||
}
|
||||
_current_colliding.clear();
|
||||
_collider_distance = 0;
|
||||
@ -86,7 +86,7 @@ add_entry(CollisionEntry *entry) {
|
||||
bool CollisionHandlerHighestEvent::
|
||||
end_group() {
|
||||
if (_closest_collider) {
|
||||
bool inserted = _current_colliding.insert(_closest_collider).second;
|
||||
_current_colliding.insert(_closest_collider);
|
||||
}
|
||||
return CollisionHandlerEvent::end_group();
|
||||
}
|
||||
|
@ -478,8 +478,6 @@ test_intersection_from_box(const CollisionEntry &entry) const {
|
||||
|
||||
LPoint3f orig_center = get_center();
|
||||
LPoint3f to_center = orig_center;
|
||||
bool moved_from_center = false;
|
||||
float t = 1.0f;
|
||||
LPoint3f contact_point(from_center);
|
||||
float actual_t = 1.0f;
|
||||
|
||||
@ -487,12 +485,13 @@ test_intersection_from_box(const CollisionEntry &entry) const {
|
||||
float to_radius_2 = to_radius * to_radius;
|
||||
|
||||
int ip;
|
||||
float max_dist,dist;
|
||||
float max_dist = 0.0f;
|
||||
float dist = 0.0f; // initial assignment to squelch silly compiler warning
|
||||
bool intersect;
|
||||
Planef plane;
|
||||
LVector3f normal;
|
||||
|
||||
for( ip = 0, intersect=false; ip < 6 && !intersect; ip++ ){
|
||||
for (ip = 0, intersect=false; ip < 6 && !intersect; ip++) {
|
||||
plane = local_b.get_plane( ip );
|
||||
if (local_b.get_plane_points(ip).size() < 3) {
|
||||
continue;
|
||||
|
@ -64,11 +64,11 @@ SubprocessWindowBuffer(int x_size, int y_size) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
SubprocessWindowBuffer::
|
||||
SubprocessWindowBuffer(const SubprocessWindowBuffer ©) :
|
||||
_mmap_size(copy._mmap_size),
|
||||
_x_size(copy._x_size),
|
||||
_y_size(copy._y_size),
|
||||
_row_size(copy._row_size),
|
||||
_framebuffer_size(copy._framebuffer_size),
|
||||
_mmap_size(copy._mmap_size)
|
||||
_framebuffer_size(copy._framebuffer_size)
|
||||
{
|
||||
memcpy(_this_magic, _magic_number, magic_number_length);
|
||||
_event_in = 0;
|
||||
|
@ -1004,7 +1004,8 @@ string_cs_type(const string &strval) {
|
||||
return CST_inv_sphere;
|
||||
} else if (cmp_nocase_uh(strval, "tube") == 0) {
|
||||
return CST_tube;
|
||||
} else if (cmp_nocase_uh(strval, "floor-mesh") == 0) {
|
||||
} else if (cmp_nocase_uh(strval, "floor-mesh") == 0 ||
|
||||
cmp_nocase_uh(strval, "floormesh") == 0) {
|
||||
return CST_floor_mesh;
|
||||
} else {
|
||||
return CST_none;
|
||||
@ -1491,6 +1492,8 @@ ostream &operator << (ostream &out, EggGroup::CollisionSolidType t) {
|
||||
return out << "InvSphere";
|
||||
case EggGroup::CST_tube:
|
||||
return out << "Tube";
|
||||
case EggGroup::CST_floor_mesh:
|
||||
return out << "FloorMesh";
|
||||
}
|
||||
|
||||
nassertr(false, out);
|
||||
|
@ -550,7 +550,7 @@ has_alpha_channel(int num_components) const {
|
||||
// Function: EggTexture::affects_polygon_alpha
|
||||
// Access: Published
|
||||
// Description: Returns true if this texture's environment type or
|
||||
// combine mode allows the texture to have an affect on
|
||||
// combine mode allows the texture to have an effect on
|
||||
// the polygon's alpha values, false otherwise.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool EggTexture::
|
||||
@ -564,13 +564,13 @@ affects_polygon_alpha() const {
|
||||
case ET_blend:
|
||||
case ET_add:
|
||||
case ET_blend_color_scale:
|
||||
return false;
|
||||
case ET_modulate_glow:
|
||||
case ET_modulate_gloss:
|
||||
case ET_normal:
|
||||
case ET_normal_height:
|
||||
case ET_glow:
|
||||
case ET_gloss:
|
||||
case ET_height:
|
||||
return false;
|
||||
|
||||
case ET_selector:
|
||||
|
@ -1013,7 +1013,7 @@ finish_sort_group() {
|
||||
filter_timeslice_priority();
|
||||
}
|
||||
|
||||
nassertr(_num_tasks == _active.size() + _this_active.size() + _next_active.size() + _sleeping.size(), true);
|
||||
nassertr((size_t)_num_tasks == _active.size() + _this_active.size() + _next_active.size() + _sleeping.size(), true);
|
||||
make_heap(_active.begin(), _active.end(), AsyncTaskSortPriority());
|
||||
|
||||
_current_sort = -INT_MAX;
|
||||
@ -1419,12 +1419,11 @@ do_write(ostream &out, int indent_level) const {
|
||||
|
||||
if (!tasks.empty()) {
|
||||
sort(tasks.begin(), tasks.end(), AsyncTaskSortPriority());
|
||||
TaskHeap::reverse_iterator ti;
|
||||
int current_sort = tasks.back()->get_sort() - 1;
|
||||
|
||||
// Since AsyncTaskSortPriority() sorts backwards (because of STL's
|
||||
// push_heap semantics), we go through the task list in reverse
|
||||
// order to print them forwards.
|
||||
TaskHeap::reverse_iterator ti;
|
||||
for (ti = tasks.rbegin(); ti != tasks.rend(); ++ti) {
|
||||
AsyncTask *task = (*ti);
|
||||
write_task_line(out, indent_level, task, now);
|
||||
|
@ -2044,7 +2044,7 @@ read_subfile(int index, pvector<unsigned char> &result) {
|
||||
_read->seek_read(pos, buffer, num_bytes, count, eof);
|
||||
while (count != 0) {
|
||||
thread_consider_yield();
|
||||
nassertr(count <= max_bytes, false);
|
||||
nassertr(count <= (streamsize)max_bytes, false);
|
||||
result.insert(result.end(), buffer, buffer + (size_t)count);
|
||||
max_bytes -= (size_t)count;
|
||||
pos += count;
|
||||
|
@ -627,10 +627,11 @@ set_heightfield(const Filename &filename, PNMFileType *ftype) {
|
||||
reqy = max(3, (int) pow(2.0, ceil(log((double) max(2, imgheader.get_y_size() - 1)) / log(2.0))) + 1);
|
||||
|
||||
// If it's not a valid size, tell PNMImage to resize it.
|
||||
if (reqx != imgheader.get_x_size() || reqy != imgheader.get_y_size()) {
|
||||
grutil_cat.warning() << "Rescaling heightfield image " << filename
|
||||
<< " from " << imgheader.get_x_size() << "x" << imgheader.get_y_size()
|
||||
<< " to " << reqx << "x" << reqy << " pixels.\n";
|
||||
if (reqx != (unsigned int)imgheader.get_x_size() || reqy != (unsigned int)imgheader.get_y_size()) {
|
||||
grutil_cat.warning()
|
||||
<< "Rescaling heightfield image " << filename
|
||||
<< " from " << imgheader.get_x_size() << "x" << imgheader.get_y_size()
|
||||
<< " to " << reqx << "x" << reqy << " pixels.\n";
|
||||
_heightfield.set_read_size(reqx, reqy);
|
||||
}
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ void MeshDrawer::geometry(NodePath draw_node) {
|
||||
prim_vertex_reader->set_row_unsafe(vidx);
|
||||
prim_uv_reader->set_row_unsafe(vidx);
|
||||
vec[indx_over] = _render.get_relative_point(
|
||||
current_node_path,prim_vertex_reader->get_data3f());
|
||||
current_node_path,prim_vertex_reader->get_data3f());
|
||||
uv[indx_over] = prim_uv_reader->get_data2f();
|
||||
indx_over++;
|
||||
if (indx_over > 2) break;
|
||||
@ -424,8 +424,8 @@ void MeshDrawer::geometry(NodePath draw_node) {
|
||||
|
||||
// draw polygon
|
||||
tri(vec[0],color,uv[0],
|
||||
vec[1],color,uv[1],
|
||||
vec[2],color,uv[2]);
|
||||
vec[1],color,uv[1],
|
||||
vec[2],color,uv[2]);
|
||||
}
|
||||
// if we are over budget just quit
|
||||
if( _clear_index > _end_clear_index) return;
|
||||
@ -447,37 +447,38 @@ void MeshDrawer::geometry(NodePath draw_node) {
|
||||
// parameters.
|
||||
// Frame contains u,v,u-size,v-size quadruple.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void MeshDrawer::link_segment(LVector3f pos, LVector4f frame,
|
||||
float thickness, LVector4f color) {
|
||||
void MeshDrawer::
|
||||
link_segment(LVector3f pos, LVector4f frame,
|
||||
float thickness, LVector4f color) {
|
||||
assert(_render.get_error_type() == NodePath::ET_ok);
|
||||
assert(_camera.get_error_type() == NodePath::ET_ok);
|
||||
/*
|
||||
* X
|
||||
* ---X
|
||||
* ===0---X
|
||||
* ===0===0---X
|
||||
* ===0===0===O---X
|
||||
* ===0===0===0===End
|
||||
*
|
||||
* first call marks position X
|
||||
* second call moves position and promises to draw segment
|
||||
* it can't draw it yet because next segment might bend it
|
||||
* third call finally draws segment
|
||||
* and the chain continues till
|
||||
* link_segment_end to flush the linking segments is called.
|
||||
*/
|
||||
/*
|
||||
* X
|
||||
* ---X
|
||||
* ===0---X
|
||||
* ===0===0---X
|
||||
* ===0===0===O---X
|
||||
* ===0===0===0===End
|
||||
*
|
||||
* first call marks position X
|
||||
* second call moves position and promises to draw segment
|
||||
* it can't draw it yet because next segment might bend it
|
||||
* third call finally draws segment
|
||||
* and the chain continues till
|
||||
* link_segment_end to flush the linking segments is called.
|
||||
*/
|
||||
|
||||
// mark 1st position
|
||||
if(_at_start==0) {
|
||||
_last_pos = pos;
|
||||
_last_thickness = thickness;
|
||||
_last_color = color;
|
||||
_at_start=1;
|
||||
return;
|
||||
}
|
||||
// mark 1st position
|
||||
if(_at_start==0) {
|
||||
_last_pos = pos;
|
||||
_last_thickness = thickness;
|
||||
_last_color = color;
|
||||
_at_start=1;
|
||||
return;
|
||||
}
|
||||
|
||||
LVector3f start = _last_pos;
|
||||
LVector3f stop = pos;
|
||||
LVector3f start = _last_pos;
|
||||
LVector3f stop = pos;
|
||||
|
||||
LVector3f cam_start3d = _camera.get_relative_point(_render, start);
|
||||
LPoint2f cam_start2d = LVector2f();
|
||||
@ -487,9 +488,8 @@ void MeshDrawer::link_segment(LVector3f pos, LVector4f frame,
|
||||
PT(Camera) camera = DCAST(Camera, _camera.node());
|
||||
PT(Lens) lens = camera->get_lens();
|
||||
|
||||
bool start_good = lens->project(cam_start3d, cam_start2d);
|
||||
bool stop_good = lens->project(cam_stop3d, cam_stop2d);
|
||||
//if start_good and stop_good:
|
||||
lens->project(cam_start3d, cam_start2d);
|
||||
lens->project(cam_stop3d, cam_stop2d);
|
||||
|
||||
LVector2f dif = cam_stop2d - cam_start2d;
|
||||
float rotation = atan2(dif.get_x(),dif.get_y());
|
||||
@ -503,12 +503,12 @@ void MeshDrawer::link_segment(LVector3f pos, LVector4f frame,
|
||||
// we need to draw it when we know what the next segment looks like
|
||||
// because it can bend it a little
|
||||
if(_at_start==1) {
|
||||
_last_v1 = now_v1;
|
||||
_last_v2 = now_v2;
|
||||
_last_v3 = now_v3;
|
||||
_last_v4 = now_v4;
|
||||
_at_start = 2;
|
||||
return;
|
||||
_last_v1 = now_v1;
|
||||
_last_v2 = now_v2;
|
||||
_last_v3 = now_v3;
|
||||
_last_v4 = now_v4;
|
||||
_at_start = 2;
|
||||
return;
|
||||
}
|
||||
|
||||
// draw the last segment a little bent
|
||||
@ -524,11 +524,11 @@ void MeshDrawer::link_segment(LVector3f pos, LVector4f frame,
|
||||
float vs = frame.get_w();
|
||||
|
||||
tri(v1, _last_color, LVector2f(u,v),
|
||||
v2, color, LVector2f(u+us,v),
|
||||
v3, color, LVector2f(u+us,v+vs));
|
||||
v2, color, LVector2f(u+us,v),
|
||||
v3, color, LVector2f(u+us,v+vs));
|
||||
tri(v3, color, LVector2f(u+us,v+vs),
|
||||
v4, _last_color, LVector2f(u,v+vs),
|
||||
v1, _last_color, LVector2f(u,v));
|
||||
v4, _last_color, LVector2f(u,v+vs),
|
||||
v1, _last_color, LVector2f(u,v));
|
||||
|
||||
// save this segment
|
||||
_last_v1 = v2;
|
||||
|
@ -63,11 +63,11 @@ CData() :
|
||||
_video_width(1),
|
||||
_video_height(1),
|
||||
_video_length(1.0),
|
||||
_playing(false),
|
||||
_clock(0.0),
|
||||
_play_rate(1.0),
|
||||
_playing(false),
|
||||
_loop_count(1),
|
||||
_loops_total(1)
|
||||
_loops_total(1),
|
||||
_play_rate(1.0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -82,11 +82,11 @@ CData(const CData ©) :
|
||||
_video_width(copy._video_width),
|
||||
_video_height(copy._video_height),
|
||||
_video_length(copy._video_length),
|
||||
_playing(false),
|
||||
_clock(0.0),
|
||||
_play_rate(1.0),
|
||||
_playing(false),
|
||||
_loop_count(1),
|
||||
_loops_total(1)
|
||||
_loops_total(1),
|
||||
_play_rate(1.0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -189,8 +189,6 @@ do_recalculate_image_properties(CDWriter &cdata, const LoaderOptions &options) {
|
||||
if (y_max > x_max) x_max = y_max;
|
||||
}
|
||||
|
||||
int x_size = x_max;
|
||||
int y_size = y_max;
|
||||
if (Texture::get_textures_power_2() != ATS_none) {
|
||||
x_max = up_to_power_2(x_max);
|
||||
y_max = up_to_power_2(y_max);
|
||||
|
@ -118,7 +118,7 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) {
|
||||
nassertr(fast != NULL, -1);
|
||||
|
||||
// Let's be strict about size mismatches, to prevent user error.
|
||||
if (PySequence_Fast_GET_SIZE(fast) != attr_name.size()) {
|
||||
if (PySequence_Fast_GET_SIZE(fast) != (int)attr_name.size()) {
|
||||
PyErr_SetString(PyExc_ValueError, "length mismatch");
|
||||
Py_DECREF(fast);
|
||||
return -1;
|
||||
@ -127,7 +127,7 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) {
|
||||
// Get a pointer to the items, iterate over it and
|
||||
// perform our magic assignment. Fast fast. Oh yeah.
|
||||
PyObject** items = PySequence_Fast_ITEMS(fast);
|
||||
for (int i = 0; i < attr_name.size(); ++i) {
|
||||
for (size_t i = 0; i < attr_name.size(); ++i) {
|
||||
|
||||
PyObject* fl = PyNumber_Float(items[i]);
|
||||
if (fl == NULL) {
|
||||
|
@ -127,7 +127,7 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) {
|
||||
nassertr(fast != NULL, -1);
|
||||
|
||||
// Let's be strict about size mismatches, to prevent user error.
|
||||
if (PySequence_Fast_GET_SIZE(fast) != attr_name.size()) {
|
||||
if (PySequence_Fast_GET_SIZE(fast) != (int)attr_name.size()) {
|
||||
PyErr_SetString(PyExc_ValueError, "length mismatch");
|
||||
Py_DECREF(fast);
|
||||
return -1;
|
||||
@ -136,7 +136,7 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) {
|
||||
// Get a pointer to the items, iterate over it and
|
||||
// perform our magic assignment. Fast fast. Oh yeah.
|
||||
PyObject** items = PySequence_Fast_ITEMS(fast);
|
||||
for (int i = 0; i < attr_name.size(); ++i) {
|
||||
for (size_t i = 0; i < attr_name.size(); ++i) {
|
||||
|
||||
PyObject* fl = PyNumber_Float(items[i]);
|
||||
if (fl == NULL) {
|
||||
|
@ -141,7 +141,7 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) {
|
||||
nassertr(fast != NULL, -1);
|
||||
|
||||
// Let's be strict about size mismatches, to prevent user error.
|
||||
if (PySequence_Fast_GET_SIZE(fast) != attr_name.size()) {
|
||||
if (PySequence_Fast_GET_SIZE(fast) != (int)attr_name.size()) {
|
||||
PyErr_SetString(PyExc_ValueError, "length mismatch");
|
||||
Py_DECREF(fast);
|
||||
return -1;
|
||||
@ -150,7 +150,7 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) {
|
||||
// Get a pointer to the items, iterate over it and
|
||||
// perform our magic assignment. Fast fast. Oh yeah.
|
||||
PyObject** items = PySequence_Fast_ITEMS(fast);
|
||||
for (int i = 0; i < attr_name.size(); ++i) {
|
||||
for (size_t i = 0; i < attr_name.size(); ++i) {
|
||||
|
||||
PyObject* fl = PyNumber_Float(items[i]);
|
||||
if (fl == NULL) {
|
||||
|
@ -592,15 +592,18 @@ setup(float width, int num_lines) {
|
||||
|
||||
switch (text_node->get_align()) {
|
||||
case TextNode::A_left:
|
||||
case TextNode::A_boxed_left:
|
||||
// The default case.
|
||||
break;
|
||||
|
||||
case TextNode::A_center:
|
||||
case TextNode::A_boxed_center:
|
||||
frame[0] = -width / 2.0;
|
||||
frame[1] = width / 2.0;
|
||||
break;
|
||||
|
||||
case TextNode::A_right:
|
||||
case TextNode::A_boxed_right:
|
||||
frame[0] = -width;
|
||||
frame[1] = 0.0f;
|
||||
break;
|
||||
|
@ -302,7 +302,7 @@ call_python_func(PyObject *function, PyObject *args) {
|
||||
|
||||
// Create a new Python thread state data structure, so Python can
|
||||
// properly lock itself.
|
||||
PyObject *result;
|
||||
PyObject *result = NULL;
|
||||
|
||||
if (this == get_main_thread()) {
|
||||
// In the main thread, just call the function.
|
||||
|
@ -62,7 +62,6 @@ FreetypeFont() {
|
||||
FreetypeFont::
|
||||
FreetypeFont(const FreetypeFont ©) :
|
||||
Namable(copy),
|
||||
_face(copy._face),
|
||||
_point_size(copy._point_size),
|
||||
_requested_pixels_per_unit(copy._requested_pixels_per_unit),
|
||||
_tex_pixels_per_unit(copy._tex_pixels_per_unit),
|
||||
@ -71,6 +70,7 @@ FreetypeFont(const FreetypeFont ©) :
|
||||
_native_antialias(copy._native_antialias),
|
||||
_line_height(copy._line_height),
|
||||
_space_advance(copy._space_advance),
|
||||
_face(copy._face),
|
||||
_char_size(copy._char_size),
|
||||
_dpi(copy._dpi),
|
||||
_pixel_width(copy._pixel_width),
|
||||
|
@ -283,7 +283,7 @@ main_tick() {
|
||||
// We have some memory usage on this TypeHandle. See if we
|
||||
// have a collector for it.
|
||||
if (!col.is_valid()) {
|
||||
const char *category;
|
||||
const char *category = "";
|
||||
switch (mc) {
|
||||
case TypeHandle::MC_singleton:
|
||||
category = "Heap:Single";
|
||||
|
@ -304,6 +304,18 @@ write(ostream &out, int indent_level) const {
|
||||
case A_center:
|
||||
out << "A_center\n";
|
||||
break;
|
||||
|
||||
case A_boxed_left:
|
||||
out << "A_boxed_left\n";
|
||||
break;
|
||||
|
||||
case A_boxed_right:
|
||||
out << "A_boxed_right\n";
|
||||
break;
|
||||
|
||||
case A_boxed_center:
|
||||
out << "A_boxed_center\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user