This commit is contained in:
David Rose 2006-01-13 18:38:07 +00:00
parent 44765047d6
commit 572a146c24
138 changed files with 2558 additions and 2558 deletions

View File

@ -68,7 +68,7 @@ help() {
void
write_class_hierarchy(int indent_level, const DCFile &file,
const DCClass *this_dclass) {
const DCClass *this_dclass) {
indent(cout, indent_level)
<< this_dclass->get_name() << "\n";
@ -110,13 +110,13 @@ write_complete_field_list(const DCFile &file) {
const DCField *field = dclass->get_inherited_field(j);
cout << " ";
if (field->get_class() != dclass) {
cout << field->get_class()->get_name() << "::";
cout << field->get_class()->get_name() << "::";
}
cout << field->get_name();
if (field->as_atomic_field() != (DCAtomicField *)NULL ||
field->as_molecular_field() != (DCMolecularField *)NULL) {
// It's a "method".
cout << "()";
field->as_molecular_field() != (DCMolecularField *)NULL) {
// It's a "method".
cout << "()";
}
field->output_keywords(cout);
cout << "\n";

View File

@ -44,9 +44,9 @@ ConfigVariableBool dc_multiple_inheritance
ConfigVariableBool dc_virtual_inheritance
("dc-virtual-inheritance", true,
PRC_DESC("Set this true to support proper virtual inheritance in the "
"dc file, so that diamond-of-death type constructs can be used. "
"This also enables shadowing (overloading) of inherited method "
"names from a base class."));
"dc file, so that diamond-of-death type constructs can be used. "
"This also enables shadowing (overloading) of inherited method "
"names from a base class."));
#endif // WITHIN_PANDA
@ -323,7 +323,7 @@ get_inherited_field(int n) const {
for (pi = _parents.begin(); pi != _parents.end(); ++pi) {
int psize = (*pi)->get_num_inherited_fields();
if (n < psize) {
return (*pi)->get_inherited_field(n);
return (*pi)->get_inherited_field(n);
}
n -= psize;
@ -528,7 +528,7 @@ receive_update_broadcast_required(PyObject *distobj, DatagramIterator &di) const
////////////////////////////////////////////////////////////////////
void DCClass::
receive_update_broadcast_required_owner(PyObject *distobj,
DatagramIterator &di) const {
DatagramIterator &di) const {
#ifdef WITHIN_PANDA
PStatTimer timer(((DCClass *)this)->_class_update_pcollector);
#endif
@ -542,14 +542,14 @@ receive_update_broadcast_required_owner(PyObject *distobj,
field->is_required()) {
packer.begin_unpack(field);
if (field->is_ownrecv()) {
field->receive_update(packer, distobj);
field->receive_update(packer, distobj);
} else {
// It's not an ownrecv field; skip over it. It's difficult
// to filter this on the server, ask Roger for the reason.
packer.unpack_skip();
// It's not an ownrecv field; skip over it. It's difficult
// to filter this on the server, ask Roger for the reason.
packer.unpack_skip();
}
if (!packer.end_unpack()) {
break;
break;
}
}
}

View File

@ -165,13 +165,13 @@ dc_cleanup_parser() {
%%
grammar:
START_DC dc
| START_PARAMETER_VALUE parameter_value
| START_PARAMETER_DESCRIPTION parameter_description
START_DC dc
| START_PARAMETER_VALUE parameter_value
| START_PARAMETER_DESCRIPTION parameter_description
{
parameter_description = $2;
}
;
;
dc:
empty
@ -200,50 +200,50 @@ dc:
slash_identifier:
IDENTIFIER
| slash_identifier '/' IDENTIFIER
| slash_identifier '/' IDENTIFIER
{
$$ = $1 + string("/") + $3;
}
;
;
import_identifier:
slash_identifier
| import_identifier '.' slash_identifier
| import_identifier '.' slash_identifier
{
$$ = $1 + string(".") + $3;
}
;
;
import:
KW_IMPORT import_identifier
KW_IMPORT import_identifier
{
dc_file->add_import_module($2);
}
| KW_FROM import_identifier KW_IMPORT
| KW_FROM import_identifier KW_IMPORT
{
dc_file->add_import_module($2);
}
import_symbol_list_or_star
;
import_symbol_list_or_star
;
import_symbol_list_or_star:
import_symbol_list
| '*'
import_symbol_list
| '*'
{
dc_file->add_import_symbol("*");
}
;
;
import_symbol_list:
slash_identifier
slash_identifier
{
dc_file->add_import_symbol($1);
}
| import_symbol_list ',' slash_identifier
| import_symbol_list ',' slash_identifier
{
dc_file->add_import_symbol($3);
}
;
;
typedef_decl:
KW_TYPEDEF parameter_with_default
@ -261,7 +261,7 @@ typedef_decl:
}
}
}
;
;
keyword_decl:
KW_KEYWORD IDENTIFIER
@ -276,12 +276,12 @@ keyword_decl:
// historical hash code support later.
((DCKeyword *)$2)->clear_historical_flag();
}
;
;
dclass_or_struct:
dclass
| struct
;
| struct
;
dclass:
KW_DCLASS optional_name
@ -317,7 +317,7 @@ dclass_name:
$$ = dclass;
}
}
;
;
dclass_derivation:
empty
@ -360,7 +360,7 @@ dclass_fields:
;
dclass_field:
atomic_field keyword_list
atomic_field keyword_list
{
if ($1 != (DCField *)NULL) {
if ($1->get_name().empty()) {
@ -370,8 +370,8 @@ dclass_field:
}
$$ = $1;
}
| molecular_field no_keyword_list
| unnamed_parameter_with_default keyword_list
| molecular_field no_keyword_list
| unnamed_parameter_with_default keyword_list
{
yyerror("Unnamed parameters are not allowed on a dclass");
if ($1 != (DCField *)NULL) {
@ -379,14 +379,14 @@ dclass_field:
}
$$ = $1;
}
| named_parameter_with_default keyword_list
| named_parameter_with_default keyword_list
{
if ($1 != (DCField *)NULL) {
$1->copy_keywords(current_keyword_list);
}
$$ = $1;
}
;
;
struct:
KW_STRUCT optional_name
@ -422,7 +422,7 @@ struct_name:
$$ = dstruct;
}
}
;
;
struct_derivation:
empty
@ -458,23 +458,23 @@ struct_fields:
;
struct_field:
atomic_field no_keyword_list
atomic_field no_keyword_list
{
if ($1->get_name().empty()) {
yyerror("Field name required.");
}
$$ = $1;
}
| molecular_field no_keyword_list
| unnamed_parameter_with_default no_keyword_list
| molecular_field no_keyword_list
| unnamed_parameter_with_default no_keyword_list
{
$$ = $1;
}
| named_parameter_with_default no_keyword_list
| named_parameter_with_default no_keyword_list
{
$$ = $1;
}
;
;
atomic_field:
optional_name '('
@ -512,7 +512,7 @@ atomic_element:
current_atomic->add_element($1);
}
}
;
;
named_parameter:
type_definition
@ -523,15 +523,15 @@ named_parameter:
{
$$ = $3;
}
;
;
unnamed_parameter:
type_definition
;
type_definition
;
named_parameter_with_default:
named_parameter
| named_parameter '='
| named_parameter '='
{
current_packer = &default_packer;
current_packer->clear_data();
@ -539,7 +539,7 @@ named_parameter_with_default:
current_packer->begin_pack($1);
}
}
parameter_value
parameter_value
{
bool is_valid = false;
if ($1 != (DCField *)NULL) {
@ -557,11 +557,11 @@ named_parameter_with_default:
// just ignore the default value in this case.
}
}
;
;
unnamed_parameter_with_default:
unnamed_parameter
| unnamed_parameter '='
| unnamed_parameter '='
{
current_packer = &default_packer;
current_packer->clear_data();
@ -569,7 +569,7 @@ unnamed_parameter_with_default:
current_packer->begin_pack($1);
}
}
parameter_value
parameter_value
{
bool is_valid = false;
if ($1 != (DCField *)NULL) {
@ -587,7 +587,7 @@ unnamed_parameter_with_default:
// just ignore the default value in this case.
}
}
;
;
parameter:
named_parameter
@ -608,29 +608,29 @@ parameter_or_atomic:
{
$$ = $1;
}
;
;
parameter_description:
atomic_field no_keyword_list
atomic_field no_keyword_list
{
$$ = $1;
}
| unnamed_parameter_with_default no_keyword_list
| unnamed_parameter_with_default no_keyword_list
{
$$ = $1;
}
| named_parameter_with_default no_keyword_list
| named_parameter_with_default no_keyword_list
{
$$ = $1;
}
;
;
simple_type_name:
type_token
type_token
{
$$ = new DCSimpleParameter($1);
}
| simple_type_name '(' double_range ')'
| simple_type_name '(' double_range ')'
{
DCSimpleParameter *simple_param = $1->as_simple_parameter();
nassertr(simple_param != (DCSimpleParameter *)NULL, 0);
@ -667,11 +667,11 @@ simple_type_name:
}
$$ = simple_param;
}
;
;
type_name:
simple_type_name
| IDENTIFIER
| IDENTIFIER
{
if (dc_file == (DCFile *)NULL) {
yyerror("Invalid type.");
@ -703,7 +703,7 @@ type_name:
$$ = dtypedef->make_new_parameter();
}
}
| struct
| struct
{
// This is an inline struct definition.
if ($1 == (DCClass *)NULL) {
@ -719,7 +719,7 @@ type_name:
$$ = new DCClassParameter($1);
}
}
| switch
| switch
{
// This is an inline switch definition.
if ($1 == (DCSwitch *)NULL) {
@ -735,28 +735,28 @@ type_name:
$$ = new DCSwitchParameter($1);
}
}
;
;
double_range:
empty
empty
{
double_range.clear();
}
| char_or_number
| char_or_number
{
double_range.clear();
if (!double_range.add_range($1, $1)) {
yyerror("Overlapping range");
}
}
| char_or_number '-' char_or_number
| char_or_number '-' char_or_number
{
double_range.clear();
if (!double_range.add_range($1, $3)) {
yyerror("Overlapping range");
}
}
| char_or_number number
| char_or_number number
{
double_range.clear();
if ($2 >= 0) {
@ -765,19 +765,19 @@ double_range:
yyerror("Overlapping range");
}
}
| double_range ',' char_or_number
| double_range ',' char_or_number
{
if (!double_range.add_range($3, $3)) {
yyerror("Overlapping range");
}
}
| double_range ',' char_or_number '-' char_or_number
| double_range ',' char_or_number '-' char_or_number
{
if (!double_range.add_range($3, $5)) {
yyerror("Overlapping range");
}
}
| double_range ',' char_or_number number
| double_range ',' char_or_number number
{
if ($4 >= 0) {
yyerror("Syntax error");
@ -785,57 +785,57 @@ double_range:
yyerror("Overlapping range");
}
}
;
;
uint_range:
empty
empty
{
uint_range.clear();
}
| char_or_uint
| char_or_uint
{
uint_range.clear();
if (!uint_range.add_range($1, $1)) {
yyerror("Overlapping range");
}
}
| char_or_uint '-' char_or_uint
| char_or_uint '-' char_or_uint
{
uint_range.clear();
if (!uint_range.add_range($1, $3)) {
yyerror("Overlapping range");
}
}
| char_or_uint small_negative_integer
| char_or_uint small_negative_integer
{
uint_range.clear();
if (!uint_range.add_range($1, $2)) {
yyerror("Overlapping range");
}
}
| uint_range ',' char_or_uint
| uint_range ',' char_or_uint
{
if (!uint_range.add_range($3, $3)) {
yyerror("Overlapping range");
}
}
| uint_range ',' char_or_uint '-' char_or_uint
| uint_range ',' char_or_uint '-' char_or_uint
{
if (!uint_range.add_range($3, $5)) {
yyerror("Overlapping range");
}
}
| uint_range ',' char_or_uint small_negative_integer
| uint_range ',' char_or_uint small_negative_integer
{
if (!uint_range.add_range($3, $4)) {
yyerror("Overlapping range");
}
}
;
;
type_definition:
type_name
| type_definition '[' uint_range ']'
| type_definition '[' uint_range ']'
{
if ($1 == (DCParameter *)NULL) {
$$ = NULL;
@ -843,7 +843,7 @@ type_definition:
$$ = $1->append_array_specification(uint_range);
}
}
;
;
parameter_definition:
IDENTIFIER
@ -881,14 +881,14 @@ parameter_definition:
}
}
}
| parameter_definition '[' uint_range ']'
| parameter_definition '[' uint_range ']'
{
$$ = $1->append_array_specification(uint_range);
}
;
;
char_or_uint:
STRING
STRING
{
if ($1.length() != 1) {
yyerror("Single character required.");
@ -897,11 +897,11 @@ char_or_uint:
$$ = (unsigned char)$1[0];
}
}
| small_unsigned_integer
;
| small_unsigned_integer
;
small_unsigned_integer:
UNSIGNED_INTEGER
UNSIGNED_INTEGER
{
$$ = (unsigned int)$1;
if ($$ != $1) {
@ -909,10 +909,10 @@ small_unsigned_integer:
$$ = 1;
}
}
;
;
small_negative_integer:
SIGNED_INTEGER
SIGNED_INTEGER
{
$$ = (unsigned int)-$1;
if ($1 >= 0) {
@ -923,30 +923,30 @@ small_negative_integer:
$$ = 1;
}
}
;
;
signed_integer:
SIGNED_INTEGER
;
;
unsigned_integer:
UNSIGNED_INTEGER
;
UNSIGNED_INTEGER
;
number:
unsigned_integer
unsigned_integer
{
$$ = (double)$1;
}
| signed_integer
| signed_integer
{
$$ = (double)$1;
}
| REAL
;
| REAL
;
char_or_number:
STRING
STRING
{
if ($1.length() != 1) {
yyerror("Single character required.");
@ -955,8 +955,8 @@ char_or_number:
$$ = (double)(unsigned char)$1[0];
}
}
| number
;
| number
;
parameter_value:
@ -964,7 +964,7 @@ parameter_value:
{
$$ = $1;
}
| IDENTIFIER '='
| IDENTIFIER '='
{
if ($1 != current_packer->get_current_field_name()) {
ostringstream strm;
@ -973,18 +973,18 @@ parameter_value:
yyerror(strm.str());
}
}
parameter_actual_value
parameter_actual_value
{
$$ = $4;
}
;
;
parameter_actual_value:
signed_integer
signed_integer
{
current_packer->pack_int64($1);
}
| unsigned_integer
| unsigned_integer
{
current_packer->pack_uint64($1);
}
@ -1157,7 +1157,7 @@ keyword_list:
{
current_keyword_list.add_keyword($2);
}
;
;
no_keyword_list:
keyword_list
@ -1166,7 +1166,7 @@ no_keyword_list:
yyerror("Communication keywords are not allowed here.");
}
}
;
;
molecular_field:
IDENTIFIER ':'
@ -1193,7 +1193,7 @@ atomic_name:
}
}
}
;
;
molecular_atom_list:
atomic_name
@ -1220,21 +1220,21 @@ optional_name:
{
$$ = "";
}
| IDENTIFIER
;
| IDENTIFIER
;
switch:
KW_SWITCH optional_name '(' parameter_or_atomic ')' '{'
KW_SWITCH optional_name '(' parameter_or_atomic ')' '{'
{
$$ = current_switch;
current_switch = new DCSwitch($2, $4);
}
switch_fields '}'
switch_fields '}'
{
$$ = current_switch;
current_switch = (DCSwitch *)$<u.parameter>7;
}
;
;
switch_fields:
@ -1256,13 +1256,13 @@ switch_fields:
;
switch_case:
KW_CASE
KW_CASE
{
current_packer = &default_packer;
current_packer->clear_data();
current_packer->begin_pack(current_switch->get_key_parameter());
}
parameter_value ':'
parameter_value ':'
{
if (!current_packer->end_pack()) {
yyerror("Invalid value for switch parameter");
@ -1274,34 +1274,34 @@ switch_case:
}
}
}
;
;
switch_default:
KW_DEFAULT ':'
KW_DEFAULT ':'
{
if (!current_switch->add_default()) {
yyerror("Default case already defined");
}
}
;
;
switch_break:
KW_BREAK
KW_BREAK
{
current_switch->add_break();
}
;
;
switch_field:
unnamed_parameter_with_default
unnamed_parameter_with_default
{
$$ = $1;
}
| named_parameter_with_default
| named_parameter_with_default
{
$$ = $1;
}
;
;
empty:
;

View File

@ -248,13 +248,13 @@ check_datagram() {
case CLIENT_OBJECT_UPDATE_FIELD:
case STATESERVER_OBJECT_UPDATE_FIELD:
if (_has_owner_view) {
if (!handle_update_field_owner()) {
return false;
}
if (!handle_update_field_owner()) {
return false;
}
} else {
if (!handle_update_field()) {
return false;
}
if (!handle_update_field()) {
return false;
}
}
break;
#endif // HAVE_PYTHON
@ -580,20 +580,20 @@ handle_update_field_owner() {
int field_id = packer.raw_unpack_uint16();
DCField *field = dclass->get_field_by_index(field_id);
if (field->is_ownrecv()) {
// It's a good idea to ensure the reference count to distobjOV is
// raised while we call the update method--otherwise, the update
// method might get into trouble if it tried to delete the
// object from the doId2do map.
Py_INCREF(distobjOV);
// make a copy of the datagram iterator so that we can use the main
// iterator for the non-owner update
DatagramIterator _odi(_di);
dclass->receive_update(distobjOV, _odi);
Py_DECREF(distobjOV);
// It's a good idea to ensure the reference count to distobjOV is
// raised while we call the update method--otherwise, the update
// method might get into trouble if it tried to delete the
// object from the doId2do map.
Py_INCREF(distobjOV);
// make a copy of the datagram iterator so that we can use the main
// iterator for the non-owner update
DatagramIterator _odi(_di);
dclass->receive_update(distobjOV, _odi);
Py_DECREF(distobjOV);
if (PyErr_Occurred()) {
return false;
}
if (PyErr_Occurred()) {
return false;
}
}
}
@ -619,17 +619,17 @@ handle_update_field_owner() {
int field_id = packer.raw_unpack_uint16();
DCField *field = dclass->get_field_by_index(field_id);
if (true) {//field->is_broadcast()) {
// It's a good idea to ensure the reference count to distobj is
// raised while we call the update method--otherwise, the update
// method might get into trouble if it tried to delete the
// object from the doId2do map.
Py_INCREF(distobj);
dclass->receive_update(distobj, _di);
Py_DECREF(distobj);
// It's a good idea to ensure the reference count to distobj is
// raised while we call the update method--otherwise, the update
// method might get into trouble if it tried to delete the
// object from the doId2do map.
Py_INCREF(distobj);
dclass->receive_update(distobj, _di);
Py_DECREF(distobj);
if (PyErr_Occurred()) {
return false;
}
if (PyErr_Occurred()) {
return false;
}
}
}

View File

@ -36,13 +36,13 @@ ConfigVariableDouble min_lag
("min-lag", 0.0,
PRC_DESC("This represents the time in seconds by which to artificially lag "
"inbound messages. It is useful to test a game's tolerance of "
"network latency."));
"network latency."));
ConfigVariableDouble max_lag
("max-lag", 0.0,
PRC_DESC("This represents the time in seconds by which to artificially lag "
"inbound messages. It is useful to test a game's tolerance of "
"network latency."));
"network latency."));
////////////////////////////////////////////////////////////////////
// Function: init_libdistributed

View File

@ -1346,7 +1346,7 @@ formal_parameter:
$$ = new CPPInstance($2, $3, 0, @3.file);
$$->set_initializer($4);
}
| formal_const_expr
| formal_const_expr
{
CPPType *type =
CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_parameter));

View File

@ -208,14 +208,14 @@
Configuration and functionality options:
USE_DL_PREFIX NOT defined
PTMALLOC_IN_CPPNAMESPACE NOT defined
PTMALLOC_IN_CPPNAMESPACE NOT defined
USE_PUBLIC_MALLOC_WRAPPERS NOT defined
MALLOC_DEBUG NOT defined
REALLOC_ZERO_BYTES_FREES 1
MALLOC_FAILURE_ACTION errno = ENOMEM, if __STD_C defined, else no-op
TRIM_FASTBINS 0
FIRST_SORTED_BIN_SIZE 512
MORECORE_IS_MMAP NOT defined
MORECORE_IS_MMAP NOT defined
Options for customizing MORECORE:
@ -250,24 +250,24 @@
typedef pthread_t thread_id;
/* mutex */
typedef pthread_mutex_t mutex_t;
typedef pthread_mutex_t mutex_t;
#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
/* Even if not linking with libpthread, ensure usability of mutex as
an `in use' flag, see also the NO_THREADS case below. Assume
pthread_mutex_t is at least one int wide. */
#define mutex_init(m) \
#define mutex_init(m) \
(__pthread_mutex_init != NULL \
? __pthread_mutex_init (m, NULL) : (*(int *)(m) = 0))
#define mutex_lock(m) \
#define mutex_lock(m) \
(__pthread_mutex_lock != NULL \
? __pthread_mutex_lock (m) : ((*(int *)(m) = 1), 0))
#define mutex_trylock(m) \
#define mutex_trylock(m) \
(__pthread_mutex_trylock != NULL \
? __pthread_mutex_trylock (m) : (*(int *)(m) ? 1 : ((*(int *)(m) = 1), 0)))
#define mutex_unlock(m) \
#define mutex_unlock(m) \
(__pthread_mutex_unlock != NULL \
? __pthread_mutex_unlock (m) : (*(int*)(m) = 0))
@ -314,11 +314,11 @@ typedef pthread_mutex_t mutex_t;
#include <bits/libc-tsd.h>
typedef int tsd_key_t[1]; /* no key data structure, libc magic does it */
__libc_tsd_define (, MALLOC) /* declaration/common definition */
#define tsd_key_create(key, destr) ((void) (key))
#define tsd_setspecific(key, data) __libc_tsd_set (MALLOC, (data))
#define tsd_getspecific(key, vptr) ((vptr) = __libc_tsd_get (MALLOC))
typedef int tsd_key_t[1]; /* no key data structure, libc magic does it */
__libc_tsd_define (, MALLOC) /* declaration/common definition */
#define tsd_key_create(key, destr) ((void) (key))
#define tsd_setspecific(key, data) __libc_tsd_set (MALLOC, (data))
#define tsd_getspecific(key, vptr) ((vptr) = __libc_tsd_get (MALLOC))
#endif
@ -1891,17 +1891,17 @@ int __posix_memalign(void **, size_t, size_t);
to help it optimize the function calls. But this works only with
gcc 2.8.x and egcs. */
# if defined __cplusplus && (__GNUC__ >= 3 || __GNUC_MINOR__ >= 8)
# define __THROW throw ()
# define __THROW throw ()
# else
# define __THROW
# endif
# define __MALLOC_P(args) args __THROW
# define __MALLOC_P(args) args __THROW
/* This macro will be used for functions which might take C++ callback
functions. */
# define __MALLOC_PMT(args) args
# define __MALLOC_PMT(args) args
#else /* Not GCC. */
#else /* Not GCC. */
# ifdef __cplusplus
# define __THROW throw()
@ -1913,23 +1913,23 @@ int __posix_memalign(void **, size_t, size_t);
# if (defined __STDC__ && __STDC__) || defined __cplusplus
# define __MALLOC_P(args) args __THROW
# define __MALLOC_PMT(args) args
# define __MALLOC_P(args) args __THROW
# define __MALLOC_PMT(args) args
# else /* Not ANSI C or C++. */
# else /* Not ANSI C or C++. */
# define __MALLOC_P(args) () /* No prototypes. */
# define __MALLOC_PMT(args) ()
# define __MALLOC_P(args) () /* No prototypes. */
# define __MALLOC_PMT(args) ()
# endif /* ANSI C or C++. */
# endif /* ANSI C or C++. */
#endif /* GCC. */
#endif /* GCC. */
#ifndef NULL
# ifdef __cplusplus
# define NULL 0
# define NULL 0
# else
# define NULL ((__malloc_ptr_t) 0)
# define NULL ((__malloc_ptr_t) 0)
# endif
#endif
@ -1943,16 +1943,16 @@ extern struct mallinfo mallinfo __MALLOC_P ((void));
/* SVID2/XPG mallopt options */
#ifndef M_MXFAST
# define M_MXFAST 1 /* maximum request size for "fastbins" */
# define M_MXFAST 1 /* maximum request size for "fastbins" */
#endif
#ifndef M_NLBLKS
# define M_NLBLKS 2 /* UNUSED in this malloc */
# define M_NLBLKS 2 /* UNUSED in this malloc */
#endif
#ifndef M_GRAIN
# define M_GRAIN 3 /* UNUSED in this malloc */
# define M_GRAIN 3 /* UNUSED in this malloc */
#endif
#ifndef M_KEEP
# define M_KEEP 4 /* UNUSED in this malloc */
# define M_KEEP 4 /* UNUSED in this malloc */
#endif
/* mallopt options that actually do something */
@ -1989,15 +1989,15 @@ extern int malloc_set_state __MALLOC_P ((__malloc_ptr_t __ptr));
extern void (*__malloc_initialize_hook) __MALLOC_PMT ((void));
/* Hooks for debugging and user-defined versions. */
extern void (*__free_hook) __MALLOC_PMT ((__malloc_ptr_t __ptr,
__const __malloc_ptr_t));
__const __malloc_ptr_t));
extern __malloc_ptr_t (*__malloc_hook) __MALLOC_PMT ((size_t __size,
__const __malloc_ptr_t));
__const __malloc_ptr_t));
extern __malloc_ptr_t (*__realloc_hook) __MALLOC_PMT ((__malloc_ptr_t __ptr,
size_t __size,
__const __malloc_ptr_t));
size_t __size,
__const __malloc_ptr_t));
extern __malloc_ptr_t (*__memalign_hook) __MALLOC_PMT ((size_t __alignment,
size_t __size,
__const __malloc_ptr_t));
size_t __size,
__const __malloc_ptr_t));
extern void (*__after_morecore_hook) __MALLOC_PMT ((void));
/* Activate a standard set of debugging hooks. */
@ -2011,10 +2011,10 @@ extern mstate _int_new_arena __MALLOC_P ((size_t __ini_size));
extern __malloc_ptr_t _int_malloc __MALLOC_P ((mstate __m, size_t __size));
extern void _int_free __MALLOC_P ((mstate __m, __malloc_ptr_t __ptr));
extern __malloc_ptr_t _int_realloc __MALLOC_P ((mstate __m,
__malloc_ptr_t __ptr,
size_t __size));
__malloc_ptr_t __ptr,
size_t __size));
extern __malloc_ptr_t _int_memalign __MALLOC_P ((mstate __m, size_t __alignment,
size_t __size));
size_t __size));
#if defined(__cplusplus) && !defined(PTMALLOC_IN_CPPNAMESPACE)
}; /* end of extern "C" */
@ -2079,9 +2079,9 @@ static mchunkptr internal_function mremap_chunk(mchunkptr p, size_t new_size);
static Void_t* malloc_check(size_t sz, const Void_t *caller);
static void free_check(Void_t* mem, const Void_t *caller);
static Void_t* realloc_check(Void_t* oldmem, size_t bytes,
const Void_t *caller);
const Void_t *caller);
static Void_t* memalign_check(size_t alignment, size_t bytes,
const Void_t *caller);
const Void_t *caller);
#ifndef NO_THREADS
static Void_t* malloc_starter(size_t sz, const Void_t *caller);
static void free_starter(Void_t* mem, const Void_t *caller);
@ -2582,8 +2582,8 @@ static int largebin_index(unsigned int sz) {
#elif defined(_MSC_VER) && defined(_M_IX86)
__asm
{
bsr eax, [x]
mov [m], eax
bsr eax, [x]
mov [m], eax
}
#else
{
@ -3068,9 +3068,9 @@ int __malloc_initialized = -1;
/* atfork support. */
static __malloc_ptr_t (*save_malloc_hook) __MALLOC_P ((size_t __size,
__const __malloc_ptr_t));
__const __malloc_ptr_t));
static void (*save_free_hook) __MALLOC_P ((__malloc_ptr_t __ptr,
__const __malloc_ptr_t));
__const __malloc_ptr_t));
static Void_t* save_arena;
/* Magic value for the thread-specific arena pointer when
@ -3233,20 +3233,20 @@ next_env_entry (char ***position)
while (*current != NULL)
{
if (__builtin_expect ((*current)[0] == 'M', 0)
&& (*current)[1] == 'A'
&& (*current)[2] == 'L'
&& (*current)[3] == 'L'
&& (*current)[4] == 'O'
&& (*current)[5] == 'C'
&& (*current)[6] == '_')
{
result = &(*current)[7];
&& (*current)[1] == 'A'
&& (*current)[2] == 'L'
&& (*current)[3] == 'L'
&& (*current)[4] == 'O'
&& (*current)[5] == 'C'
&& (*current)[6] == '_')
{
result = &(*current)[7];
/* Save current position for next visit. */
*position = ++current;
/* Save current position for next visit. */
*position = ++current;
break;
}
break;
}
++current;
}
@ -3307,55 +3307,55 @@ ptmalloc_init __MALLOC_P((void))
char *envline;
while (__builtin_expect ((envline = next_env_entry (&runp)) != NULL,
0))
0))
{
size_t len = strcspn (envline, "=");
size_t len = strcspn (envline, "=");
if (envline[len] != '=')
/* This is a "MALLOC_" variable at the end of the string
without a '=' character. Ignore it since otherwise we
will access invalid memory below. */
continue;
if (envline[len] != '=')
/* This is a "MALLOC_" variable at the end of the string
without a '=' character. Ignore it since otherwise we
will access invalid memory below. */
continue;
switch (len)
{
case 6:
if (memcmp (envline, "CHECK_", 6) == 0)
s = &envline[7];
break;
case 8:
if (! secure && memcmp (envline, "TOP_PAD_", 8) == 0)
mALLOPt(M_TOP_PAD, atoi(&envline[9]));
break;
case 9:
if (! secure && memcmp (envline, "MMAP_MAX_", 9) == 0)
mALLOPt(M_MMAP_MAX, atoi(&envline[10]));
break;
case 15:
if (! secure)
{
if (memcmp (envline, "TRIM_THRESHOLD_", 15) == 0)
mALLOPt(M_TRIM_THRESHOLD, atoi(&envline[16]));
else if (memcmp (envline, "MMAP_THRESHOLD_", 15) == 0)
mALLOPt(M_MMAP_THRESHOLD, atoi(&envline[16]));
}
break;
default:
break;
}
switch (len)
{
case 6:
if (memcmp (envline, "CHECK_", 6) == 0)
s = &envline[7];
break;
case 8:
if (! secure && memcmp (envline, "TOP_PAD_", 8) == 0)
mALLOPt(M_TOP_PAD, atoi(&envline[9]));
break;
case 9:
if (! secure && memcmp (envline, "MMAP_MAX_", 9) == 0)
mALLOPt(M_MMAP_MAX, atoi(&envline[10]));
break;
case 15:
if (! secure)
{
if (memcmp (envline, "TRIM_THRESHOLD_", 15) == 0)
mALLOPt(M_TRIM_THRESHOLD, atoi(&envline[16]));
else if (memcmp (envline, "MMAP_THRESHOLD_", 15) == 0)
mALLOPt(M_MMAP_THRESHOLD, atoi(&envline[16]));
}
break;
default:
break;
}
}
}
#else
if (! secure)
{
if((s = getenv("MALLOC_TRIM_THRESHOLD_")))
mALLOPt(M_TRIM_THRESHOLD, atoi(s));
mALLOPt(M_TRIM_THRESHOLD, atoi(s));
if((s = getenv("MALLOC_TOP_PAD_")))
mALLOPt(M_TOP_PAD, atoi(s));
mALLOPt(M_TOP_PAD, atoi(s));
if((s = getenv("MALLOC_MMAP_THRESHOLD_")))
mALLOPt(M_MMAP_THRESHOLD, atoi(s));
mALLOPt(M_MMAP_THRESHOLD, atoi(s));
if((s = getenv("MALLOC_MMAP_MAX_")))
mALLOPt(M_MMAP_MAX, atoi(s));
mALLOPt(M_MMAP_MAX, atoi(s));
}
s = getenv("MALLOC_CHECK_");
#endif
@ -3649,7 +3649,7 @@ _int_new_arena __MALLOC_P((size_t size))
unsigned long misalign;
h = new_heap(size + (sizeof(*h) + sizeof(*a) + MALLOC_ALIGNMENT),
mp_.top_pad);
mp_.top_pad);
if(!h) {
/* Maybe size is too large to fit in a single heap. So, just try
to create a minimally-sized arena and let _int_malloc() attempt
@ -3948,7 +3948,7 @@ static void do_check_malloc_state(mstate av)
/* A contiguous main_arena is consistent with sbrk_base. */
if (av == &main_arena && contiguous(av))
assert((char*)mp_.sbrk_base + av->system_mem ==
(char*)av->top + chunksize(av->top));
(char*)av->top + chunksize(av->top));
/* properties of fastbins */
@ -4127,7 +4127,7 @@ memalign_hook_ini(alignment, sz, caller)
void weak_variable (*__malloc_initialize_hook) __MALLOC_P ((void)) = NULL;
void weak_variable (*__free_hook) __MALLOC_P ((__malloc_ptr_t __ptr,
const __malloc_ptr_t)) = NULL;
const __malloc_ptr_t)) = NULL;
__malloc_ptr_t weak_variable (*__malloc_hook)
__MALLOC_P ((size_t __size, const __malloc_ptr_t)) = malloc_hook_ini;
__malloc_ptr_t weak_variable (*__realloc_hook)
@ -4236,7 +4236,7 @@ mem2chunk_check(mem) Void_t* mem;
/* Must be a chunk in conventional heap memory. */
if(chunk_is_mmapped(p) ||
( (sz = chunksize(p)),
((char*)p + sz)>=(mp_.sbrk_base+main_arena.system_mem) ) ||
((char*)p + sz)>=(mp_.sbrk_base+main_arena.system_mem) ) ||
sz<MINSIZE || sz&MALLOC_ALIGN_MASK || !inuse(p) ||
( !prev_inuse(p) && (p->prev_size&MALLOC_ALIGN_MASK ||
(long)prev_chunk(p)<(long)mp_.sbrk_base ||
@ -4403,11 +4403,11 @@ realloc_check(oldmem, bytes, caller)
{
/* Note the extra SIZE_SZ overhead. */
if(oldsize - SIZE_SZ >= nb)
newmem = oldmem; /* do nothing */
newmem = oldmem; /* do nothing */
else {
/* Must alloc, copy, free. */
if (top_check() >= 0)
newmem = _int_malloc(&main_arena, bytes+1);
newmem = _int_malloc(&main_arena, bytes+1);
if (newmem) {
MALLOC_COPY(BOUNDED_N(newmem, bytes+1), oldmem, oldsize - 2*SIZE_SZ);
munmap_chunk(oldp);
@ -4427,7 +4427,7 @@ realloc_check(oldmem, bytes, caller)
oldsize - (2*sizeof(mbinptr)+2*SIZE_SZ+1));
} else if(nb > oldsize+SIZE_SZ) {
memset((char*)BOUNDED_N(chunk2mem(newp), bytes) + oldsize,
0, nb - (oldsize+SIZE_SZ));
0, nb - (oldsize+SIZE_SZ));
}
#endif
#if HAVE_MMAP
@ -4619,23 +4619,23 @@ public_sET_STATe(Void_t* msptr)
first(b) = last(b) = b;
} else {
if(i<NSMALLBINS || (largebin_index(chunksize(ms->av[2*i+2]))==i &&
largebin_index(chunksize(ms->av[2*i+3]))==i)) {
first(b) = ms->av[2*i+2];
last(b) = ms->av[2*i+3];
/* Make sure the links to the bins within the heap are correct. */
first(b)->bk = b;
last(b)->fd = b;
/* Set bit in binblocks. */
mark_bin(&main_arena, i);
largebin_index(chunksize(ms->av[2*i+3]))==i)) {
first(b) = ms->av[2*i+2];
last(b) = ms->av[2*i+3];
/* Make sure the links to the bins within the heap are correct. */
first(b)->bk = b;
last(b)->fd = b;
/* Set bit in binblocks. */
mark_bin(&main_arena, i);
} else {
/* Oops, index computation from chunksize must have changed.
/* Oops, index computation from chunksize must have changed.
Link the whole list into unsorted_chunks. */
first(b) = last(b) = b;
b = unsorted_chunks(&main_arena);
ms->av[2*i+2]->bk = b;
ms->av[2*i+3]->fd = b->fd;
b->fd->bk = ms->av[2*i+3];
b->fd = ms->av[2*i+2];
first(b) = last(b) = b;
b = unsorted_chunks(&main_arena);
ms->av[2*i+2]->bk = b;
ms->av[2*i+3]->fd = b->fd;
b->fd->bk = ms->av[2*i+3];
b->fd = ms->av[2*i+2];
}
}
}
@ -4823,7 +4823,7 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av;
assert((old_top == initial_top(av) && old_size == 0) ||
((CHUNK_SIZE_T) (old_size) >= MINSIZE &&
prev_inuse(old_top) &&
((CHUNK_SIZE_T)old_end & pagemask) == 0));
((CHUNK_SIZE_T)old_end & pagemask) == 0));
/* Precondition: not enough current space to satisfy nb request */
assert((CHUNK_SIZE_T)(old_size) < (CHUNK_SIZE_T)(nb + MINSIZE));
@ -4848,7 +4848,7 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av;
max_total_mem = mmapped_mem + arena_mem + sbrked_mem;
#endif
set_head(old_top, (((char *)old_heap + old_heap->size) - (char *)old_top)
| PREV_INUSE);
| PREV_INUSE);
}
else if ((heap = new_heap(nb + (MINSIZE + sizeof(*heap)), mp_.top_pad))) {
/* Use a newly allocated heap. */
@ -4858,7 +4858,7 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av;
arena_mem += heap->size;
#if 0
if((CHUNK_SIZE_T)(mmapped_mem + arena_mem + sbrked_mem) > max_total_mem)
max_total_mem = mmapped_mem + arena_mem + sbrked_mem;
max_total_mem = mmapped_mem + arena_mem + sbrked_mem;
#endif
/* Set up the new top. */
top(av) = chunk_at_offset(heap, sizeof(*heap));
@ -4866,18 +4866,18 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av;
/* Setup fencepost and free the old top chunk. */
/* The fencepost takes at least MINSIZE bytes, because it might
become the top chunk again later. Note that a footer is set
up, too, although the chunk is marked in use. */
become the top chunk again later. Note that a footer is set
up, too, although the chunk is marked in use. */
old_size -= MINSIZE;
set_head(chunk_at_offset(old_top, old_size + 2*SIZE_SZ), 0|PREV_INUSE);
if (old_size >= MINSIZE) {
set_head(chunk_at_offset(old_top, old_size), (2*SIZE_SZ)|PREV_INUSE);
set_foot(chunk_at_offset(old_top, old_size), (2*SIZE_SZ));
set_head(old_top, old_size|PREV_INUSE|NON_MAIN_ARENA);
_int_free(av, chunk2mem(old_top));
set_head(chunk_at_offset(old_top, old_size), (2*SIZE_SZ)|PREV_INUSE);
set_foot(chunk_at_offset(old_top, old_size), (2*SIZE_SZ));
set_head(old_top, old_size|PREV_INUSE|NON_MAIN_ARENA);
_int_free(av, chunk2mem(old_top));
} else {
set_head(old_top, (old_size + 2*SIZE_SZ)|PREV_INUSE);
set_foot(old_top, (old_size + 2*SIZE_SZ));
set_head(old_top, (old_size + 2*SIZE_SZ)|PREV_INUSE);
set_foot(old_top, (old_size + 2*SIZE_SZ));
}
}
@ -5001,7 +5001,7 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av;
else {
/* Count foreign sbrk as system_mem. */
if (old_size)
av->system_mem += brk - old_end;
av->system_mem += brk - old_end;
front_misalign = 0;
end_misalign = 0;
correction = 0;
@ -5088,9 +5088,9 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av;
correction = 0;
set_noncontiguous(av);
} else
/* Call the `morecore' hook if necessary. */
if (__after_morecore_hook)
(*__after_morecore_hook) ();
/* Call the `morecore' hook if necessary. */
if (__after_morecore_hook)
(*__after_morecore_hook) ();
}
/* handle non-contiguous cases */
@ -5239,7 +5239,7 @@ static int sYSTRIm(pad, av) size_t pad; mstate av;
MORECORE(-extra);
/* Call the `morecore' hook if necessary. */
if (__after_morecore_hook)
(*__after_morecore_hook) ();
(*__after_morecore_hook) ();
new_brk = (char*)(MORECORE(0));
if (new_brk != (char*)MORECORE_FAILURE) {
@ -5378,7 +5378,7 @@ public_mALLOc(size_t bytes)
} else
(void)mutex_unlock(&ar_ptr->mutex);
assert(!victim || chunk_is_mmapped(mem2chunk(victim)) ||
ar_ptr == arena_for_chunk(mem2chunk(victim)));
ar_ptr == arena_for_chunk(mem2chunk(victim)));
return victim;
}
@ -5435,7 +5435,7 @@ public_rEALLOc(Void_t* oldmem, size_t bytes)
Void_t* newp; /* chunk to return */
__malloc_ptr_t (*hook) __MALLOC_P ((__malloc_ptr_t, size_t,
__const __malloc_ptr_t)) =
__const __malloc_ptr_t)) =
__realloc_hook;
if (hook != NULL)
return (*hook)(oldmem, bytes, RETURN_ADDRESS (0));
@ -5493,7 +5493,7 @@ public_rEALLOc(Void_t* oldmem, size_t bytes)
(void)mutex_unlock(&ar_ptr->mutex);
assert(!newp || chunk_is_mmapped(mem2chunk(newp)) ||
ar_ptr == arena_for_chunk(mem2chunk(newp)));
ar_ptr == arena_for_chunk(mem2chunk(newp)));
return newp;
}
@ -5504,7 +5504,7 @@ public_mEMALIGn(size_t alignment, size_t bytes)
Void_t *p;
__malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t,
__const __malloc_ptr_t)) =
__const __malloc_ptr_t)) =
__memalign_hook;
if (hook != NULL)
return (*hook)(alignment, bytes, RETURN_ADDRESS (0));
@ -5538,7 +5538,7 @@ public_mEMALIGn(size_t alignment, size_t bytes)
}
}
assert(!p || chunk_is_mmapped(mem2chunk(p)) ||
ar_ptr == arena_for_chunk(mem2chunk(p)));
ar_ptr == arena_for_chunk(mem2chunk(p)));
return p;
}
@ -5623,7 +5623,7 @@ public_cALLOc(size_t n, size_t elem_size)
(void)mutex_unlock(&av->mutex);
assert(!mem || chunk_is_mmapped(mem2chunk(mem)) ||
av == arena_for_chunk(mem2chunk(mem)));
av == arena_for_chunk(mem2chunk(mem)));
if (mem == 0) {
/* Maybe the failure is due to running out of mmapped areas. */
@ -5681,12 +5681,12 @@ public_cALLOc(size_t n, size_t elem_size)
*(d+3) = 0;
*(d+4) = 0;
if (nclears > 6) {
*(d+5) = 0;
*(d+6) = 0;
if (nclears > 8) {
*(d+7) = 0;
*(d+8) = 0;
}
*(d+5) = 0;
*(d+6) = 0;
if (nclears > 8) {
*(d+7) = 0;
*(d+8) = 0;
}
}
}
}
@ -5859,7 +5859,7 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes))
bck->fd = bin;
if (av != &main_arena)
victim->size |= NON_MAIN_ARENA;
victim->size |= NON_MAIN_ARENA;
check_malloced_chunk(av, victim, nb);
return chunk2mem(victim);
}
@ -5923,7 +5923,7 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes))
remainder->bk = remainder->fd = unsorted_chunks(av);
set_head(victim, nb | PREV_INUSE |
(av != &main_arena ? NON_MAIN_ARENA : 0));
(av != &main_arena ? NON_MAIN_ARENA : 0));
set_head(remainder, remainder_size | PREV_INUSE);
set_foot(remainder, remainder_size);
@ -5939,8 +5939,8 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes))
if (size == nb) {
set_inuse_bit_at_offset(victim, size);
if (av != &main_arena)
victim->size |= NON_MAIN_ARENA;
if (av != &main_arena)
victim->size |= NON_MAIN_ARENA;
check_malloced_chunk(av, victim, nb);
return chunk2mem(victim);
}
@ -5959,7 +5959,7 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes))
if (fwd != bck) {
/* if smaller than smallest, place first */
assert((bck->bk->size & NON_MAIN_ARENA) == 0);
assert((bck->bk->size & NON_MAIN_ARENA) == 0);
if ((CHUNK_SIZE_T)(size) < (CHUNK_SIZE_T)(bck->bk->size)) {
fwd = bck;
bck = bck->bk;
@ -5969,11 +5969,11 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes))
/* maintain large bins in sorted order */
size |= PREV_INUSE; /* Or with inuse bit to speed comparisons */
assert((fwd->size & NON_MAIN_ARENA) == 0);
while ((CHUNK_SIZE_T)(size) < (CHUNK_SIZE_T)(fwd->size)) {
assert((fwd->size & NON_MAIN_ARENA) == 0);
while ((CHUNK_SIZE_T)(size) < (CHUNK_SIZE_T)(fwd->size)) {
fwd = fwd->fd;
assert((fwd->size & NON_MAIN_ARENA) == 0);
}
assert((fwd->size & NON_MAIN_ARENA) == 0);
}
bck = fwd->bk;
}
}
@ -6006,9 +6006,9 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes))
/* Exhaust */
if (remainder_size < MINSIZE) {
set_inuse_bit_at_offset(victim, size);
if (av != &main_arena)
victim->size |= NON_MAIN_ARENA;
check_malloced_chunk(av, victim, nb);
if (av != &main_arena)
victim->size |= NON_MAIN_ARENA;
check_malloced_chunk(av, victim, nb);
return chunk2mem(victim);
}
/* Split */
@ -6016,11 +6016,11 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes))
remainder = chunk_at_offset(victim, nb);
unsorted_chunks(av)->bk = unsorted_chunks(av)->fd = remainder;
remainder->bk = remainder->fd = unsorted_chunks(av);
set_head(victim, nb | PREV_INUSE |
(av != &main_arena ? NON_MAIN_ARENA : 0));
set_head(victim, nb | PREV_INUSE |
(av != &main_arena ? NON_MAIN_ARENA : 0));
set_head(remainder, remainder_size | PREV_INUSE);
set_foot(remainder, remainder_size);
check_malloced_chunk(av, victim, nb);
check_malloced_chunk(av, victim, nb);
return chunk2mem(victim);
}
}
@ -6090,8 +6090,8 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes))
/* Exhaust */
if (remainder_size < MINSIZE) {
set_inuse_bit_at_offset(victim, size);
if (av != &main_arena)
victim->size |= NON_MAIN_ARENA;
if (av != &main_arena)
victim->size |= NON_MAIN_ARENA;
check_malloced_chunk(av, victim, nb);
return chunk2mem(victim);
}
@ -6107,7 +6107,7 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes))
av->last_remainder = remainder;
set_head(victim, nb | PREV_INUSE |
(av != &main_arena ? NON_MAIN_ARENA : 0));
(av != &main_arena ? NON_MAIN_ARENA : 0));
set_head(remainder, remainder_size | PREV_INUSE);
set_foot(remainder, remainder_size);
check_malloced_chunk(av, victim, nb);
@ -6140,7 +6140,7 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes))
remainder = chunk_at_offset(victim, nb);
av->top = remainder;
set_head(victim, nb | PREV_INUSE |
(av != &main_arena ? NON_MAIN_ARENA : 0));
(av != &main_arena ? NON_MAIN_ARENA : 0));
set_head(remainder, remainder_size | PREV_INUSE);
check_malloced_chunk(av, victim, nb);
@ -6239,7 +6239,7 @@ _int_free __MALLOC_P((mstate av, Void_t* mem))
unlink(nextchunk, bck, fwd);
size += nextsize;
} else
clear_inuse_bit_at_offset(nextchunk, 0);
clear_inuse_bit_at_offset(nextchunk, 0);
/*
Place the chunk in unsorted chunk list. Chunks are
@ -6289,20 +6289,20 @@ _int_free __MALLOC_P((mstate av, Void_t* mem))
if (have_fastchunks(av))
malloc_consolidate(av);
if (av == &main_arena) {
if (av == &main_arena) {
#ifndef MORECORE_CANNOT_TRIM
if ((CHUNK_SIZE_T)(chunksize(av->top)) >=
(CHUNK_SIZE_T)(mp_.trim_threshold))
sYSTRIm(mp_.top_pad, av);
(CHUNK_SIZE_T)(mp_.trim_threshold))
sYSTRIm(mp_.top_pad, av);
#endif
} else {
/* Always try heap_trim(), even if the top chunk is not
} else {
/* Always try heap_trim(), even if the top chunk is not
large, because the corresponding heap might go away. */
heap_info *heap = heap_for_ptr(top(av));
heap_info *heap = heap_for_ptr(top(av));
assert(heap->ar_ptr == av);
heap_trim(heap, mp_.top_pad);
}
assert(heap->ar_ptr == av);
heap_trim(heap, mp_.top_pad);
}
}
}
@ -6411,7 +6411,7 @@ static void malloc_consolidate(av) mstate av;
size += nextsize;
unlink(nextchunk, bck, fwd);
} else
clear_inuse_bit_at_offset(nextchunk, 0);
clear_inuse_bit_at_offset(nextchunk, 0);
first_unsorted = unsorted_bin->fd;
unsorted_bin->fd = p;
@ -6505,7 +6505,7 @@ _int_realloc __MALLOC_P((mstate av, Void_t* oldmem, size_t bytes))
set_head_size(oldp, nb | (av != &main_arena ? NON_MAIN_ARENA : 0));
av->top = chunk_at_offset(oldp, nb);
set_head(av->top, (newsize - nb) | PREV_INUSE);
check_inuse_chunk(av, oldp);
check_inuse_chunk(av, oldp);
return chunk2mem(oldp);
}
@ -6589,7 +6589,7 @@ _int_realloc __MALLOC_P((mstate av, Void_t* oldmem, size_t bytes))
remainder = chunk_at_offset(newp, nb);
set_head_size(newp, nb | (av != &main_arena ? NON_MAIN_ARENA : 0));
set_head(remainder, remainder_size | PREV_INUSE |
(av != &main_arena ? NON_MAIN_ARENA : 0));
(av != &main_arena ? NON_MAIN_ARENA : 0));
/* Mark remainder as inuse so free() won't complain */
set_inuse_bit_at_offset(remainder, remainder_size);
_int_free(av, chunk2mem(remainder));
@ -6742,7 +6742,7 @@ _int_memalign __MALLOC_P((mstate av, size_t alignment, size_t bytes))
/* Otherwise, give back leader, use the rest */
set_head(newp, newsize | PREV_INUSE |
(av != &main_arena ? NON_MAIN_ARENA : 0));
(av != &main_arena ? NON_MAIN_ARENA : 0));
set_inuse_bit_at_offset(newp, newsize);
set_head_size(p, leadsize | (av != &main_arena ? NON_MAIN_ARENA : 0));
_int_free(av, chunk2mem(p));
@ -6759,7 +6759,7 @@ _int_memalign __MALLOC_P((mstate av, size_t alignment, size_t bytes))
remainder_size = size - nb;
remainder = chunk_at_offset(p, nb);
set_head(remainder, remainder_size | PREV_INUSE |
(av != &main_arena ? NON_MAIN_ARENA : 0));
(av != &main_arena ? NON_MAIN_ARENA : 0));
set_head_size(p, nb);
_int_free(av, chunk2mem(remainder));
}
@ -7220,7 +7220,7 @@ void mSTATs()
#if HAVE_MMAP
fprintf(stderr, "max mmap regions = %10u\n", (unsigned int)mp_.max_n_mmaps);
fprintf(stderr, "max mmap bytes = %10lu\n",
(unsigned long)mp_.max_mmapped_mem);
(unsigned long)mp_.max_mmapped_mem);
#endif
#if THREAD_STATS
fprintf(stderr, "heaps created = %10d\n", stat_n_heaps);
@ -7465,7 +7465,7 @@ int mALLOPt(param_number, value) int param_number; int value;
/* Deliberately fails to force use of mmap() */
static void *sbrkfail (long size)
{
return MORECORE_FAILURE;
return MORECORE_FAILURE;
}
#endif
@ -7478,7 +7478,7 @@ static void *sbrkfail (long size)
/* Wait for spin lock */
static long slwait (long *sl) {
while (InterlockedCompareExchange ((LONG volatile *) sl, 1, 0) != 0)
Sleep (0);
Sleep (0);
return 0;
}
@ -7547,8 +7547,8 @@ static int region_list_remove (region_list_entry **last) {
return TRUE;
}
#define CEIL(size,to) (((size)+(to)-1)&~((to)-1))
#define FLOOR(size,to) ((size)&~((to)-1))
#define CEIL(size,to) (((size)+(to)-1)&~((to)-1))
#define FLOOR(size,to) ((size)&~((to)-1))
#define SBRK_SCALE 0
/* #define SBRK_SCALE 1 */
@ -7610,7 +7610,7 @@ static void *sbrk (long size) {
assert (0 < remaining_commit_size && remaining_commit_size % g_pagesize == 0); {
/* Commit this */
void *base_committed = VirtualAlloc (g_last->top_committed, remaining_commit_size,
MEM_COMMIT, PAGE_READWRITE);
MEM_COMMIT, PAGE_READWRITE);
/* Check returned pointer for consistency */
if (base_committed != g_last->top_committed)
goto sbrk_exit;
@ -7672,7 +7672,7 @@ static void *sbrk (long size) {
assert (0 < reserve_size && reserve_size % g_regionsize == 0);
/* Try to reserve this */
base_reserved = VirtualAlloc (memory_info.BaseAddress, reserve_size,
MEM_RESERVE, PAGE_NOACCESS);
MEM_RESERVE, PAGE_NOACCESS);
if (! base_reserved) {
int rc = GetLastError ();
if (rc != ERROR_INVALID_ADDRESS)
@ -7718,7 +7718,7 @@ static void *sbrk (long size) {
assert (0 < commit_size && commit_size % g_pagesize == 0); {
/* Commit this */
void *base_committed = VirtualAlloc (g_last->top_committed, commit_size,
MEM_COMMIT, PAGE_READWRITE);
MEM_COMMIT, PAGE_READWRITE);
/* Check returned pointer for consistency */
if (base_committed != g_last->top_committed)
goto sbrk_exit;
@ -7955,13 +7955,13 @@ static int mprotect(const void *addr, long len, int prot)
else if(prot & PROT_WRITE) ntprot|=PAGE_READWRITE;
else ntprot|=PAGE_NOACCESS;
if(prot)
{ /* Do we need to commit any? */
{ /* Do we need to commit any? */
MEMORY_BASIC_INFORMATION mbi;
DWORD read=0;
for(; read<len && VirtualQuery(((char *)(addr))+read, &mbi, sizeof(mbi)); read+=mbi.RegionSize)
{
if(!(mbi.State & MEM_COMMIT))
{ /* Might as well do the lot */
{ /* Might as well do the lot */
if(!VirtualAlloc((LPVOID) addr, len, MEM_COMMIT, ntprot))
goto mprotect_exit;
#ifdef TRACE
@ -7972,7 +7972,7 @@ static int mprotect(const void *addr, long len, int prot)
}
}
else
{ /* prot==PROT_NONE also appears to be a euphemism for free */
{ /* prot==PROT_NONE also appears to be a euphemism for free */
MEMORY_BASIC_INFORMATION mbi;
DWORD read=0;
char *p;
@ -8060,14 +8060,14 @@ static int cpuinfo (int whole, CHUNK_SIZE_T *kernel, CHUNK_SIZE_T *user) {
/* ------------------------------------------------------------
History:
Hacked 19th Jan 2004 Niall Douglas (s_sourceforge <at symbol> nedprod.com)
* Merged Wolfram Gloger's SMP changes in with Doug Lea's v2.7.2 version
* Copy & pasted Gloger's external C file includes directly into this file
* Made various adjustments to let this compile as C++ & PTMALLOC_IN_CPPNAMESPACE
* Merged back in Win32 support, added MORECORE_IS_MMAP
* Added Win32 emulation of mprotect() plus made mmap() set page protection
correctly. No longer always commits arenas, now reserves and commits on demand
* Made all Win32 emulations decommit memory with PROT_NONE
* Added MSVC assembler op for largebin_index()
* Merged Wolfram Gloger's SMP changes in with Doug Lea's v2.7.2 version
* Copy & pasted Gloger's external C file includes directly into this file
* Made various adjustments to let this compile as C++ & PTMALLOC_IN_CPPNAMESPACE
* Merged back in Win32 support, added MORECORE_IS_MMAP
* Added Win32 emulation of mprotect() plus made mmap() set page protection
correctly. No longer always commits arenas, now reserves and commits on demand
* Made all Win32 emulations decommit memory with PROT_NONE
* Added MSVC assembler op for largebin_index()
V2.7.2 Sat Aug 17 09:07:30 2002 Doug Lea (dl at gee)
* Fix malloc_state bitmap array misdeclaration

View File

@ -471,7 +471,7 @@ read_args() {
if (index == 0) {
if (_binary_name.empty())
_binary_name = arg;
_binary_name = arg;
} else {
_args.push_back(arg);
}

View File

@ -607,8 +607,8 @@ get_filename_index(int index) const {
if (_hash_end != _hash_start) {
ostringstream strm;
strm << _filename.substr(0, _hash_start)
<< setw(_hash_end - _hash_start) << setfill('0') << index
<< _filename.substr(_hash_end);
<< setw(_hash_end - _hash_start) << setfill('0') << index
<< _filename.substr(_hash_end);
file.set_fullpath(strm.str());
}
file.set_pattern(false);
@ -863,7 +863,7 @@ make_true_case() {
assert(l < MAX_PATH + 1);
Filename true_case = Filename::from_os_specific(long_name);
// Now sanity-check the true-case filename. If it's not the same as
// the source file, except for case, reject it.
string orig_filename = get_fullpath();

View File

@ -331,17 +331,17 @@ std::string make_safe_name(const std::string & name)
/*
static const char safe_chars2[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
std::string result = name;
std::string result = name;
size_t pos = result.find_first_not_of(safe_chars2);
while (pos != std::string::npos)
{
result[pos] = '_';
pos = result.find_first_not_of(safe_chars2);
}
size_t pos = result.find_first_not_of(safe_chars2);
while (pos != std::string::npos)
{
result[pos] = '_';
pos = result.find_first_not_of(safe_chars2);
}
return result;
*/
return result;
*/
}
bool isInplaceFunction(const std::string &cppName)
@ -640,8 +640,8 @@ void InterfaceMakerPythonNative::write_ClasseDetails(ostream &out, Object * obj)
GetThis << " DTOOL_Call_ExtractThisPointerForType(self,&Dtool_"<< ClassName<<",(void **)&local_this);\n";
GetThis << " if(local_this == NULL) {\n";
GetThis << " // This might happen if Python called a reverse operator like __rsub__().\n";
GetThis << " Py_INCREF(Py_NotImplemented);\n";
GetThis << " return Py_NotImplemented;\n";
GetThis << " Py_INCREF(Py_NotImplemented);\n";
GetThis << " return Py_NotImplemented;\n";
GetThis << " }\n";
write_function_for_top(out, func,GetThis.str());
@ -1322,12 +1322,12 @@ write_module_class(ostream &out, Object *obj) {
out << " if(local_this != NULL)\n";
out << " {\n";
out << " ostringstream os;\n";
if (need_repr == 2) {
out << " local_this->output(os);\n";
} else {
out << " local_this->python_repr(os, \""
<< classNameFromCppName(ClassName) << "\");\n";
}
if (need_repr == 2) {
out << " local_this->output(os);\n";
} else {
out << " local_this->python_repr(os, \""
<< classNameFromCppName(ClassName) << "\");\n";
}
out << " std::string ss = os.str();\n";
out << " return PyString_FromStringAndSize(ss.data(),ss.length());\n";
out << " };\n";
@ -1386,7 +1386,7 @@ write_module_class(ostream &out, Object *obj) {
<< ".As_PyTypeObject().tp_doc =\n";
output_quoted(out, 10, obj->_itype.get_comment());
out << ";\n"
<< "#endif\n";
<< "#endif\n";
}
// add bases///
@ -2934,43 +2934,43 @@ NeedsAStrFunction(const InterrogateType &itype_class) {
const InterrogateFunction &ifunc = idb->get_function(func_index);
if (ifunc.get_name() == "write") {
if (ifunc._instances != (InterrogateFunction::Instances *)NULL) {
InterrogateFunction::Instances::const_iterator ii;
for (ii = ifunc._instances->begin();
ii != ifunc._instances->end();
++ii) {
CPPInstance *cppinst = (*ii).second;
CPPFunctionType *cppfunc = cppinst->_type->as_function_type();
if (cppfunc != NULL) {
if (cppfunc->_parameters != NULL &&
cppfunc->_return_type != NULL &&
TypeManager::is_void(cppfunc->_return_type)) {
if (cppfunc->_parameters->_parameters.size() == 1) {
CPPInstance *inst1 = cppfunc->_parameters->_parameters[0];
if (TypeManager::is_pointer_to_ostream(inst1->_type)) {
// write(ostream)
return 1;
}
}
InterrogateFunction::Instances::const_iterator ii;
for (ii = ifunc._instances->begin();
ii != ifunc._instances->end();
++ii) {
CPPInstance *cppinst = (*ii).second;
CPPFunctionType *cppfunc = cppinst->_type->as_function_type();
if (cppfunc->_parameters->_parameters.size() == 2) {
CPPInstance *inst1 = cppfunc->_parameters->_parameters[0];
if (TypeManager::is_pointer_to_ostream(inst1->_type)) {
inst1 = cppfunc->_parameters->_parameters[1];
if (inst1->_initializer != NULL) {
// write(ostream, int = 0)
return 1;
}
if (TypeManager::is_integer(inst1->_type)) {
// write(ostream, int)
return 2;
}
}
}
}
}
}
if (cppfunc != NULL) {
if (cppfunc->_parameters != NULL &&
cppfunc->_return_type != NULL &&
TypeManager::is_void(cppfunc->_return_type)) {
if (cppfunc->_parameters->_parameters.size() == 1) {
CPPInstance *inst1 = cppfunc->_parameters->_parameters[0];
if (TypeManager::is_pointer_to_ostream(inst1->_type)) {
// write(ostream)
return 1;
}
}
if (cppfunc->_parameters->_parameters.size() == 2) {
CPPInstance *inst1 = cppfunc->_parameters->_parameters[0];
if (TypeManager::is_pointer_to_ostream(inst1->_type)) {
inst1 = cppfunc->_parameters->_parameters[1];
if (inst1->_initializer != NULL) {
// write(ostream, int = 0)
return 1;
}
if (TypeManager::is_integer(inst1->_type)) {
// write(ostream, int)
return 2;
}
}
}
}
}
}
}
}
}
@ -3000,31 +3000,31 @@ NeedsAReprFunction(const InterrogateType &itype_class) {
const InterrogateFunction &ifunc = idb->get_function(func_index);
if (ifunc.get_name() == "python_repr") {
if (ifunc._instances != (InterrogateFunction::Instances *)NULL) {
InterrogateFunction::Instances::const_iterator ii;
for (ii = ifunc._instances->begin();
ii != ifunc._instances->end();
++ii) {
CPPInstance *cppinst = (*ii).second;
CPPFunctionType *cppfunc = cppinst->_type->as_function_type();
if (cppfunc != NULL) {
if (cppfunc->_parameters != NULL &&
cppfunc->_return_type != NULL &&
TypeManager::is_void(cppfunc->_return_type)) {
if (cppfunc->_parameters->_parameters.size() == 2) {
CPPInstance *inst1 = cppfunc->_parameters->_parameters[0];
if (TypeManager::is_pointer_to_ostream(inst1->_type)) {
inst1 = cppfunc->_parameters->_parameters[1];
if (TypeManager::is_string(inst1->_type) ||
TypeManager::is_char_pointer(inst1->_type)) {
// python_repr(ostream, string)
return 1;
}
}
}
}
}
}
InterrogateFunction::Instances::const_iterator ii;
for (ii = ifunc._instances->begin();
ii != ifunc._instances->end();
++ii) {
CPPInstance *cppinst = (*ii).second;
CPPFunctionType *cppfunc = cppinst->_type->as_function_type();
if (cppfunc != NULL) {
if (cppfunc->_parameters != NULL &&
cppfunc->_return_type != NULL &&
TypeManager::is_void(cppfunc->_return_type)) {
if (cppfunc->_parameters->_parameters.size() == 2) {
CPPInstance *inst1 = cppfunc->_parameters->_parameters[0];
if (TypeManager::is_pointer_to_ostream(inst1->_type)) {
inst1 = cppfunc->_parameters->_parameters[1];
if (TypeManager::is_string(inst1->_type) ||
TypeManager::is_char_pointer(inst1->_type)) {
// python_repr(ostream, string)
return 1;
}
}
}
}
}
}
}
}
}
@ -3034,38 +3034,38 @@ NeedsAReprFunction(const InterrogateType &itype_class) {
const InterrogateFunction &ifunc = idb->get_function(func_index);
if (ifunc.get_name() == "output") {
if (ifunc._instances != (InterrogateFunction::Instances *)NULL) {
InterrogateFunction::Instances::const_iterator ii;
for (ii = ifunc._instances->begin();
ii != ifunc._instances->end();
++ii) {
CPPInstance *cppinst = (*ii).second;
CPPFunctionType *cppfunc = cppinst->_type->as_function_type();
if (cppfunc != NULL) {
if (cppfunc->_parameters != NULL &&
cppfunc->_return_type != NULL &&
TypeManager::is_void(cppfunc->_return_type)) {
if (cppfunc->_parameters->_parameters.size() == 1) {
CPPInstance *inst1 = cppfunc->_parameters->_parameters[0];
if (TypeManager::is_pointer_to_ostream(inst1->_type)) {
// output(ostream)
return 2;
}
}
InterrogateFunction::Instances::const_iterator ii;
for (ii = ifunc._instances->begin();
ii != ifunc._instances->end();
++ii) {
CPPInstance *cppinst = (*ii).second;
CPPFunctionType *cppfunc = cppinst->_type->as_function_type();
if (cppfunc->_parameters->_parameters.size() >= 2) {
CPPInstance *inst1 = cppfunc->_parameters->_parameters[0];
if (TypeManager::is_pointer_to_ostream(inst1->_type)) {
inst1 = cppfunc->_parameters->_parameters[1];
if (inst1->_initializer != NULL) {
// output(ostream, foo = bar, ...)
return 2;
}
}
}
}
}
}
if (cppfunc != NULL) {
if (cppfunc->_parameters != NULL &&
cppfunc->_return_type != NULL &&
TypeManager::is_void(cppfunc->_return_type)) {
if (cppfunc->_parameters->_parameters.size() == 1) {
CPPInstance *inst1 = cppfunc->_parameters->_parameters[0];
if (TypeManager::is_pointer_to_ostream(inst1->_type)) {
// output(ostream)
return 2;
}
}
if (cppfunc->_parameters->_parameters.size() >= 2) {
CPPInstance *inst1 = cppfunc->_parameters->_parameters[0];
if (TypeManager::is_pointer_to_ostream(inst1->_type)) {
inst1 = cppfunc->_parameters->_parameters[1];
if (inst1->_initializer != NULL) {
// output(ostream, foo = bar, ...)
return 2;
}
}
}
}
}
}
}
}
}
@ -3097,15 +3097,15 @@ output_quoted(ostream &out, int indent_level, const std::string &str) {
case '\n':
out << "\\n\"\n";
indent(out, indent_level)
<< '"';
<< '"';
break;
default:
if (!isprint(*si)) {
out << "\\" << oct << setw(3) << setfill('0') << (unsigned int)(*si)
<< dec;
out << "\\" << oct << setw(3) << setfill('0') << (unsigned int)(*si)
<< dec;
} else {
out << *si;
out << *si;
}
}
}

View File

@ -21,11 +21,11 @@
#ifdef HAVE_PYTHON
PyMemberDef standard_type_members[] = {
{"this", T_INT, offsetof(Dtool_PyInstDef,_ptr_to_object),READONLY,"C++ This if any"},
{"this_ownership", T_INT, offsetof(Dtool_PyInstDef, _memory_rules), READONLY,"C++ 'this' ownership rules"},
{"this_signiture", T_INT, offsetof(Dtool_PyInstDef, _signiture), READONLY,"A type check signiture"},
{"this_metatype", T_OBJECT, offsetof(Dtool_PyInstDef, _My_Type), READONLY,"The dtool meta object"},
{NULL} /* Sentinel */
{"this", T_INT, offsetof(Dtool_PyInstDef,_ptr_to_object),READONLY,"C++ This if any"},
{"this_ownership", T_INT, offsetof(Dtool_PyInstDef, _memory_rules), READONLY,"C++ 'this' ownership rules"},
{"this_signiture", T_INT, offsetof(Dtool_PyInstDef, _signiture), READONLY,"A type check signiture"},
{"this_metatype", T_OBJECT, offsetof(Dtool_PyInstDef, _My_Type), READONLY,"The dtool meta object"},
{NULL} /* Sentinel */
};
@ -160,7 +160,7 @@ PyObject * DTool_CreatePyInstanceTyped(void * local_this_in, Dtool_PyTypedObject
// if we get this far .. just wrap the thing in the known type ??
// better than aborting...I guess....
/////////////////////////////////////////////////////
Dtool_PyInstDef * self = (Dtool_PyInstDef *) known_class_type.As_PyTypeObject().tp_new(&known_class_type.As_PyTypeObject(), NULL,NULL);
Dtool_PyInstDef * self = (Dtool_PyInstDef *) known_class_type.As_PyTypeObject().tp_new(&known_class_type.As_PyTypeObject(), NULL,NULL);
if(self != NULL)
{
self->_ptr_to_object = local_this_in;
@ -248,9 +248,9 @@ RegisterRuntimeClass(Dtool_PyTypedObject * otype, int class_id) {
// There was already an entry in the dictionary for class_id.
Dtool_PyTypedObject *other_type = (*result.first).second;
interrogatedb_cat.warning()
<< "Classes " << otype->_name << " and " << other_type->_name
<< " share the same TypeHandle value (" << class_id
<< "); check class definitions.\n";
<< "Classes " << otype->_name << " and " << other_type->_name
<< " share the same TypeHandle value (" << class_id
<< "); check class definitions.\n";
} else {
GetRunTimeTypeList().insert(class_id);
@ -432,7 +432,7 @@ int DTOOL_PyObject_Compare_old(PyObject *v1, PyObject *v2)
Py_DECREF(args);
}
Py_DECREF(func);
PyErr_Clear(); // just in case the function threw an error
PyErr_Clear(); // just in case the function threw an error
// only use if the cuntion return an INT... hmm
if(res != NULL && PyInt_Check(res))
{

View File

@ -22,8 +22,8 @@
// for performance and is treading on thin ice for function python or c++ will
// course there types to other types.
//
// The linking step will produce allot of warnings
// warning LNK4049: locally defined symbol..
// The linking step will produce allot of warnings
// warning LNK4049: locally defined symbol..
//
// Get a second coder to review this file and the generated code ..
//
@ -135,49 +135,49 @@ struct Dtool_PyTypedObject
////////////////////////////////////////////////////////////////////////
#define Define_Dtool_Class(MODULE_NAME, CLASS_NAME, PUBLIC_NAME) \
static PyNumberMethods Dtool_PyNumberMethods_##CLASS_NAME ={\
0,/*binaryfunc nb_add*/\
0,/*binaryfunc nb_subtract*/\
0,/*binaryfunc nb_multiply*/\
0,/*binaryfunc nb_divide*/\
0,/*binaryfunc nb_remainder*/\
0,/*binaryfunc nb_divmod*/\
0,/*ternaryfunc nb_power*/\
0,/*unaryfunc nb_negative*/\
0,/*unaryfunc nb_positive*/\
0,/*unaryfunc nb_absolute*/\
0,/*inquiry nb_nonzero*/\
0,/*unaryfunc nb_invert*/\
0,/*binaryfunc nb_lshift*/\
0,/*binaryfunc nb_rshift*/\
0,/*binaryfunc nb_and*/\
0,/*binaryfunc nb_xor*/\
0,/*binaryfunc nb_or*/\
0,/*coercion nb_coerce*/\
0,/*unaryfunc nb_int*/\
0,/*unaryfunc nb_long*/\
0,/*unaryfunc nb_float*/\
0,/*unaryfunc nb_oct*/\
0,/*unaryfunc nb_hex*/\
0,/*binaryfunc nb_inplace_add*/\
0,/*binaryfunc nb_inplace_subtract*/\
0,/*binaryfunc nb_inplace_multiply*/\
0,/*binaryfunc nb_inplace_divide*/\
0,/*binaryfunc nb_inplace_remainder*/\
0,/*ternaryfunc nb_inplace_power*/\
0,/*binaryfunc nb_inplace_lshift*/\
0,/*binaryfunc nb_inplace_rshift*/\
0,/*binaryfunc nb_inplace_and*/\
0,/*binaryfunc nb_inplace_xor*/\
0,/*binaryfunc nb_inplace_or*/\
0,/*binaryfunc nb_floor_divide*/\
0,/*binaryfunc nb_true_divide*/\
0,/*binaryfunc nb_inplace_floor_divide*/\
0,/*binaryfunc nb_inplace_true_divide*/\
0,/*binaryfunc nb_add*/\
0,/*binaryfunc nb_subtract*/\
0,/*binaryfunc nb_multiply*/\
0,/*binaryfunc nb_divide*/\
0,/*binaryfunc nb_remainder*/\
0,/*binaryfunc nb_divmod*/\
0,/*ternaryfunc nb_power*/\
0,/*unaryfunc nb_negative*/\
0,/*unaryfunc nb_positive*/\
0,/*unaryfunc nb_absolute*/\
0,/*inquiry nb_nonzero*/\
0,/*unaryfunc nb_invert*/\
0,/*binaryfunc nb_lshift*/\
0,/*binaryfunc nb_rshift*/\
0,/*binaryfunc nb_and*/\
0,/*binaryfunc nb_xor*/\
0,/*binaryfunc nb_or*/\
0,/*coercion nb_coerce*/\
0,/*unaryfunc nb_int*/\
0,/*unaryfunc nb_long*/\
0,/*unaryfunc nb_float*/\
0,/*unaryfunc nb_oct*/\
0,/*unaryfunc nb_hex*/\
0,/*binaryfunc nb_inplace_add*/\
0,/*binaryfunc nb_inplace_subtract*/\
0,/*binaryfunc nb_inplace_multiply*/\
0,/*binaryfunc nb_inplace_divide*/\
0,/*binaryfunc nb_inplace_remainder*/\
0,/*ternaryfunc nb_inplace_power*/\
0,/*binaryfunc nb_inplace_lshift*/\
0,/*binaryfunc nb_inplace_rshift*/\
0,/*binaryfunc nb_inplace_and*/\
0,/*binaryfunc nb_inplace_xor*/\
0,/*binaryfunc nb_inplace_or*/\
0,/*binaryfunc nb_floor_divide*/\
0,/*binaryfunc nb_true_divide*/\
0,/*binaryfunc nb_inplace_floor_divide*/\
0,/*binaryfunc nb_inplace_true_divide*/\
};\
static PyMappingMethods Dtool_PyMappingMethods_##CLASS_NAME ={\
0,/*inquiry mp_length */\
0,/*binaryfunc mp_subscript */\
0,/*objobjargproc mp_ass_subscript */\
0,/*inquiry mp_length */\
0,/*binaryfunc mp_subscript */\
0,/*objobjargproc mp_ass_subscript */\
};\
EXPORT_THIS Dtool_PyTypedObject Dtool_##CLASS_NAME = {\
{\
@ -196,31 +196,31 @@ EXPORT_THIS Dtool_PyTypedObject Dtool_##CLASS_NAME = {\
0, /*tp_as_sequence*/\
&Dtool_PyMappingMethods_##CLASS_NAME, /*tp_as_mapping*/\
0, /*tp_hash */\
0, /* tp_call */\
0, /* tp_str */\
PyObject_GenericGetAttr, /* tp_getattro */\
PyObject_GenericSetAttr, /* tp_setattro */\
0, /* tp_as_buffer */\
(Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_CHECKTYPES), /* tp_flags */\
0, /* tp_doc */\
0, /* tp_traverse */\
0, /* tp_clear */\
0, /* tp_richcompare */\
0, /* tp_weaklistoffset */\
0, /* tp_iter */\
0, /* tp_iternext */\
Dtool_Methods_##CLASS_NAME, /* tp_methods */\
standard_type_members, /* tp_members */\
0, /* tp_getset */\
0, /* tp_base */\
0, /* tp_dict */\
0, /* tp_descr_get */\
0, /* tp_descr_set */\
0, /* tp_dictoffset */\
Dtool_Init_##CLASS_NAME, /* tp_init */\
PyType_GenericAlloc, /* tp_alloc */\
Dtool_new_##CLASS_NAME, /* tp_new */\
_PyObject_Del, /* tp_free */\
0, /* tp_call */\
0, /* tp_str */\
PyObject_GenericGetAttr, /* tp_getattro */\
PyObject_GenericSetAttr, /* tp_setattro */\
0, /* tp_as_buffer */\
(Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_CHECKTYPES), /* tp_flags */\
0, /* tp_doc */\
0, /* tp_traverse */\
0, /* tp_clear */\
0, /* tp_richcompare */\
0, /* tp_weaklistoffset */\
0, /* tp_iter */\
0, /* tp_iternext */\
Dtool_Methods_##CLASS_NAME, /* tp_methods */\
standard_type_members, /* tp_members */\
0, /* tp_getset */\
0, /* tp_base */\
0, /* tp_dict */\
0, /* tp_descr_get */\
0, /* tp_descr_set */\
0, /* tp_dictoffset */\
Dtool_Init_##CLASS_NAME, /* tp_init */\
PyType_GenericAlloc, /* tp_alloc */\
Dtool_new_##CLASS_NAME, /* tp_new */\
_PyObject_Del, /* tp_free */\
},\
#CLASS_NAME, \
false,\
@ -245,7 +245,7 @@ inline void Dtool_Deallocate_General(PyObject * self)
#define Define_Dtool_new(CLASS_NAME,CNAME)\
PyObject *Dtool_new_##CLASS_NAME(PyTypeObject *type, PyObject *args, PyObject *kwds)\
{\
PyObject * self = type->tp_alloc(type, 0);\
PyObject * self = type->tp_alloc(type, 0);\
((Dtool_PyInstDef *)self)->_signiture = PY_PANDA_SIGNITURE;\
((Dtool_PyInstDef *)self)->_ptr_to_object = NULL;\
((Dtool_PyInstDef *)self)->_memory_rules = false;\

View File

@ -497,24 +497,24 @@ scan_up_from(Filename &result, const Filename &dir,
if (consider.scan_directory(files)) {
vector_string::const_iterator fi;
for (fi = files.begin(); fi != files.end(); ++fi) {
Globs::const_iterator gi;
for (gi = _prc_patterns.begin();
gi != _prc_patterns.end();
++gi) {
if ((*gi).matches(*fi)) {
result = consider;
return true;
}
}
for (gi = _prc_executable_patterns.begin();
gi != _prc_executable_patterns.end();
++gi) {
if ((*gi).matches(*fi)) {
result = consider;
return true;
}
}
Globs::const_iterator gi;
for (gi = _prc_patterns.begin();
gi != _prc_patterns.end();
++gi) {
if ((*gi).matches(*fi)) {
result = consider;
return true;
}
}
for (gi = _prc_executable_patterns.begin();
gi != _prc_executable_patterns.end();
++gi) {
if ((*gi).matches(*fi)) {
result = consider;
return true;
}
}
}
}
}

View File

@ -129,9 +129,9 @@ PUBLISHED:
GraphicsOutput *make_texture_buffer(const string &name, int x_size, int y_size,
Texture *tex = NULL, bool to_ram = false);
GraphicsOutput *make_cube_map(const string &name, int size,
NodePath &camera_rig,
DrawMask camera_mask = DrawMask::all_on(),
bool to_ram = false);
NodePath &camera_rig,
DrawMask camera_mask = DrawMask::all_on(),
bool to_ram = false);
INLINE static Filename make_screenshot_filename(const string &prefix = "screenshot");
INLINE Filename save_screenshot_default(const string &prefix = "screenshot");

View File

@ -599,8 +599,8 @@ set_properties_now(WindowProperties &properties) {
if (reshape_props.get_x_size() != _properties.get_x_size() ||
reshape_props.get_y_size() != _properties.get_y_size() ||
(has_origin && (x_origin != _properties.get_x_origin() ||
y_origin != _properties.get_y_origin()))) {
(has_origin && (x_origin != _properties.get_x_origin() ||
y_origin != _properties.get_y_origin()))) {
if (do_reshape_request(x_origin, y_origin, has_origin,
reshape_props.get_x_size(),
reshape_props.get_y_size())) {
@ -668,7 +668,7 @@ reset_window(bool swapchain) {
////////////////////////////////////////////////////////////////////
bool GraphicsWindow::
do_reshape_request(int x_origin, int y_origin, bool has_origin,
int x_size, int y_size) {
int x_size, int y_size) {
return false;
}

View File

@ -1818,7 +1818,7 @@ run_reading_header() {
}
reset_url(_request.get_url(), new_url);
_request.set_url(new_url);
_want_ssl = _request.get_url().is_ssl();
_want_ssl = _request.get_url().is_ssl();
make_header();
make_request_text();

View File

@ -134,7 +134,7 @@ TextureContext *DXGraphicsStateGuardian7::
prepare_texture(Texture *tex) {
DXTextureContext7 *dtc = new DXTextureContext7(tex);
if (dtc->create_texture(_d3d_device, _num_tex_formats, _tex_formats,
&_screen->D3DDevDesc) == NULL) {
&_screen->D3DDevDesc) == NULL) {
delete dtc;
return NULL;
}
@ -175,14 +175,14 @@ apply_texture(int i, TextureContext *tc) {
// error or oversight.
if ((dirty & Texture::DF_image) == 0) {
dxgsg7_cat.warning()
<< "Texture " << *dtc->_texture << " has changed mipmap state.\n";
<< "Texture " << *dtc->_texture << " has changed mipmap state.\n";
}
if (!dtc->create_texture(_d3d_device, _num_tex_formats, _tex_formats,
&_screen->D3DDevDesc)) {
&_screen->D3DDevDesc)) {
// Oops, we can't re-create the texture for some reason.
dxgsg7_cat.error()
<< "Unable to re-create texture " << *dtc->_texture << endl;
<< "Unable to re-create texture " << *dtc->_texture << endl;
_d3d_device->SetTextureStageState(i, D3DTSS_COLOROP, D3DTOP_DISABLE);
return;
}
@ -198,7 +198,7 @@ apply_texture(int i, TextureContext *tc) {
_d3d_device->SetTextureStageState(i, D3DTSS_ADDRESSV, get_texture_wrap_mode(wrap_v));
_d3d_device->SetTextureStageState(i, D3DTSS_BORDERCOLOR,
Colorf_to_D3DCOLOR(tex->get_border_color()));
Colorf_to_D3DCOLOR(tex->get_border_color()));
uint aniso_degree = tex->get_anisotropic_degree();
Texture::FilterType ft = tex->get_magfilter();
@ -295,7 +295,7 @@ do_clear(const RenderBuffer &buffer) {
}
HRESULT hr = _d3d_device->Clear(0, NULL, flags, _d3dcolor_clear_value,
(D3DVALUE) _depth_clear_value, 0);
(D3DVALUE) _depth_clear_value, 0);
if (hr != DD_OK) {
dxgsg7_cat.error()
<< "clear_buffer failed: Clear returned " << ConvD3DErrorToString(hr)
@ -938,7 +938,7 @@ reset() {
// range-based fog only works with vertex fog in dx7/8
if(dx_use_rangebased_fog && (_screen->D3DDevDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGRANGE))
_screen->pD3DDevice->SetRenderState(D3DRENDERSTATE_RANGEFOGENABLE, true);
_screen->pD3DDevice->SetRenderState(D3DRENDERSTATE_RANGEFOGENABLE, true);
}
}
@ -969,7 +969,7 @@ reset() {
_max_texture_stages = 1;
_max_texture_dimension =
min(_screen->D3DDevDesc.dwMaxTextureWidth,
_screen->D3DDevDesc.dwMaxTextureHeight);
_screen->D3DDevDesc.dwMaxTextureHeight);
_supports_texture_combine = false;
_supports_texture_saved_result = false;
@ -1774,12 +1774,12 @@ do_issue_texture() {
} else {
LMatrix4f m = tex_mat->get_mat();
_d3d_device->SetTransform(get_tex_mat_sym(i), (D3DMATRIX *)m.get_data());
DWORD transform_flags = texcoord_dimensions;
if (m.get_col(3) != LVecBase4f(0.0f, 0.0f, 0.0f, 1.0f)) {
// If we have a projected texture matrix, we also need to
// set D3DTTFF_COUNT4.
transform_flags = D3DTTFF_COUNT4 | D3DTTFF_PROJECTED;
}
DWORD transform_flags = texcoord_dimensions;
if (m.get_col(3) != LVecBase4f(0.0f, 0.0f, 0.0f, 1.0f)) {
// If we have a projected texture matrix, we also need to
// set D3DTTFF_COUNT4.
transform_flags = D3DTTFF_COUNT4 | D3DTTFF_PROJECTED;
}
_d3d_device->SetTextureStageState(i, D3DTSS_TEXTURETRANSFORMFLAGS,
transform_flags);
}
@ -2512,7 +2512,7 @@ enum_tex_formats_callback(LPDDPIXELFORMAT pddpf, void *param) {
DXGraphicsStateGuardian7 *gsg = (DXGraphicsStateGuardian7 *)param;
nassertr(gsg->_num_tex_formats < MAX_DX_TEXPIXFMTS, E_FAIL);
memcpy(&(gsg->_tex_formats[gsg->_num_tex_formats]), pddpf,
sizeof(DDPIXELFORMAT));
sizeof(DDPIXELFORMAT));
gsg->_num_tex_formats++;
return DDENUMRET_OK;

View File

@ -331,7 +331,7 @@ HRESULT ConvertPixBuftoDDSurf(ConversionType ConvNeeded,BYTE *pbuf,LPDIRECTDRAWS
for(DWORD y=0; y<dwOrigHeight; y++,pDDSurfBytes+=ddsd.lPitch) {
pDstWord = (WORD*)pDDSurfBytes;
for(DWORD x=0; x<dwOrigWidth; x++,pSrcWord++,pDstWord++) {
BYTE r,g,b,a;
DWORD dwPixel = *pSrcWord;

View File

@ -37,7 +37,7 @@ munge_format_impl(const GeomVertexFormat *orig,
if (animation.get_animation_type() != AT_none) {
dxgsg8_cat.debug()
<< "preparing animation type " << animation << " for " << *orig
<< "\n";
<< "\n";
}
}
// We have to build a completely new format that includes only the

View File

@ -366,22 +366,22 @@ handle_reshape() {
int y_size = props.get_y_size();
if (_wcontext._presentation_params.BackBufferWidth != x_size ||
_wcontext._presentation_params.BackBufferHeight != y_size) {
_wcontext._presentation_params.BackBufferHeight != y_size) {
bool resize_succeeded = reset_device_resize_window(x_size, y_size);
if (wdxdisplay8_cat.is_debug()) {
if (!resize_succeeded) {
wdxdisplay8_cat.debug()
<< "windowed_resize to size: (" << x_size << ", " << y_size
<< ") failed due to out-of-memory\n";
} else {
int x_origin = props.get_x_origin();
int y_origin = props.get_y_origin();
wdxdisplay8_cat.debug()
<< "windowed_resize to origin: (" << x_origin << ", "
<< y_origin << "), size: (" << x_size
<< ", " << y_size << ")\n";
}
if (!resize_succeeded) {
wdxdisplay8_cat.debug()
<< "windowed_resize to size: (" << x_size << ", " << y_size
<< ") failed due to out-of-memory\n";
} else {
int x_origin = props.get_x_origin();
int y_origin = props.get_y_origin();
wdxdisplay8_cat.debug()
<< "windowed_resize to origin: (" << x_origin << ", "
<< y_origin << "), size: (" << x_size
<< ", " << y_size << ")\n";
}
}
}
}
@ -622,13 +622,13 @@ create_screen_buffers_and_device(DXScreenData &display, bool force_16bpp_zbuffer
if (FAILED(hr)) {
wdxdisplay8_cat.fatal()
<< "GetAdapterDisplayMode failed" << D3DERRORSTRING(hr);
<< "GetAdapterDisplayMode failed" << D3DERRORSTRING(hr);
return false;
}
if (dispmode.Format == D3DFMT_P8) {
wdxdisplay8_cat.fatal()
<< "Can't run windowed in an 8-bit or less display mode" << endl;
<< "Can't run windowed in an 8-bit or less display mode" << endl;
return false;
}
@ -636,11 +636,11 @@ create_screen_buffers_and_device(DXScreenData &display, bool force_16bpp_zbuffer
if (dx_multisample_antialiasing_level<2) {
if (do_sync) {
// It turns out that COPY_VSYNC has real performance problems
// on many nVidia cards--it syncs at some random interval,
// possibly skipping over several video syncs. Screw it,
// we'll effectively disable sync-video with windowed mode
// using DirectX8.
// It turns out that COPY_VSYNC has real performance problems
// on many nVidia cards--it syncs at some random interval,
// possibly skipping over several video syncs. Screw it,
// we'll effectively disable sync-video with windowed mode
// using DirectX8.
//presentation_params->SwapEffect = D3DSWAPEFFECT_COPY_VSYNC;
presentation_params->SwapEffect = D3DSWAPEFFECT_DISCARD;
} else {

View File

@ -1788,7 +1788,7 @@ r_collect_tangent_binormal(const GlobPattern &uv_name,
// texcoords on the polygon. A front-facing polygon
// should not contribute to the tangent and binormal of
// a back-facing polygon, and vice-versa.
value._facing = is_right(w1 - w2, w3 - w1);
value._facing = is_right(w1 - w2, w3 - w1);
double x1 = p2[0] - p1[0];
double x2 = p3[0] - p1[0];

View File

@ -359,7 +359,7 @@ is_equivalent_to(const EggTexture &other, int eq) const {
if (eq & E_attributes) {
//cout << "compared by attributes" << endl;
if (_texture_type != other._texture_type ||
_format != other._format ||
_format != other._format ||
_wrap_mode != other._wrap_mode ||
_wrap_u != other._wrap_u ||
_wrap_v != other._wrap_v ||
@ -610,18 +610,18 @@ string_texture_type(const string &string) {
return TT_1d_texture;
} else if (cmp_nocase_uh(string, "2d") == 0 ||
cmp_nocase_uh(string, "2dtexture") == 0 ||
cmp_nocase_uh(string, "2d_texture") == 0) {
cmp_nocase_uh(string, "2dtexture") == 0 ||
cmp_nocase_uh(string, "2d_texture") == 0) {
return TT_2d_texture;
} else if (cmp_nocase_uh(string, "3d") == 0 ||
cmp_nocase_uh(string, "3dtexture") == 0 ||
cmp_nocase_uh(string, "3d_texture") == 0) {
cmp_nocase_uh(string, "3dtexture") == 0 ||
cmp_nocase_uh(string, "3d_texture") == 0) {
return TT_2d_texture;
} else if (cmp_nocase_uh(string, "cube") == 0 ||
cmp_nocase_uh(string, "cubemap") == 0 ||
cmp_nocase_uh(string, "cube_map") == 0) {
cmp_nocase_uh(string, "cubemap") == 0 ||
cmp_nocase_uh(string, "cube_map") == 0) {
return TT_cube_map;
} else {

View File

@ -947,7 +947,7 @@ vertex_body:
vertex->set_uv_obj(uv);
}
}
vertex_uv_body '}'
vertex_uv_body '}'
{
egg_stack.pop_back();
}
@ -1535,7 +1535,7 @@ rotz:
;
rotate3d:
ROTATE '{' real real real real '}'
ROTATE '{' real real real real '}'
{
egg_stack.back()->as_transform()->add_rotate3d($3, LVector3d($4, $5, $6));
}
@ -1549,14 +1549,14 @@ scale2d:
;
scale3d:
SCALE '{' real real real '}'
SCALE '{' real real real '}'
{
egg_stack.back()->as_transform()->add_scale3d(LVecBase3d($3, $4, $5));
}
;
;
uniform_scale:
SCALE '{' real '}'
SCALE '{' real '}'
{
egg_stack.back()->as_transform()->add_uniform_scale($3);
}
@ -1865,7 +1865,7 @@ primitive_body:
// the component attributes.
egg_stack.push_back(new EggPolygon);
}
primitive_component_body '}'
primitive_component_body '}'
{
PT(EggPrimitive) prim = DCAST(EggPrimitive, egg_stack.back());
egg_stack.pop_back();

View File

@ -878,12 +878,12 @@ load_texture(TextureDef &def, const EggTexture *egg_tex) {
case EggTexture::TT_2d_texture:
if (egg_tex->has_alpha_filename() && wanted_alpha) {
tex = TexturePool::load_texture(egg_tex->get_fullpath(),
egg_tex->get_alpha_fullpath(),
wanted_channels,
egg_tex->get_alpha_file_channel());
egg_tex->get_alpha_fullpath(),
wanted_channels,
egg_tex->get_alpha_file_channel());
} else {
tex = TexturePool::load_texture(egg_tex->get_fullpath(),
wanted_channels);
wanted_channels);
}
break;
@ -2035,10 +2035,10 @@ make_vertex_data(const EggRenderState *render_state,
CPT(InternalName) delta_name =
InternalName::get_morph(InternalName::get_normal(), morph.get_name());
gvw.set_column(delta_name);
Normald morphed_normal = orig_normal + morph.get_offset();
Normald transformed_morphed_normal = normalize(morphed_normal * transform);
LVector3d delta = transformed_morphed_normal - transformed_normal;
gvw.add_data3f(LCAST(float, delta));
Normald morphed_normal = orig_normal + morph.get_offset();
Normald transformed_morphed_normal = normalize(morphed_normal * transform);
LVector3d delta = transformed_morphed_normal - transformed_normal;
gvw.add_data3f(LCAST(float, delta));
}
}
}
@ -2336,7 +2336,7 @@ make_sphere(EggGroup *egg_group, EggGroup::CollideFlags flags,
for (vi = vertices.begin(); vi != vertices.end(); ++vi) {
EggVertex *vtx = (*vi);
LPoint3d p3 = vtx->get_pos3();
LVector3d v = p3 * mat - d_center;
LVector3d v = p3 * mat - d_center;
radius2 = max(radius2, v.length_squared());
}

View File

@ -686,8 +686,8 @@ calc_match_length(const char* buf1, const char* buf2, PN_uint32 max_length,
if (min_length >= max_length)
return 0;
if (buf1[min_length] != buf2[min_length] ||
buf1[min_length-1] != buf2[min_length-1] ||
buf1[min_length-2] != buf2[min_length-2]) {
buf1[min_length-1] != buf2[min_length-1] ||
buf1[min_length-2] != buf2[min_length-2]) {
return 0;
}
}
@ -725,11 +725,11 @@ find_longest_match(PN_uint32 new_pos, PN_uint32 &copy_pos, PN_uint16 &copy_lengt
// calc match length
copy_length = (PN_uint16)calc_match_length(&buffer_new[new_pos],
&buffer_orig[copy_pos],
min(min((length_new - new_pos),
(length_orig - copy_pos)),
_MAX_RUN_LENGTH),
0);
&buffer_orig[copy_pos],
min(min((length_new - new_pos),
(length_orig - copy_pos)),
_MAX_RUN_LENGTH),
0);
// run through link table, see if we find any longer matches
PN_uint32 match_offset;
@ -738,11 +738,11 @@ find_longest_match(PN_uint32 new_pos, PN_uint32 &copy_pos, PN_uint16 &copy_lengt
while (match_offset != _NULL_VALUE) {
match_length = (PN_uint16)calc_match_length(&buffer_new[new_pos],
&buffer_orig[match_offset],
min(min((length_new - new_pos),
(length_orig - match_offset)),
_MAX_RUN_LENGTH),
copy_length);
&buffer_orig[match_offset],
min(min((length_new - new_pos),
(length_orig - match_offset)),
_MAX_RUN_LENGTH),
copy_length);
// have we found a longer match?
if (match_length > copy_length) {

View File

@ -150,15 +150,15 @@ TrueClock() {
(QueryPerformanceFrequency((LARGE_INTEGER *)&int_frequency) != 0);
if (_has_high_res) {
if (int_frequency <= 0) {
express_cat.error()
<< "TrueClock::get_real_time() - frequency is negative!" << endl;
_has_high_res = false;
express_cat.error()
<< "TrueClock::get_real_time() - frequency is negative!" << endl;
_has_high_res = false;
} else {
_frequency = (double)int_frequency;
_recip_frequency = 1.0 / _frequency;
QueryPerformanceCounter((LARGE_INTEGER *)&_init_count);
_frequency = (double)int_frequency;
_recip_frequency = 1.0 / _frequency;
QueryPerformanceCounter((LARGE_INTEGER *)&_init_count);
}
}
}
@ -295,9 +295,9 @@ correct_time(double time) {
double corrected_time = time * _time_scale + _time_offset;
double corrected_tod = tod + _tod_offset;
if (corrected_time - corrected_tod > paranoid_clock_jump_error_max_delta &&
_time_scale > 0.00001) {
_time_scale > 0.00001) {
express_cat.info()
<< "Force-adjusting time_scale to catch up to errors.\n";
<< "Force-adjusting time_scale to catch up to errors.\n";
set_time_scale(time, _time_scale * 0.5);
}
@ -338,25 +338,25 @@ correct_time(double time) {
// since we last reported it.
double ratio = _time_scale / _last_reported_time_scale;
if (fabs(ratio - 1.0) > paranoid_clock_report_scale_factor) {
_time_scale_changed = true;
_last_reported_time_scale = _time_scale;
// Actually report it a little bit later, to give the time
// scale a chance to settle down.
_report_time_scale_time = tod + _tod_offset + keep_interval;
if (express_cat.is_debug()) {
express_cat.debug()
<< "Will report time scale, now " << 100.0 / _time_scale
<< "%, tod_age = " << tod_age << ", time_age = " << time_age
<< ", ratio = " << ratio << "\n";
}
_time_scale_changed = true;
_last_reported_time_scale = _time_scale;
// Actually report it a little bit later, to give the time
// scale a chance to settle down.
_report_time_scale_time = tod + _tod_offset + keep_interval;
if (express_cat.is_debug()) {
express_cat.debug()
<< "Will report time scale, now " << 100.0 / _time_scale
<< "%, tod_age = " << tod_age << ", time_age = " << time_age
<< ", ratio = " << ratio << "\n";
}
}
}
// Clean out old entries in the timestamps queue.
if (tod_age > keep_interval) {
while (!_timestamps.empty() &&
tod - _timestamps.front()._tod > keep_interval) {
_timestamps.pop_front();
tod - _timestamps.front()._tod > keep_interval) {
_timestamps.pop_front();
}
}
@ -398,11 +398,11 @@ correct_time(double time) {
// We caught up.
_chase_clock = CC_keep_even;
if (express_cat.is_debug()) {
express_cat.debug()
<< "Clock back down to real time.\n";
// Let's report the clock error now, so an app can resync now
// that we're at a good time.
++_error_count;
express_cat.debug()
<< "Clock back down to real time.\n";
// Let's report the clock error now, so an app can resync now
// that we're at a good time.
++_error_count;
}
} else {
@ -420,18 +420,18 @@ correct_time(double time) {
_chase_clock = CC_speed_up;
if (express_cat.is_debug()) {
express_cat.debug()
<< "Clock is behind by " << (corrected_tod - corrected_time)
<< "s; speeding up to correct.\n";
express_cat.debug()
<< "Clock is behind by " << (corrected_tod - corrected_time)
<< "s; speeding up to correct.\n";
}
} else if ((corrected_time - corrected_tod) > paranoid_clock_chase_threshold) {
// Oops, we're going too fast; need to slow down.
_chase_clock = CC_slow_down;
if (express_cat.is_debug()) {
express_cat.debug()
<< "Clock is ahead by " << (corrected_time - corrected_tod)
<< "s; slowing down to correct.\n";
express_cat.debug()
<< "Clock is ahead by " << (corrected_time - corrected_tod)
<< "s; slowing down to correct.\n";
}
}
break;
@ -441,11 +441,11 @@ correct_time(double time) {
// We caught up.
_chase_clock = CC_keep_even;
if (express_cat.is_debug()) {
express_cat.debug()
<< "Clock back up to real time.\n";
// Let's report the clock error now, so an app can resync now
// that we're at a good time.
++_error_count;
express_cat.debug()
<< "Clock back up to real time.\n";
// Let's report the clock error now, so an app can resync now
// that we're at a good time.
++_error_count;
}
} else {

View File

@ -1276,16 +1276,16 @@ begin_draw_primitives(const Geom *geom, const GeomMunger *munger,
// buffers are unbound, or the nVidia drivers may crash.
if (_current_vbuffer_index != 0) {
if (GLCAT.is_spam()) {
GLCAT.spam()
<< "unbinding vertex buffer\n";
GLCAT.spam()
<< "unbinding vertex buffer\n";
}
_glBindBuffer(GL_ARRAY_BUFFER, 0);
_current_vbuffer_index = 0;
}
if (_current_ibuffer_index != 0) {
if (GLCAT.is_spam()) {
GLCAT.spam()
<< "unbinding index buffer\n";
GLCAT.spam()
<< "unbinding index buffer\n";
}
_glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
_current_ibuffer_index = 0;
@ -2139,7 +2139,7 @@ apply_vertex_buffer(VertexBufferContext *vbc) {
if (_current_vbuffer_index != gvbc->_index) {
if (GLCAT.is_spam()) {
GLCAT.spam()
<< "binding vertex buffer " << gvbc->_index << "\n";
<< "binding vertex buffer " << gvbc->_index << "\n";
}
_glBindBuffer(GL_ARRAY_BUFFER, gvbc->_index);
_current_vbuffer_index = gvbc->_index;
@ -2199,7 +2199,7 @@ release_vertex_buffer(VertexBufferContext *vbc) {
if (_current_vbuffer_index == gvbc->_index) {
if (GLCAT.is_spam()) {
GLCAT.spam()
<< "unbinding vertex buffer\n";
<< "unbinding vertex buffer\n";
}
_glBindBuffer(GL_ARRAY_BUFFER, 0);
_current_vbuffer_index = 0;
@ -2239,8 +2239,8 @@ setup_array_data(const GeomVertexArrayData *data) {
// are configured off.
if (_current_vbuffer_index != 0) {
if (GLCAT.is_spam()) {
GLCAT.spam()
<< "unbinding vertex buffer\n";
GLCAT.spam()
<< "unbinding vertex buffer\n";
}
_glBindBuffer(GL_ARRAY_BUFFER, 0);
_current_vbuffer_index = 0;
@ -2306,7 +2306,7 @@ apply_index_buffer(IndexBufferContext *ibc) {
if (_current_ibuffer_index != gibc->_index) {
if (GLCAT.is_spam()) {
GLCAT.spam()
<< "binding index buffer " << gibc->_index << "\n";
<< "binding index buffer " << gibc->_index << "\n";
}
_glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, gibc->_index);
_current_ibuffer_index = gibc->_index;
@ -2366,7 +2366,7 @@ release_index_buffer(IndexBufferContext *ibc) {
if (_current_ibuffer_index == gibc->_index) {
if (GLCAT.is_spam()) {
GLCAT.spam()
<< "unbinding index buffer\n";
<< "unbinding index buffer\n";
}
_glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
_current_ibuffer_index = 0;
@ -2406,8 +2406,8 @@ setup_primitive(const GeomPrimitive *data) {
// are configured off.
if (_current_ibuffer_index != 0) {
if (GLCAT.is_spam()) {
GLCAT.spam()
<< "unbinding index buffer\n";
GLCAT.spam()
<< "unbinding index buffer\n";
}
_glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
_current_ibuffer_index = 0;
@ -4847,7 +4847,7 @@ do_auto_rescale_normal() {
if (_supports_rescale_normal && support_rescale_normal) {
GLP(Disable)(GL_RESCALE_NORMAL);
if (GLCAT.is_spam()) {
GLCAT.spam() << "glDisable(GL_RESCALE_NORMAL)\n";
GLCAT.spam() << "glDisable(GL_RESCALE_NORMAL)\n";
}
}
@ -4857,13 +4857,13 @@ do_auto_rescale_normal() {
GLP(Enable)(GL_RESCALE_NORMAL);
GLP(Disable)(GL_NORMALIZE);
if (GLCAT.is_spam()) {
GLCAT.spam() << "glEnable(GL_RESCALE_NORMAL)\n";
GLCAT.spam() << "glDisable(GL_NORMALIZE)\n";
GLCAT.spam() << "glEnable(GL_RESCALE_NORMAL)\n";
GLCAT.spam() << "glDisable(GL_NORMALIZE)\n";
}
} else {
GLP(Enable)(GL_NORMALIZE);
if (GLCAT.is_spam()) {
GLCAT.spam() << "glEnable(GL_NORMALIZE)\n";
GLCAT.spam() << "glEnable(GL_NORMALIZE)\n";
}
}
@ -4876,7 +4876,7 @@ do_auto_rescale_normal() {
if (_supports_rescale_normal && support_rescale_normal) {
GLP(Disable)(GL_RESCALE_NORMAL);
if (GLCAT.is_spam()) {
GLCAT.spam() << "glDisable(GL_RESCALE_NORMAL)\n";
GLCAT.spam() << "glDisable(GL_RESCALE_NORMAL)\n";
}
}
}

View File

@ -32,15 +32,15 @@ ConfigVariableBool CLP(support_clamp_to_border)
("gl-support-clamp-to-border", true,
PRC_DESC("Configure this true to enable the use of the clamp_to_border "
"extension if the GL claims to support it, or false not to "
"use it even if it appears to be available. (On some OpenGL "
"drivers, enabling this mode can force software rendering.)"));
"use it even if it appears to be available. (On some OpenGL "
"drivers, enabling this mode can force software rendering.)"));
ConfigVariableBool CLP(support_rescale_normal)
("gl-support-rescale-normal", true,
PRC_DESC("Configure this true to enable the use of the rescale_normal "
"extension if the GL claims to support it, or false not to use "
"it even if it appears to be available. (This appears to be "
"buggy on some drivers.)"));
"it even if it appears to be available. (This appears to be "
"buggy on some drivers.)"));
ConfigVariableBool CLP(ignore_filters)
("gl-ignore-filters", false,

View File

@ -3043,7 +3043,7 @@ extern "C" {
#include <stddef.h>
#ifndef GL_VERSION_2_0
/* GL type for program/shader text */
typedef char GLchar; /* native character */
typedef char GLchar; /* native character */
#endif
#ifndef GL_VERSION_1_5
@ -3060,8 +3060,8 @@ typedef ptrdiff_t GLsizeiptrARB;
#ifndef GL_ARB_shader_objects
/* GL types for handling shader object handles and program/shader text */
typedef char GLcharARB; /* native character */
typedef unsigned int GLhandleARB; /* shader object handle */
typedef char GLcharARB; /* native character */
typedef unsigned int GLhandleARB; /* shader object handle */
#endif
/* GL types for "half" precision (s10e5) float data in host memory */

View File

@ -322,16 +322,16 @@ typedef struct __GLXFBConfigRec *GLXFBConfigSGIX;
typedef XID GLXPbufferSGIX;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came for SendEvent request */
Display *display; /* display the event was read from */
GLXDrawable drawable; /* i.d. of Drawable */
int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */
int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */
unsigned int mask; /* mask indicating which buffers are affected*/
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came for SendEvent request */
Display *display; /* display the event was read from */
GLXDrawable drawable; /* i.d. of Drawable */
int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */
int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */
unsigned int mask; /* mask indicating which buffers are affected*/
int x, y;
int width, height;
int count; /* if nonzero, at least this many more */
int count; /* if nonzero, at least this many more */
} GLXBufferClobberEventSGIX;
#endif

View File

@ -102,10 +102,10 @@ ConfigVariableBool vertex_arrays
"to using immediate-mode commands like glVertex3f(), etc., to "
"issue the vertices, which is potentially much slower than "
"vertex arrays. Setting this false also disables vertex buffers, "
"effectively ignoring the setting of the vertex-buffers variable "
"(since vertex buffers are a special case of vertex arrays in "
"OpenGL). This variable is normally not enabled in a production "
"build. This has no effect on DirectX rendering."));
"effectively ignoring the setting of the vertex-buffers variable "
"(since vertex buffers are a special case of vertex arrays in "
"OpenGL). This variable is normally not enabled in a production "
"build. This has no effect on DirectX rendering."));
ConfigVariableBool display_lists
("display-lists", false,
@ -192,9 +192,9 @@ extern EXPCL_PANDA ConfigVariableBool textures_header_only;
ConfigVariableBool textures_header_only
("textures-header-only", false,
PRC_DESC("If this is true, texture images will not actually be loaded from "
"disk, but the image header information will be consulted to verify "
"number of channels and so forth. The texture images themselves "
"will be generated in a default blue color."));
"disk, but the image header information will be consulted to verify "
"number of channels and so forth. The texture images themselves "
"will be generated in a default blue color."));
ConfigVariableInt geom_cache_size
("geom-cache-size", 5000,

View File

@ -135,7 +135,7 @@ write_texture_types(ostream &out, int indent_level) const {
string name = tex->get_type().get_name();
indent(out, indent_level) << name;
indent(out, max(30 - (int)name.length(), 0))
<< " ." << extension << "\n";
<< " ." << extension << "\n";
}
}
}
@ -166,10 +166,10 @@ TexturePool() {
ConfigVariableString fake_texture_image
("fake-texture-image", "",
PRC_DESC("Set this to enable a speedy-load mode in which you don't care "
"what the world looks like, you just want it to load in minimal "
"time. This causes all texture loads via the TexturePool to use "
"the same texture file, which will presumably only be loaded "
"once."));
"what the world looks like, you just want it to load in minimal "
"time. This causes all texture loads via the TexturePool to use "
"the same texture file, which will presumably only be loaded "
"once."));
_fake_texture_image = fake_texture_image;
}
@ -456,7 +456,7 @@ ns_garbage_collect() {
_normalization_cube_map->get_ref_count() == 1) {
if (gobj_cat.is_debug()) {
gobj_cat.debug()
<< "Releasing normalization cube map\n";
<< "Releasing normalization cube map\n";
}
++num_released;
_normalization_cube_map = NULL;
@ -497,14 +497,14 @@ report_texture_unreadable(const Filename &filename) const {
// fully-qualified--therefore, it wasn't found along either
// search path.
gobj_cat.error()
<< "Unable to find texture \"" << filename << "\""
<< " on texture_path " << texture_path
<< " or model_path " << model_path <<"\n";
<< "Unable to find texture \"" << filename << "\""
<< " on texture_path " << texture_path
<< " or model_path " << model_path <<"\n";
} else {
// A fully-specified filename is not searched along the path, so
// don't mislead the user with the error message.
gobj_cat.error()
<< "Texture \"" << filename << "\" does not exist.\n";
<< "Texture \"" << filename << "\" does not exist.\n";
}
} else {
@ -516,8 +516,8 @@ report_texture_unreadable(const Filename &filename) const {
MakeTextureFunc *func = get_texture_type(filename.get_extension());
if (func == (MakeTextureFunc *)NULL) {
gobj_cat.error()
<< "Texture extension \"" << filename.get_extension()
<< "\" is unknown. Supported texture types:\n";
<< "Texture extension \"" << filename.get_extension()
<< "\" is unknown. Supported texture types:\n";
write_texture_types(gobj_cat.error(false), 2);
}
}

View File

@ -67,7 +67,7 @@ get_tex_scale() const {
LVecBase2f(1.0f, 1.0f);
}
return LVecBase2f((float)_video_width / _x_size,
(float)_video_height / _y_size);
(float)_video_height / _y_size);
}
////////////////////////////////////////////////////////////////////

View File

@ -73,7 +73,7 @@ public:
AnimInterface::init_type();
register_type(_type_handle, "VideoTexture",
Texture::get_class_type(),
AnimInterface::get_class_type());
AnimInterface::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();

View File

@ -259,7 +259,7 @@ modify_page(int z) {
////////////////////////////////////////////////////////////////////
bool OpenCVTexture::
reconsider_video_properties(const OpenCVTexture::VideoStream &stream,
int num_components, int z) {
int num_components, int z) {
double frame_rate = 0.0f;
int num_frames = 0;
@ -291,7 +291,7 @@ reconsider_video_properties(const OpenCVTexture::VideoStream &stream,
}
if (!reconsider_image_properties(x_size, y_size, num_components,
T_unsigned_byte, z)) {
T_unsigned_byte, z)) {
return false;
}
@ -342,68 +342,68 @@ update_frame(int frame) {
}
if (page._color.is_valid()) {
nassertv(get_num_components() >= 3 && get_component_width() == 1);
const unsigned char *source = page._color.get_frame_data(frame);
if (source != NULL) {
nassertv(get_video_width() <= _x_size && get_video_height() <= _y_size);
unsigned char *dest = _image.p() + get_expected_ram_page_size() * z;
int dest_row_width = (_x_size * _num_components * _component_width);
int source_row_width = get_video_width() * 3;
if (get_num_components() == 3) {
// The easy case--copy the whole thing in, row by row.
for (int y = 0; y < get_video_height(); ++y) {
memcpy(dest, source, source_row_width);
dest += dest_row_width;
source += source_row_width;
}
} else {
// The harder case--interleave the color in with the alpha,
// pixel by pixel.
nassertv(get_num_components() == 4);
for (int y = 0; y < get_video_height(); ++y) {
int dx = 0;
int sx = 0;
for (int x = 0; x < get_video_width(); ++x) {
dest[dx] = source[sx];
dest[dx + 1] = source[sx + 1];
dest[dx + 2] = source[sx + 2];
dx += 4;
sx += 3;
}
dest += dest_row_width;
source += source_row_width;
}
}
nassertv(get_video_width() <= _x_size && get_video_height() <= _y_size);
unsigned char *dest = _image.p() + get_expected_ram_page_size() * z;
int dest_row_width = (_x_size * _num_components * _component_width);
int source_row_width = get_video_width() * 3;
if (get_num_components() == 3) {
// The easy case--copy the whole thing in, row by row.
for (int y = 0; y < get_video_height(); ++y) {
memcpy(dest, source, source_row_width);
dest += dest_row_width;
source += source_row_width;
}
} else {
// The harder case--interleave the color in with the alpha,
// pixel by pixel.
nassertv(get_num_components() == 4);
for (int y = 0; y < get_video_height(); ++y) {
int dx = 0;
int sx = 0;
for (int x = 0; x < get_video_width(); ++x) {
dest[dx] = source[sx];
dest[dx + 1] = source[sx + 1];
dest[dx + 2] = source[sx + 2];
dx += 4;
sx += 3;
}
dest += dest_row_width;
source += source_row_width;
}
}
}
}
if (page._alpha.is_valid()) {
nassertv(get_num_components() == 4 && get_component_width() == 1);
const unsigned char *source = page._alpha.get_frame_data(frame);
if (source != NULL) {
nassertv(get_video_width() <= _x_size && get_video_height() <= _y_size);
unsigned char *dest = _image.p() + get_expected_ram_page_size() * z;
int dest_row_width = (_x_size * _num_components * _component_width);
int source_row_width = get_video_width() * 3;
// Interleave the alpha in with the color, pixel by pixel.
// Even though the alpha will probably be a grayscale video,
// the OpenCV library presents it as RGB.
for (int y = 0; y < get_video_height(); ++y) {
int dx = 3;
int sx = _alpha_file_channel;
for (int x = 0; x < get_video_width(); ++x) {
dest[dx] = source[sx];
dx += 4;
sx += 3;
}
dest += dest_row_width;
source += source_row_width;
}
nassertv(get_video_width() <= _x_size && get_video_height() <= _y_size);
unsigned char *dest = _image.p() + get_expected_ram_page_size() * z;
int dest_row_width = (_x_size * _num_components * _component_width);
int source_row_width = get_video_width() * 3;
// Interleave the alpha in with the color, pixel by pixel.
// Even though the alpha will probably be a grayscale video,
// the OpenCV library presents it as RGB.
for (int y = 0; y < get_video_height(); ++y) {
int dx = 3;
int sx = _alpha_file_channel;
for (int x = 0; x < get_video_width(); ++x) {
dest[dx] = source[sx];
dx += 4;
sx += 3;
}
dest += dest_row_width;
source += source_row_width;
}
}
}
}

View File

@ -48,10 +48,10 @@ PUBLISHED:
bool from_camera(int camera_index = -1, int z = 0);
virtual bool read(const Filename &fullpath, int z = 0,
int primary_file_num_channels = 0);
int primary_file_num_channels = 0);
virtual bool read(const Filename &fullpath, const Filename &alpha_fullpath,
int z = 0,
int primary_file_num_channels = 0, int alpha_file_channel = 0);
int z = 0,
int primary_file_num_channels = 0, int alpha_file_channel = 0);
virtual bool load(const PNMImage &pnmimage, int z = 0);
public:
@ -66,7 +66,7 @@ private:
VideoPage &modify_page(int z);
bool reconsider_video_properties(const VideoStream &stream,
int num_components, int z);
int num_components, int z);
void do_update();
class VideoStream {

View File

@ -101,7 +101,7 @@ decompose_matrix(const FLOATNAME(LMatrix3) &mat,
INLINE_LINMATH bool
decompose_matrix(const FLOATNAME(LMatrix4) &mat,
FLOATNAME(LVecBase3) &scale,
FLOATNAME(LVecBase3) &shear,
FLOATNAME(LVecBase3) &shear,
FLOATNAME(LVecBase3) &hpr,
FLOATNAME(LVecBase3) &translate,
CoordinateSystem cs) {

View File

@ -43,7 +43,7 @@ PerlinNoise2() :
////////////////////////////////////////////////////////////////////
INLINE PerlinNoise2::
PerlinNoise2(double sx, double sy,
int table_size, unsigned long seed) :
int table_size, unsigned long seed) :
PerlinNoise(table_size, seed)
{
init_unscaled_xform();

View File

@ -77,5 +77,5 @@ init_unscaled_xform() {
// And come up with a random translation too, just so the
// singularity at (0, 0) is also unpredicatable.
_unscaled_xform.set_row(2, LVecBase2d(random_real_unit(),
random_real_unit()));
random_real_unit()));
}

View File

@ -33,8 +33,8 @@ class EXPCL_PANDA PerlinNoise2 : public PerlinNoise {
PUBLISHED:
INLINE PerlinNoise2();
INLINE PerlinNoise2(double sx, double sy,
int table_size = 256,
unsigned long seed = 0);
int table_size = 256,
unsigned long seed = 0);
INLINE PerlinNoise2(const PerlinNoise2 &copy);
INLINE void operator = (const PerlinNoise2 &copy);

View File

@ -43,7 +43,7 @@ PerlinNoise3() :
////////////////////////////////////////////////////////////////////
INLINE PerlinNoise3::
PerlinNoise3(double sx, double sy, double sz,
int table_size, unsigned long seed) :
int table_size, unsigned long seed) :
PerlinNoise(table_size, seed)
{
init_unscaled_xform();

View File

@ -86,15 +86,15 @@ noise(const LVecBase3d &value) const {
void PerlinNoise3::
init_unscaled_xform() {
LRotationd rot(random_real_unit(),
random_real_unit(),
random_real_unit(),
random_real_unit());
random_real_unit(),
random_real_unit(),
random_real_unit());
rot.normalize();
rot.extract_to_matrix(_unscaled_xform);
// And come up with a random translation too, just so the
// singularity at (0, 0, 0) is also unpredicatable.
_unscaled_xform.set_row(3, LVecBase3d(random_real_unit(),
random_real_unit(),
random_real_unit()));
random_real_unit(),
random_real_unit()));
}

View File

@ -33,7 +33,7 @@ class EXPCL_PANDA PerlinNoise3 : public PerlinNoise {
PUBLISHED:
INLINE PerlinNoise3();
INLINE PerlinNoise3(double sx, double sy, double sz,
int table_size = 256, unsigned long seed = 0);
int table_size = 256, unsigned long seed = 0);
INLINE PerlinNoise3(const PerlinNoise3 &copy);
INLINE void operator = (const PerlinNoise3 &copy);

View File

@ -796,11 +796,11 @@ r_find_length(float target_length, float &found_t,
// Compute t value that corresponds to target_length
// Maybe the point is in the left half of the segment?
if (r_find_t(target_length, found_t, t1, tmid, p1, pmid)) {
return true;
return true;
}
// Maybe it's on the right half?
if (r_find_t(target_length - left, found_t, tmid, t2, pmid, p2)) {
return true;
return true;
}
}
return false;
@ -908,8 +908,8 @@ r_find_t(float target_length, float &found_t,
////////////////////////////////////////////////////////////////////
bool ParametricCurve::
find_t_linear(float target_length, float &found_t,
float t1, float t2,
const LPoint3f &p1, const LPoint3f &p2) const {
float t1, float t2,
const LPoint3f &p1, const LPoint3f &p2) const {
const float length_tolerance = (p1-p2).length()/tolerance_divisor;
const float t_tolerance = (t1+t2)/tolerance_divisor;
@ -939,8 +939,8 @@ find_t_linear(float target_length, float &found_t,
/*
if (parametrics_cat.is_spam()) {
parametrics_cat.spam()
<< "tleft " << tleft << " tright " << tright <<
" tmid " << tmid << " len " << len << endl;
<< "tleft " << tleft << " tright " << tright <<
" tmid " << tmid << " len " << len << endl;
}
*/
@ -953,7 +953,7 @@ find_t_linear(float target_length, float &found_t,
/*
if (parametrics_cat.is_spam()) {
parametrics_cat.spam()
<< "tright-tleft " << tright-tleft << " t_tolerance " << t_tolerance << endl;
<< "tright-tleft " << tright-tleft << " t_tolerance " << t_tolerance << endl;
}
*/

View File

@ -140,8 +140,8 @@ private:
float t1, float t2,
const LPoint3f &p1, const LPoint3f &p2) const;
bool find_t_linear(float target_length, float &found_t,
float t1, float t2,
const LPoint3f &p1, const LPoint3f &p2) const;
float t1, float t2,
const LPoint3f &p1, const LPoint3f &p2) const;
protected:
int _curve_type;

View File

@ -60,7 +60,7 @@ add_texture(Texture *tex, float texels_per_unit, bool resize) {
} else {
if(tex != (Texture *)NULL) {
if (tex != (Texture *)NULL) {
_anims.push_back(new SpriteAnim(tex,TexCoordf(0.0f, 0.0f),TexCoordf(1.0f, 1.0f)));
_anims.push_back(new SpriteAnim(tex,TexCoordf(0.0f, 0.0f),TexCoordf(1.0f, 1.0f)));
}
if(resize) {
// We scale the particle size by the size of the texture.

View File

@ -214,12 +214,12 @@ traverse_below(CullTraverserData &data) {
_geoms_pcollector.add_level(num_geoms);
for (int i = 0; i < num_geoms; i++) {
CullableObject *object = new CullableObject(data, geom_node, i);
if (object->_state->has_cull_callback() &&
!object->_state->cull_callback(this, data)) {
delete object;
} else {
_cull_handler->record_object(object, this);
}
if (object->_state->has_cull_callback() &&
!object->_state->cull_callback(this, data)) {
delete object;
} else {
_cull_handler->record_object(object, this);
}
}
}
@ -541,7 +541,7 @@ start_decal(const CullTraverserData &data) {
CullableObject *next_object =
new CullableObject(data, geom_node, i, object);
if (next_object->_state->has_cull_callback() &&
!next_object->_state->cull_callback(this, data)) {
!next_object->_state->cull_callback(this, data)) {
next_object->_next = NULL;
delete next_object;
} else {
@ -607,15 +607,15 @@ r_get_decals(CullTraverserData &data, CullableObject *decals) {
int num_geoms = geom_node->get_num_geoms();
_geoms_pcollector.add_level(num_geoms);
for (int i = num_geoms - 1; i >= 0; i--) {
CullableObject *next_decals =
new CullableObject(data, geom_node, i, decals);
if (next_decals->_state->has_cull_callback() &&
!next_decals->_state->cull_callback(this, data)) {
CullableObject *next_decals =
new CullableObject(data, geom_node, i, decals);
if (next_decals->_state->has_cull_callback() &&
!next_decals->_state->cull_callback(this, data)) {
next_decals->_next = NULL;
delete next_decals;
} else {
decals = next_decals;
}
delete next_decals;
} else {
decals = next_decals;
}
}
}
}

View File

@ -91,10 +91,10 @@ munge_geom(GraphicsStateGuardianBase *gsg,
// the vertices in the CPU--and we have to do it before we call
// munge_geom(), which might lose the tangent and binormal.
CPT(GeomVertexData) animated_vertices =
_munged_data->animate_vertices();
_munged_data->animate_vertices();
if (animated_vertices != _munged_data) {
cpu_animated = true;
_munged_data = animated_vertices;
cpu_animated = true;
_munged_data = animated_vertices;
}
munge_texcoord_light_vector(traverser);
}
@ -113,10 +113,10 @@ munge_geom(GraphicsStateGuardianBase *gsg,
// animation in hardware--then we have to calculate that
// animation now.
CPT(GeomVertexData) animated_vertices =
_munged_data->animate_vertices();
_munged_data->animate_vertices();
if (animated_vertices != _munged_data) {
cpu_animated = true;
_munged_data = animated_vertices;
cpu_animated = true;
_munged_data = animated_vertices;
}
}
@ -212,8 +212,8 @@ munge_points_to_quads(const CullTraverser *traverser) {
PT(GeomVertexArrayFormat) new_array_format =
new GeomVertexArrayFormat(InternalName::get_vertex(), 4,
Geom::NT_float32,
Geom::C_clip_point);
Geom::NT_float32,
Geom::C_clip_point);
if (has_normal) {
const GeomVertexColumn *c = normal.get_column();
new_array_format->add_column
@ -316,27 +316,27 @@ munge_points_to_quads(const CullTraverser *traverser) {
unsigned int *vertices_end = vertices + num_vertices;
if (primitive->is_indexed()) {
GeomVertexReader index(primitive->get_vertices(), 0);
for (unsigned int *vi = vertices; vi != vertices_end; ++vi) {
// Get the point in eye-space coordinates.
unsigned int v = index.get_data1i();
nassertv(v < (unsigned int)num_points);
(*vi) = v;
vertex.set_row(v);
points[v]._eye = modelview.xform_point(vertex.get_data3f());
points[v]._dist = gsg->compute_distance_to(points[v]._eye);
}
GeomVertexReader index(primitive->get_vertices(), 0);
for (unsigned int *vi = vertices; vi != vertices_end; ++vi) {
// Get the point in eye-space coordinates.
unsigned int v = index.get_data1i();
nassertv(v < (unsigned int)num_points);
(*vi) = v;
vertex.set_row(v);
points[v]._eye = modelview.xform_point(vertex.get_data3f());
points[v]._dist = gsg->compute_distance_to(points[v]._eye);
}
} else {
// Nonindexed case.
unsigned int first_vertex = primitive->get_first_vertex();
for (int i = 0; i < num_vertices; ++i) {
unsigned int v = i + first_vertex;
nassertv(v < (unsigned int)num_points);
vertices[i] = v;
vertex.set_row(v);
points[v]._eye = modelview.xform_point(vertex.get_data3f());
points[v]._dist = gsg->compute_distance_to(points[v]._eye);
}
// Nonindexed case.
unsigned int first_vertex = primitive->get_first_vertex();
for (int i = 0; i < num_vertices; ++i) {
unsigned int v = i + first_vertex;
nassertv(v < (unsigned int)num_points);
vertices[i] = v;
vertex.set_row(v);
points[v]._eye = modelview.xform_point(vertex.get_data3f());
points[v]._dist = gsg->compute_distance_to(points[v]._eye);
}
}
// Now sort the points in order from back-to-front so they will
@ -352,111 +352,111 @@ munge_points_to_quads(const CullTraverser *traverser) {
PT(GeomPrimitive) new_primitive = new GeomTriangles(Geom::UH_client);
for (unsigned int *vi = vertices; vi != vertices_end; ++vi) {
// The point in eye coordinates.
const LPoint3f &eye = points[*vi]._eye;
// The point in eye coordinates.
const LPoint3f &eye = points[*vi]._eye;
// The point in clip coordinates.
LPoint4f p4 = LPoint4f(eye[0], eye[1], eye[2], 1.0f) * projection;
// The point in clip coordinates.
LPoint4f p4 = LPoint4f(eye[0], eye[1], eye[2], 1.0f) * projection;
if (has_size) {
size.set_row(*vi);
point_size = size.get_data1f();
}
if (has_size) {
size.set_row(*vi);
point_size = size.get_data1f();
}
float scale_y = point_size;
if (perspective) {
// Perspective-sized points. Here point_size is the point's
// height in 3-d units. To arrange that, we need to figure
// out the appropriate scaling factor based on the current
// viewport and projection matrix.
float scale = _modelview_transform->get_scale()[1];
LVector3f height(0.0f, point_size * scale, scale);
height = height * height_projection;
scale_y = height[1] * viewport_height;
float scale_y = point_size;
if (perspective) {
// Perspective-sized points. Here point_size is the point's
// height in 3-d units. To arrange that, we need to figure
// out the appropriate scaling factor based on the current
// viewport and projection matrix.
float scale = _modelview_transform->get_scale()[1];
LVector3f height(0.0f, point_size * scale, scale);
height = height * height_projection;
scale_y = height[1] * viewport_height;
// We should then divide the radius by the distance from the
// camera plane, to emulate the glPointParameters() behavior.
if (!lens->is_orthographic()) {
scale_y /= gsg->compute_distance_to(eye);
}
}
// We should then divide the radius by the distance from the
// camera plane, to emulate the glPointParameters() behavior.
if (!lens->is_orthographic()) {
scale_y /= gsg->compute_distance_to(eye);
}
}
// Also factor in the homogeneous scale for being in clip
// coordinates still.
scale_y *= p4[3];
// Also factor in the homogeneous scale for being in clip
// coordinates still.
scale_y *= p4[3];
float scale_x = scale_y;
if (has_aspect_ratio) {
aspect_ratio.set_row(*vi);
scale_x *= aspect_ratio.get_data1f();
}
float scale_x = scale_y;
if (has_aspect_ratio) {
aspect_ratio.set_row(*vi);
scale_x *= aspect_ratio.get_data1f();
}
// Define the first two corners based on the scales in X and Y.
LPoint2f c0(scale_x, scale_y);
LPoint2f c1(-scale_x, scale_y);
// Define the first two corners based on the scales in X and Y.
LPoint2f c0(scale_x, scale_y);
LPoint2f c1(-scale_x, scale_y);
if (has_rotate) {
// If we have a rotate factor, apply it to those two corners.
rotate.set_row(*vi);
float r = rotate.get_data1f();
LMatrix3f mat = LMatrix3f::rotate_mat(r);
c0 = c0 * mat;
c1 = c1 * mat;
}
if (has_rotate) {
// If we have a rotate factor, apply it to those two corners.
rotate.set_row(*vi);
float r = rotate.get_data1f();
LMatrix3f mat = LMatrix3f::rotate_mat(r);
c0 = c0 * mat;
c1 = c1 * mat;
}
// Finally, scale the corners in their newly-rotated position,
// to compensate for the aspect ratio of the viewport.
float rx = 1.0f / viewport_width;
float ry = 1.0f / viewport_height;
c0.set(c0[0] * rx, c0[1] * ry);
c1.set(c1[0] * rx, c1[1] * ry);
// Finally, scale the corners in their newly-rotated position,
// to compensate for the aspect ratio of the viewport.
float rx = 1.0f / viewport_width;
float ry = 1.0f / viewport_height;
c0.set(c0[0] * rx, c0[1] * ry);
c1.set(c1[0] * rx, c1[1] * ry);
new_vertex.add_data4f(p4[0] + c0[0], p4[1] + c0[1], p4[2], p4[3]);
new_vertex.add_data4f(p4[0] + c1[0], p4[1] + c1[1], p4[2], p4[3]);
new_vertex.add_data4f(p4[0] - c1[0], p4[1] - c1[1], p4[2], p4[3]);
new_vertex.add_data4f(p4[0] - c0[0], p4[1] - c0[1], p4[2], p4[3]);
new_vertex.add_data4f(p4[0] + c0[0], p4[1] + c0[1], p4[2], p4[3]);
new_vertex.add_data4f(p4[0] + c1[0], p4[1] + c1[1], p4[2], p4[3]);
new_vertex.add_data4f(p4[0] - c1[0], p4[1] - c1[1], p4[2], p4[3]);
new_vertex.add_data4f(p4[0] - c0[0], p4[1] - c0[1], p4[2], p4[3]);
if (has_normal) {
normal.set_row(*vi);
Normalf c = render_transform.xform_vec(normal.get_data3f());
new_normal.add_data3f(c);
new_normal.add_data3f(c);
new_normal.add_data3f(c);
new_normal.add_data3f(c);
}
if (has_color) {
color.set_row(*vi);
const Colorf &c = color.get_data4f();
new_color.add_data4f(c);
new_color.add_data4f(c);
new_color.add_data4f(c);
new_color.add_data4f(c);
}
if (sprite_texcoord) {
new_texcoord.add_data2f(1.0f, 0.0f);
new_texcoord.add_data2f(0.0f, 0.0f);
new_texcoord.add_data2f(1.0f, 1.0f);
new_texcoord.add_data2f(0.0f, 1.0f);
} else if (has_texcoord) {
texcoord.set_row(*vi);
const LVecBase4f &c = texcoord.get_data4f();
new_texcoord.add_data4f(c);
new_texcoord.add_data4f(c);
new_texcoord.add_data4f(c);
new_texcoord.add_data4f(c);
}
if (has_normal) {
normal.set_row(*vi);
Normalf c = render_transform.xform_vec(normal.get_data3f());
new_normal.add_data3f(c);
new_normal.add_data3f(c);
new_normal.add_data3f(c);
new_normal.add_data3f(c);
}
if (has_color) {
color.set_row(*vi);
const Colorf &c = color.get_data4f();
new_color.add_data4f(c);
new_color.add_data4f(c);
new_color.add_data4f(c);
new_color.add_data4f(c);
}
if (sprite_texcoord) {
new_texcoord.add_data2f(1.0f, 0.0f);
new_texcoord.add_data2f(0.0f, 0.0f);
new_texcoord.add_data2f(1.0f, 1.0f);
new_texcoord.add_data2f(0.0f, 1.0f);
} else if (has_texcoord) {
texcoord.set_row(*vi);
const LVecBase4f &c = texcoord.get_data4f();
new_texcoord.add_data4f(c);
new_texcoord.add_data4f(c);
new_texcoord.add_data4f(c);
new_texcoord.add_data4f(c);
}
new_primitive->add_vertex(new_vi);
new_primitive->add_vertex(new_vi + 1);
new_primitive->add_vertex(new_vi + 2);
new_primitive->close_primitive();
new_primitive->add_vertex(new_vi);
new_primitive->add_vertex(new_vi + 1);
new_primitive->add_vertex(new_vi + 2);
new_primitive->close_primitive();
new_primitive->add_vertex(new_vi + 2);
new_primitive->add_vertex(new_vi + 1);
new_primitive->add_vertex(new_vi + 3);
new_primitive->close_primitive();
new_primitive->add_vertex(new_vi + 2);
new_primitive->add_vertex(new_vi + 1);
new_primitive->add_vertex(new_vi + 3);
new_primitive->close_primitive();
new_vi += 4;
new_vi += 4;
}
new_geom->add_primitive(new_primitive);
@ -508,15 +508,15 @@ munge_texcoord_light_vector(const CullTraverser *traverser) {
// use the most important light in the current state.
CPT(RenderAttrib) attrib = _state->get_attrib(LightAttrib::get_class_type());
if (attrib != (RenderAttrib *)NULL) {
CPT(LightAttrib) la = DCAST(LightAttrib, attrib);
light = la->get_most_important_light();
/*
if (!light.is_empty()) {
// Remove that light, now that we're accounting for it in
// the normal map.
_state->set_attrib(la->remove_on_light(light));
}
*/
CPT(LightAttrib) la = DCAST(LightAttrib, attrib);
light = la->get_most_important_light();
/*
if (!light.is_empty()) {
// Remove that light, now that we're accounting for it in
// the normal map.
_state->set_attrib(la->remove_on_light(light));
}
*/
}
}
if (!light.is_empty()) {
@ -532,38 +532,38 @@ munge_texcoord_light_vector(const CullTraverser *traverser) {
CPT(InternalName) texcoord_name = stage->get_texcoord_name();
if (_munged_data->has_column(tangent_name) &&
_munged_data->has_column(binormal_name)) {
// Create a new column for the new texcoords.
PT(GeomVertexData) new_data = _munged_data->replace_column
(texcoord_name, 3, Geom::NT_float32, Geom::C_texcoord);
_munged_data = new_data;
// Remove this TexGen stage from the state, since we're handling
// it now.
_state = _state->add_attrib(tex_gen->remove_stage(stage));
// Get the transform from the light to the object.
CPT(TransformState) light_transform =
net_transform->invert_compose(light.get_net_transform());
const LMatrix4f &light_mat = light_transform->get_mat();
GeomVertexWriter texcoord(new_data, texcoord_name);
GeomVertexReader vertex(new_data, InternalName::get_vertex());
GeomVertexReader tangent(new_data, tangent_name);
GeomVertexReader binormal(new_data, binormal_name);
GeomVertexReader normal(new_data, InternalName::get_normal());
while (!vertex.is_at_end()) {
LPoint3f p = vertex.get_data3f();
LVector3f t = tangent.get_data3f();
LVector3f b = binormal.get_data3f();
LVector3f n = normal.get_data3f();
LVector3f lv;
if (light_obj->get_vector_to_light(lv, p, light_mat)) {
texcoord.add_data3f(lv.dot(t), lv.dot(b), lv.dot(n));
}
}
_munged_data->has_column(binormal_name)) {
// Create a new column for the new texcoords.
PT(GeomVertexData) new_data = _munged_data->replace_column
(texcoord_name, 3, Geom::NT_float32, Geom::C_texcoord);
_munged_data = new_data;
// Remove this TexGen stage from the state, since we're handling
// it now.
_state = _state->add_attrib(tex_gen->remove_stage(stage));
// Get the transform from the light to the object.
CPT(TransformState) light_transform =
net_transform->invert_compose(light.get_net_transform());
const LMatrix4f &light_mat = light_transform->get_mat();
GeomVertexWriter texcoord(new_data, texcoord_name);
GeomVertexReader vertex(new_data, InternalName::get_vertex());
GeomVertexReader tangent(new_data, tangent_name);
GeomVertexReader binormal(new_data, binormal_name);
GeomVertexReader normal(new_data, InternalName::get_normal());
while (!vertex.is_at_end()) {
LPoint3f p = vertex.get_data3f();
LVector3f t = tangent.get_data3f();
LVector3f b = binormal.get_data3f();
LVector3f n = normal.get_data3f();
LVector3f lv;
if (light_obj->get_vector_to_light(lv, p, light_mat)) {
texcoord.add_data3f(lv.dot(t), lv.dot(b), lv.dot(n));
}
}
}
}
}

View File

@ -565,7 +565,7 @@ get_most_important_light() const {
nassertr(!np.is_empty() && np.node()->as_light() != (Light *)NULL, NodePath());
if (!np.node()->is_exact_type(AmbientLight::get_class_type())) {
if (best.is_empty() || compare(np, best)) {
best = np;
best = np;
}
}
}

View File

@ -73,7 +73,7 @@ PUBLISHED:
Results &results) const;
INLINE PT(PandaNode) load_sync(const Filename &filename,
const LoaderOptions &options = LoaderOptions()) const;
const LoaderOptions &options = LoaderOptions()) const;
uint request_load(const string &event_name, const Filename &filename, bool search = true);
bool check_load(uint id);

View File

@ -3780,7 +3780,7 @@ project_texture(TextureStage *stage, Texture *tex, const NodePath &projector) {
////////////////////////////////////////////////////////////////////
void NodePath::
set_normal_map(Texture *normal_map, const string &texcoord_name,
bool preserve_color) {
bool preserve_color) {
clear_normal_map();
// First, we apply the normal map itself, to the bottom layer.
@ -3804,7 +3804,7 @@ set_normal_map(Texture *normal_map, const string &texcoord_name,
// Finally, we enable M_light_vector texture coordinate generation.
set_tex_gen(normalization_map_ts, TexGenAttrib::M_light_vector,
texcoord_name, NodePath());
texcoord_name, NodePath());
if (preserve_color) {
// One more stage to get back the original color.
@ -3836,14 +3836,14 @@ clear_normal_map() {
for (int i = 0; i < ta->get_num_on_stages(); i++) {
TextureStage *stage = ta->get_on_stage(i);
if (stage->get_name() == "__normal_map") {
clear_texture(stage);
clear_texture(stage);
} else if (stage->get_name() == "__normalization_map") {
clear_texture(stage);
clear_tex_gen(stage);
clear_texture(stage);
clear_tex_gen(stage);
} else if (stage->get_name() == "__orig_color") {
clear_texture(stage);
clear_texture(stage);
}
}
}
@ -5783,7 +5783,7 @@ r_has_vertex_column(PandaNode *node, const InternalName *name) const {
const Geom *geom = gnode->get_geom(i);
CPT(GeomVertexData) vdata = geom->get_vertex_data();
if (vdata->has_column(name)) {
return true;
return true;
}
}
}

View File

@ -643,7 +643,7 @@ PUBLISHED:
INLINE void clear_project_texture(TextureStage *stage);
void set_normal_map(Texture *normal_map, const string &texcoord_name = string(),
bool preserve_color = false);
bool preserve_color = false);
void clear_normal_map();
INLINE bool has_texcoord(const string &texcoord_name) const;

View File

@ -326,8 +326,8 @@ private:
PUBLISHED:
HprScaleLerpFunctor(NodePath np,
LVecBase3f hstart, LVecBase3f hend, LVecBase3f sstart,
LVecBase3f send)
LVecBase3f hstart, LVecBase3f hend, LVecBase3f sstart,
LVecBase3f send)
: LerpFunctor(), _node_path(np),
_hstart(hstart), _hend(hend),
_hdiff_cache(hend-hstart), _sstart(sstart), _send(send),
@ -340,15 +340,15 @@ PUBLISHED:
_hdiff_cache(_hend-_hstart), _sstart(ssx, ssy, ssz),
_send(sex, sey, sez), _sdiff_cache(_send-_sstart), _is_wrt(false) {}
HprScaleLerpFunctor(NodePath np,
LVecBase3f hstart, LVecBase3f hend, LVecBase3f sstart,
LVecBase3f send, NodePath wrt)
LVecBase3f hstart, LVecBase3f hend, LVecBase3f sstart,
LVecBase3f send, NodePath wrt)
: LerpFunctor(), _node_path(np), _hstart(hstart), _hend(hend),
_hdiff_cache(hend-hstart), _sstart(sstart), _send(send),
_sdiff_cache(send-sstart), _is_wrt(true), _wrt_path(wrt) {}
HprScaleLerpFunctor(NodePath np, float hsx, float hsy,
float hsz, float hex, float hey, float hez, float ssx,
float ssy, float ssz, float sex, float sey, float sez,
NodePath wrt)
float hsz, float hex, float hey, float hez, float ssx,
float ssy, float ssz, float sex, float sey, float sez,
NodePath wrt)
: LerpFunctor(), _node_path(np),
_hstart(hsx, hsy, hsz), _hend(hex, hey, hez),
_hdiff_cache(_hend-_hstart), _sstart(ssx, ssy, ssz),

View File

@ -68,7 +68,7 @@ public:
AnimInterface::init_type();
register_type(_type_handle, "SequenceNode",
SelectiveChildNode::get_class_type(),
AnimInterface::get_class_type());
AnimInterface::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();

View File

@ -494,17 +494,17 @@ record_stage(TextureStage *stage, TexGenAttrib::ModeDef &mode_def) {
case M_light_vector:
{
if (!mode_def._light.is_empty()) {
Light *light_obj = mode_def._light.node()->as_light();
if (light_obj == (Light *)NULL) {
Light *light_obj = mode_def._light.node()->as_light();
if (light_obj == (Light *)NULL) {
#ifndef NDEBUG
ostringstream strm;
strm << "Not a light: " << mode_def._light;
nassert_raise(strm.str());
ostringstream strm;
strm << "Not a light: " << mode_def._light;
nassert_raise(strm.str());
#endif
mode_def._light = NodePath();
}
mode_def._light = NodePath();
}
}
_light_vectors.insert(stage);
_geom_rendering |= Geom::GR_texcoord_light_vector;
_num_light_vectors++;

View File

@ -560,7 +560,7 @@ compose_impl(const RenderAttrib *other) const {
if ((*ai).first < (*ci)) {
// Here is a stage that we have in the original, which is not
// present in the secondary.
new_attrib->_on_textures.insert(new_attrib->_on_textures.end(), *ai);
new_attrib->_on_textures.insert(new_attrib->_on_textures.end(), *ai);
new_attrib->_on_stages.push_back((*ai).first);
++ai;

View File

@ -469,8 +469,8 @@ set_scale(const LVecBase3f &scale) const {
// Don't inflate from 2-d to 3-d just because we got a uniform
// scale.
return make_pos_rotate_scale_shear2d(get_pos2d(), get_rotate2d(),
LVecBase2f(scale[0], scale[0]),
get_shear2d());
LVecBase2f(scale[0], scale[0]),
get_shear2d());
}
// nassertr(has_components(), this);

View File

@ -160,7 +160,7 @@ xform(const LMatrix4f &mat) {
////////////////////////////////////////////////////////////////////
NodePath PGFrameStyle::
generate_into(const NodePath &parent, const LVecBase4f &frame,
int sort) {
int sort) {
PT(PandaNode) new_node;
LPoint2f center((frame[0] + frame[1]) / 2.0f,

View File

@ -76,7 +76,7 @@ PUBLISHED:
public:
bool xform(const LMatrix4f &mat);
NodePath generate_into(const NodePath &parent, const LVecBase4f &frame,
int sort = 0);
int sort = 0);
private:
PT(PandaNode) generate_flat_geom(const LVecBase4f &frame);

View File

@ -162,7 +162,7 @@ read(const Filename &filename, PNMFileType *type, bool report_unknown_type) {
clear();
PNMReader *reader = PNMImageHeader::make_reader(filename, type,
report_unknown_type);
report_unknown_type);
if (reader == (PNMReader *)NULL) {
return false;
}

View File

@ -88,10 +88,10 @@ PUBLISHED:
void alpha_fill_val(xelval alpha = 0);
bool read(const Filename &filename, PNMFileType *type = NULL,
bool report_unknown_type = true);
bool report_unknown_type = true);
bool read(istream &data, const string &filename = string(),
PNMFileType *type = NULL,
bool report_unknown_type = true);
bool report_unknown_type = true);
bool read(PNMReader *reader);
bool write(const Filename &filename, PNMFileType *type = NULL) const;

View File

@ -59,7 +59,7 @@ read_header(const Filename &filename, PNMFileType *type) {
////////////////////////////////////////////////////////////////////
PNMReader *PNMImageHeader::
make_reader(const Filename &filename, PNMFileType *type,
bool report_unknown_type) const {
bool report_unknown_type) const {
if (pnmimage_cat.is_debug()) {
pnmimage_cat.debug()
<< "Reading image from " << filename << "\n";
@ -90,7 +90,7 @@ make_reader(const Filename &filename, PNMFileType *type,
}
return make_reader(file, owns_file, filename, string(), type,
report_unknown_type);
report_unknown_type);
}
@ -126,7 +126,7 @@ make_reader(const Filename &filename, PNMFileType *type,
PNMReader *PNMImageHeader::
make_reader(istream *file, bool owns_file, const Filename &filename,
string magic_number, PNMFileType *type,
bool report_unknown_type) const {
bool report_unknown_type) const {
if (type == (PNMFileType *)NULL) {
if (!read_magic_number(file, magic_number, 2)) {
// No magic number. No image.

View File

@ -80,12 +80,12 @@ PUBLISHED:
PNMReader *make_reader(const Filename &filename,
PNMFileType *type = NULL,
bool report_unknown_type = true) const;
bool report_unknown_type = true) const;
PNMReader *make_reader(istream *file, bool owns_file = true,
const Filename &filename = Filename(),
string magic_number = string(),
PNMFileType *type = NULL,
bool report_unknown_type = true) const;
bool report_unknown_type = true) const;
PNMWriter *make_writer(const Filename &filename,
PNMFileType *type = NULL) const;

View File

@ -55,16 +55,16 @@ extern "C" {
/* Expanded data source object for stdio input */
typedef struct {
struct jpeg_source_mgr pub; /* public fields */
struct jpeg_source_mgr pub; /* public fields */
istream * infile; /* source stream */
JOCTET * buffer; /* start of buffer */
boolean start_of_file; /* have we gotten any data yet? */
istream * infile; /* source stream */
JOCTET * buffer; /* start of buffer */
boolean start_of_file; /* have we gotten any data yet? */
} my_source_mgr;
typedef my_source_mgr * my_src_ptr;
#define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */
#define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */
/*
@ -128,7 +128,7 @@ fill_input_buffer (j_decompress_ptr cinfo)
nbytes = src->infile->gcount();
if (nbytes <= 0) {
if (src->start_of_file) /* Treat empty input file as fatal error */
if (src->start_of_file) /* Treat empty input file as fatal error */
ERREXIT(cinfo, JERR_INPUT_EMPTY);
WARNMS(cinfo, JWRN_JPEG_EOF);
/* Insert a fake EOI marker */
@ -223,14 +223,14 @@ jpeg_istream_src (j_decompress_ptr cinfo, istream * infile)
* This makes it unsafe to use this manager and a different source
* manager serially with the same JPEG object. Caveat programmer.
*/
if (cinfo->src == NULL) { /* first time for this JPEG object? */
if (cinfo->src == NULL) { /* first time for this JPEG object? */
cinfo->src = (struct jpeg_source_mgr *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
sizeof(my_source_mgr));
sizeof(my_source_mgr));
src = (my_src_ptr) cinfo->src;
src->buffer = (JOCTET *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
INPUT_BUF_SIZE * sizeof(JOCTET));
INPUT_BUF_SIZE * sizeof(JOCTET));
}
src = (my_src_ptr) cinfo->src;

View File

@ -60,13 +60,13 @@ extern "C" {
typedef struct {
struct jpeg_destination_mgr pub; /* public fields */
ostream * outfile; /* target stream */
JOCTET * buffer; /* start of buffer */
ostream * outfile; /* target stream */
JOCTET * buffer; /* start of buffer */
} my_destination_mgr;
typedef my_destination_mgr * my_dest_ptr;
#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */
#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */
/*
@ -82,7 +82,7 @@ init_destination (j_compress_ptr cinfo)
/* Allocate the output buffer --- it will be released when done with image */
dest->buffer = (JOCTET *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
OUTPUT_BUF_SIZE * sizeof(JOCTET));
OUTPUT_BUF_SIZE * sizeof(JOCTET));
dest->pub.next_output_byte = dest->buffer;
dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
@ -171,10 +171,10 @@ jpeg_ostream_dest (j_compress_ptr cinfo, ostream * outfile)
* manager serially with the same JPEG object, because their private object
* sizes may be different. Caveat programmer.
*/
if (cinfo->dest == NULL) { /* first time for this JPEG object? */
if (cinfo->dest == NULL) { /* first time for this JPEG object? */
cinfo->dest = (struct jpeg_destination_mgr *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
sizeof(my_destination_mgr));
sizeof(my_destination_mgr));
}
dest = (my_dest_ptr) cinfo->dest;

View File

@ -391,9 +391,9 @@ get_full_fframe() const {
nassertr(_play_frames >= 0.0, 0.0);
double f = cmod(get_f(), _play_frames * 2.0);
if (f > _play_frames) {
return (_play_frames * 2.0 - f) + _start_frame;
return (_play_frames * 2.0 - f) + _start_frame;
} else {
return f + _start_frame;
return f + _start_frame;
}
}
}

View File

@ -1032,19 +1032,19 @@ resolve_object_pointers(TypedWritable *object, const vector_int &pointer_ids) {
// See if we have the pointer available now.
CreatedObjs::const_iterator oi = _created_objs.find(child_id);
if (oi == _created_objs.end()) {
// No, too bad.
is_complete = false;
// No, too bad.
is_complete = false;
} else {
const CreatedObj &child_obj = (*oi).second;
if (child_obj._change_this != NULL) {
// It's been created, but the pointer might still change.
is_complete = false;
} else {
// Yes, it's ready.
references.push_back(child_obj._ptr);
}
const CreatedObj &child_obj = (*oi).second;
if (child_obj._change_this != NULL) {
// It's been created, but the pointer might still change.
is_complete = false;
} else {
// Yes, it's ready.
references.push_back(child_obj._ptr);
}
}
}
}
@ -1054,8 +1054,8 @@ resolve_object_pointers(TypedWritable *object, const vector_int &pointer_ids) {
int num_completed = object->complete_pointers(&references[0], this);
if (num_completed != (int)references.size()) {
bam_cat.warning()
<< object->get_type() << " completed " << num_completed
<< " of " << references.size() << " pointers.\n";
<< object->get_type() << " completed " << num_completed
<< " of " << references.size() << " pointers.\n";
}
return true;
}
@ -1073,7 +1073,7 @@ resolve_object_pointers(TypedWritable *object, const vector_int &pointer_ids) {
////////////////////////////////////////////////////////////////////
bool BamReader::
resolve_cycler_pointers(PipelineCyclerBase *cycler,
const vector_int &pointer_ids) {
const vector_int &pointer_ids) {
// Now make sure we have all of the pointers this cycler is
// waiting for. If any of the pointers has not yet been read
// in, we can't resolve this cycler--we can't do anything for a
@ -1095,19 +1095,19 @@ resolve_cycler_pointers(PipelineCyclerBase *cycler,
// See if we have the pointer available now.
CreatedObjs::const_iterator oi = _created_objs.find(child_id);
if (oi == _created_objs.end()) {
// No, too bad.
is_complete = false;
// No, too bad.
is_complete = false;
} else {
const CreatedObj &child_obj = (*oi).second;
if (child_obj._change_this != NULL) {
// It's been created, but the pointer might still change.
is_complete = false;
} else {
// Yes, it's ready.
references.push_back(child_obj._ptr);
}
const CreatedObj &child_obj = (*oi).second;
if (child_obj._change_this != NULL) {
// It's been created, but the pointer might still change.
is_complete = false;
} else {
// Yes, it's ready.
references.push_back(child_obj._ptr);
}
}
}
}
@ -1119,8 +1119,8 @@ resolve_cycler_pointers(PipelineCyclerBase *cycler,
cycler->release_write(cdata);
if (num_completed != (int)references.size()) {
bam_cat.warning()
<< "CycleData object completed " << num_completed
<< " of " << references.size() << " pointers.\n";
<< "CycleData object completed " << num_completed
<< " of " << references.size() << " pointers.\n";
}
return true;
}

View File

@ -10,37 +10,37 @@ using namespace std;
int _tmain(int argc, _TCHAR* argv[]) {
cout <<"UniqueIdAllocator Test"<<endl;
UniqueIdAllocator b=UniqueIdAllocator(2, 9);
b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.free(2); b.output(cout, true);
b.free(3); b.output(cout, true);
b.free(4); b.output(cout, true);
b.free(5); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.free(3); b.output(cout, true);
b.free(2); b.output(cout, true);
cout <<"UniqueIdAllocator Test"<<endl;
UniqueIdAllocator b=UniqueIdAllocator(2, 9);
b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.free(2); b.output(cout, true);
b.free(3); b.output(cout, true);
b.free(4); b.output(cout, true);
b.free(5); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.free(3); b.output(cout, true);
b.free(2); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.free(4); b.output(cout, true);
b.free(3); b.output(cout, true);
b.free(4); b.output(cout, true);
b.free(3); b.output(cout, true);
b.allocate(); b.output(cout, true);
b.allocate(); b.output(cout, true);
return 0;
return 0;
}

View File

@ -327,13 +327,13 @@ main(int argc, char *argv[]) {
window->load_models(framework.get_models(), argc, argv);
if (delete_models) {
for (int i = 1; i < argc && argv[i] != (char *)NULL; i++) {
Filename model = Filename::from_os_specific(argv[i]);
if (model.exists()) {
nout << "Deleting " << model << "\n";
model.unlink();
}
}
for (int i = 1; i < argc && argv[i] != (char *)NULL; i++) {
Filename model = Filename::from_os_specific(argv[i]);
if (model.exists()) {
nout << "Deleting " << model << "\n";
model.unlink();
}
}
}
}
window->loop_animations(hierarchy_match_flags);

View File

@ -41,82 +41,82 @@ ConfigureFn(config_text) {
ConfigVariableBool text_flatten
("text-flatten", true,
PRC_DESC("Set this true to flatten text when it is generated, or false to "
"keep it as a deep hierarchy. Unless you are debugging the text "
"interface, it is almost always a good idea to leave this at "
"its default, true."));
"keep it as a deep hierarchy. Unless you are debugging the text "
"interface, it is almost always a good idea to leave this at "
"its default, true."));
ConfigVariableInt text_anisotropic_degree
("text-anisotropic-degree", 1,
PRC_DESC("This is the default anisotropic-degree that is set on dynamic "
"font textures. Setting this to a value greater than 1 can help "
"smooth out the antialiasing for small letters."));
"font textures. Setting this to a value greater than 1 can help "
"smooth out the antialiasing for small letters."));
ConfigVariableInt text_texture_margin
("text-texture-margin", 2,
PRC_DESC("This is the number of texels of empty space reserved around each "
"glyph in the texture. Setting this value larger will decrease "
"the tendency for adjacent glyphs to bleed into each other at "
"small sizes, but it will increase amount of wasted texture "
"memory."));
"glyph in the texture. Setting this value larger will decrease "
"the tendency for adjacent glyphs to bleed into each other at "
"small sizes, but it will increase amount of wasted texture "
"memory."));
ConfigVariableDouble text_poly_margin
("text-poly-margin", 0.0f,
PRC_DESC("This is the amount by which to make each glyph polygon larger "
"than strictly necessary, in screen units that are added to each "
"margin. Increasing this value will decrease the tendency for "
"letters to get chopped off at the edges, but it will also "
"increase the tendency for adjacent glyphs to bleed into each "
"other (unless you also increase text-texture-margin)."));
"than strictly necessary, in screen units that are added to each "
"margin. Increasing this value will decrease the tendency for "
"letters to get chopped off at the edges, but it will also "
"increase the tendency for adjacent glyphs to bleed into each "
"other (unless you also increase text-texture-margin)."));
ConfigVariableInt text_page_size
("text-page-size", "256 256",
PRC_DESC("This is the default size for new textures created for dynamic "
"fonts."));
"fonts."));
ConfigVariableBool text_small_caps
("text-small-caps", false,
PRC_DESC("This controls the default setting for "
"TextNode::set_small_caps()."));
"TextNode::set_small_caps()."));
ConfigVariableDouble text_small_caps_scale
("text-small-caps-scale", 0.8f,
PRC_DESC("This controls the default setting for "
"TextNode::set_small_caps_scale()."));
"TextNode::set_small_caps_scale()."));
ConfigVariableFilename text_default_font
("text-default-font", "",
PRC_DESC("This names a filename that will be loaded at startup time as "
"the default font for any TextNode that does not specify a font "
"otherwise. The default is to use a special font that is "
"compiled into Panda, if available."));
"the default font for any TextNode that does not specify a font "
"otherwise. The default is to use a special font that is "
"compiled into Panda, if available."));
ConfigVariableDouble text_tab_width
("text-tab-width", 5.0f,
PRC_DESC("This controls the default setting for "
"TextNode::set_tab_width()."));
"TextNode::set_tab_width()."));
ConfigVariableInt text_push_properties_key
("text-push-properties-key", 1,
PRC_DESC("This is the decimal character number that, embedded in "
"a string, is used to bracket the name of a TextProperties "
"structure added to the TextPropertiesManager object, to "
"control the appearance of subsequent text."));
"a string, is used to bracket the name of a TextProperties "
"structure added to the TextPropertiesManager object, to "
"control the appearance of subsequent text."));
ConfigVariableInt text_pop_properties_key
("text-pop-properties-key", 2,
PRC_DESC("This is the decimal character number that undoes the "
"effect of a previous appearance of text_push_properties_key."));
"effect of a previous appearance of text_push_properties_key."));
ConfigVariableInt text_soft_hyphen_key
("text-soft-hyphen-key", 3,
PRC_DESC("This is the decimal character number that, embedded in a "
"string, is identified as the soft-hyphen character."));
"string, is identified as the soft-hyphen character."));
ConfigVariableInt text_soft_break_key
("text-soft-break-key", 4,
PRC_DESC("This is similar to text-soft-hyphen-key, except that "
"when it is used as a break point, no character is "
"introduced in its place."));
"when it is used as a break point, no character is "
"introduced in its place."));
wstring
get_text_soft_hyphen_output() {
@ -124,8 +124,8 @@ get_text_soft_hyphen_output() {
static ConfigVariableString
cv("text-soft-hyphen-output", "-",
PRC_DESC("This is the string that is output, encoded in the default "
"encoding, to represent the hyphen character that is "
"introduced when the line is broken at a soft-hyphen key."));
"encoding, to represent the hyphen character that is "
"introduced when the line is broken at a soft-hyphen key."));
if (text_soft_hyphen_output == NULL) {
TextEncoder encoder;
@ -138,8 +138,8 @@ get_text_soft_hyphen_output() {
ConfigVariableDouble text_hyphen_ratio
("text-hyphen-ratio", 0.7,
PRC_DESC("If the rightmost whitespace character falls before this "
"fraction of the line, hyphenate a word to the right of that "
"if possible."));
"fraction of the line, hyphenate a word to the right of that "
"if possible."));
wstring
get_text_never_break_before() {
@ -147,9 +147,9 @@ get_text_never_break_before() {
static ConfigVariableString
cv("text-never-break-before", ",.-:?!;",
PRC_DESC("This string represents a list of individual characters "
"that should never appear at the beginning of a line "
"following a forced break. Typically these will be "
"punctuation characters."));
"that should never appear at the beginning of a line "
"following a forced break. Typically these will be "
"punctuation characters."));
if (text_never_break_before == NULL) {
TextEncoder encoder;
@ -162,8 +162,8 @@ get_text_never_break_before() {
ConfigVariableInt text_max_never_break
("text-max-never-break", 3,
PRC_DESC("If we have more than this number of text-never-break-before "
"characters in a row, do not treat any of them as special and "
"instead break the line wherever we can."));
"characters in a row, do not treat any of them as special and "
"instead break the line wherever we can."));
ConfigVariableEnum<Texture::FilterType> text_minfilter
("text-minfilter", Texture::FT_linear_mipmap_linear,

View File

@ -37,8 +37,8 @@ class DynamicTextPage;
class EXPCL_PANDA DynamicTextGlyph : public TextGlyph {
public:
INLINE DynamicTextGlyph(int character, DynamicTextPage *page,
int x, int y, int x_size, int y_size,
int margin);
int x, int y, int x_size, int y_size,
int margin);
INLINE DynamicTextGlyph(int character, float advance);
private:
INLINE DynamicTextGlyph(const DynamicTextGlyph &copy);

View File

@ -76,7 +76,7 @@ slot_glyph(int character, int x_size, int y_size, int margin) {
// The glyph can be fit at (x, y). Slot it.
PT(DynamicTextGlyph) glyph =
new DynamicTextGlyph(character, this,
x, y, x_size, y_size, margin);
x, y, x_size, y_size, margin);
_glyphs.push_back(glyph);
return glyph;
}

View File

@ -42,7 +42,7 @@ public:
DynamicTextPage(DynamicTextFont *font, int page_number);
DynamicTextGlyph *slot_glyph(int character,
int x_size, int y_size, int margin);
int x_size, int y_size, int margin);
INLINE int get_x_size() const;
INLINE int get_y_size() const;

View File

@ -205,7 +205,7 @@ register_with_read_factory() {
TypedWritable* GeomTextGlyph::
make_GeomTextGlyph(const FactoryParams &params) {
GeomTextGlyph *me = new GeomTextGlyph((DynamicTextGlyph *)NULL,
(GeomVertexData *)NULL);
(GeomVertexData *)NULL);
DatagramIterator scan;
BamReader *manager;

View File

@ -38,7 +38,7 @@
class EXPCL_PANDA GeomTextGlyph : public Geom {
public:
GeomTextGlyph(DynamicTextGlyph *glyph,
const GeomVertexData *data);
const GeomVertexData *data);
GeomTextGlyph(const GeomTextGlyph &copy);
void operator = (const GeomTextGlyph &copy);
virtual ~GeomTextGlyph();

View File

@ -37,7 +37,7 @@ TextGlyph(int character) :
////////////////////////////////////////////////////////////////////
INLINE TextGlyph::
TextGlyph(int character, const Geom *geom,
const RenderState *state, float advance) :
const RenderState *state, float advance) :
_character(character),
_geom(geom),
_state(state),

View File

@ -36,7 +36,7 @@ class EXPCL_PANDA TextGlyph : public ReferenceCount {
public:
INLINE TextGlyph(int character);
INLINE TextGlyph(int character, const Geom *geom,
const RenderState *state, float advance);
const RenderState *state, float advance);
INLINE TextGlyph(const TextGlyph &copy);
INLINE void operator = (const TextGlyph &copy);
virtual ~TextGlyph();

View File

@ -398,7 +398,7 @@ do_transmit_data(const DataNodeTransmit &input, DataNodeTransmit &output) {
if (!_throw_buttons_active || has_throw_button(_mods, be._button)) {
// Process this button.
do_specific_event(event_name, be._time);
do_general_event(be, event_name);
do_general_event(be, event_name);
} else {
// Don't process this button; instead, pass it down to future
@ -422,7 +422,7 @@ do_transmit_data(const DataNodeTransmit &input, DataNodeTransmit &output) {
// of the modifier keys.
if (!_throw_buttons_active || has_throw_button(be._button)) {
do_specific_event(event_name + "-up", be._time);
do_general_event(be, event_name);
do_general_event(be, event_name);
}
if (_throw_buttons_active) {
// Now pass the event on to future generations. We always
@ -436,7 +436,7 @@ do_transmit_data(const DataNodeTransmit &input, DataNodeTransmit &output) {
// Some other kind of button event (e.g. keypress). Don't
// throw an event for this, but do pass it down.
_button_events->add_event(be);
do_general_event(be, "");
do_general_event(be, "");
}
}
}

View File

@ -87,7 +87,7 @@ public:
private:
void do_specific_event(const string &event_name, double time);
void do_general_event(const ButtonEvent &button_event,
const string &event_name);
const string &event_name);
private:
string _button_down_event;

View File

@ -1040,18 +1040,18 @@ do_transmit_data(const DataNodeTransmit &input, DataNodeTransmit &output) {
float left, right, bottom, top;
_display_region->get_dimensions(left, right, bottom, top);
// Need to translate this into DisplayRegion [0, 1] space
float x = (f[0] + 1.0f) / 2.0f;
// Scale in DR space
float xp = (x - left) / (right - left);
// Translate back into [-1, 1] space
float xpp = (xp * 2.0f) - 1.0f;
// Need to translate this into DisplayRegion [0, 1] space
float x = (f[0] + 1.0f) / 2.0f;
// Scale in DR space
float xp = (x - left) / (right - left);
// Translate back into [-1, 1] space
float xpp = (xp * 2.0f) - 1.0f;
float y = (f[1] + 1.0f) / 2.0f;
float yp = (y - bottom) / (top - bottom);
float ypp = (yp * 2.0f) - 1.0f;
LVecBase2f new_f(xpp, ypp);
float y = (f[1] + 1.0f) / 2.0f;
float yp = (y - bottom) / (top - bottom);
float ypp = (yp * 2.0f) - 1.0f;
LVecBase2f new_f(xpp, ypp);
LVecBase2f new_p(p[0] - xo, p[1] - xo);
set_mouse(new_f, new_p);

View File

@ -547,7 +547,7 @@ fullscreen_restored(WindowProperties &) {
////////////////////////////////////////////////////////////////////
bool WinGraphicsWindow::
do_reshape_request(int x_origin, int y_origin, bool has_origin,
int x_size, int y_size) {
int x_size, int y_size) {
if (windisplay_cat.is_debug()) {
windisplay_cat.debug()
<< "Got reshape request (" << x_origin << ", " << y_origin
@ -820,7 +820,7 @@ open_regular_window() {
RECT win_rect;
SetRect(&win_rect, x_origin, y_origin,
x_origin + x_size, y_origin + y_size);
x_origin + x_size, y_origin + y_size);
// compute window size based on desired client area size
if (!AdjustWindowRect(&win_rect, window_style, FALSE)) {
@ -2372,7 +2372,7 @@ ClearToBlack(HWND hWnd, const WindowProperties &props) {
if (!props.has_origin()) {
if (windisplay_cat.is_debug()) {
windisplay_cat.debug()
<< "Skipping ClearToBlack, no origin specified yet.\n";
<< "Skipping ClearToBlack, no origin specified yet.\n";
}
return;
}

View File

@ -164,8 +164,8 @@ post_command_line() {
if (!_name_font_filename.empty()) {
_name_text_maker = new PNMTextMaker(_name_font_filename, 0);
if (!_name_text_maker->is_valid()) {
delete _name_text_maker;
_name_text_maker = (PNMTextMaker *)NULL;
delete _name_text_maker;
_name_text_maker = (PNMTextMaker *)NULL;
}
}
@ -173,9 +173,9 @@ post_command_line() {
_name_text_maker = new PNMTextMaker((const char *)default_font,
default_font_size, 0);
if (!_name_text_maker->is_valid()) {
nout << "Unable to open default font.\n";
delete _name_text_maker;
_name_text_maker = (PNMTextMaker *)NULL;
nout << "Unable to open default font.\n";
delete _name_text_maker;
_name_text_maker = (PNMTextMaker *)NULL;
}
}
}
@ -215,11 +215,11 @@ run() {
if (y > _image_height - vert_per_font) {
// Write out the current image.
snprintf(output_filename, output_filename_size,
_output_filename.c_str(), output_index);
_output_filename.c_str(), output_index);
nout << "Writing " << output_filename << "\n";
if (!output_image.write(output_filename)) {
nout << "Unable to write to " << output_filename << "\n";
exit(1);
nout << "Unable to write to " << output_filename << "\n";
exit(1);
}
output_index++;
output_image.fill(1, 1, 1);
@ -233,11 +233,11 @@ run() {
text_maker->set_scale_factor(_font_aa_factor);
text_maker->set_pixel_size(_sample_height);
text_maker->generate_into(_sample_text, output_image,
16, y + _sample_height);
16, y + _sample_height);
if (_name_text_maker != (PNMTextMaker *)NULL) {
string desc = filename.get_basename() + ": " + text_maker->get_name();
_name_text_maker->generate_into(desc, output_image,
16, y + _sample_height + _name_height);
string desc = filename.get_basename() + ": " + text_maker->get_name();
_name_text_maker->generate_into(desc, output_image,
16, y + _sample_height + _name_height);
}
}
@ -246,7 +246,7 @@ run() {
}
snprintf(output_filename, output_filename_size,
_output_filename.c_str(), output_index);
_output_filename.c_str(), output_index);
nout << "Writing " << output_filename << "\n";
if (!output_image.write(output_filename)) {
nout << "Unable to write to " << output_filename << "\n";

View File

@ -298,7 +298,7 @@ make_reduced_image(Photo *photo, PNMImage &reduced_image,
// anyway when force_reduced is true.
photo_filename.set_binary();
if (!copy_file(photo_filename, reduced_dir)) {
return false;
return false;
}
} else {
@ -328,8 +328,8 @@ make_reduced_image(Photo *photo, PNMImage &reduced_image,
// We still read the image header to determine its size.
PNMImageHeader photo_image;
if (!photo_image.read_header(photo_filename)) {
nout << "Unable to read " << photo_filename << "\n";
return false;
nout << "Unable to read " << photo_filename << "\n";
return false;
}
photo->_full_x_size = photo_image.get_x_size();
@ -337,35 +337,35 @@ make_reduced_image(Photo *photo, PNMImage &reduced_image,
photo->_has_reduced = true;
if (dummy_mode) {
// In dummy mode, we may or may not actually have a reduced
// image. In either case, ignore the file and compute its
// appropriate size from the source image.
compute_reduction(photo_image, reduced_image, reduced_width, reduced_height);
photo->_reduced_x_size = reduced_image.get_x_size();
photo->_reduced_y_size = reduced_image.get_y_size();
// In dummy mode, we may or may not actually have a reduced
// image. In either case, ignore the file and compute its
// appropriate size from the source image.
compute_reduction(photo_image, reduced_image, reduced_width, reduced_height);
photo->_reduced_x_size = reduced_image.get_x_size();
photo->_reduced_y_size = reduced_image.get_y_size();
} else if (generate_index_image) {
// Now read the reduced image from disk, so we can put it on
// the index image.
nout << "Reading " << reduced_filename << "\n";
if (!reduced_image.read(reduced_filename)) {
nout << "Unable to read.\n";
return false;
}
photo->_reduced_x_size = reduced_image.get_x_size();
photo->_reduced_y_size = reduced_image.get_y_size();
// Now read the reduced image from disk, so we can put it on
// the index image.
nout << "Reading " << reduced_filename << "\n";
if (!reduced_image.read(reduced_filename)) {
nout << "Unable to read.\n";
return false;
}
photo->_reduced_x_size = reduced_image.get_x_size();
photo->_reduced_y_size = reduced_image.get_y_size();
} else {
// If we're not generating an index image, we don't even need
// the reduced image--just scan its header to get its size.
if (!reduced_image.read_header(reduced_filename)) {
nout << "Unable to read " << reduced_filename << "\n";
return false;
}
photo->_reduced_x_size = reduced_image.get_x_size();
photo->_reduced_y_size = reduced_image.get_y_size();
// If we're not generating an index image, we don't even need
// the reduced image--just scan its header to get its size.
if (!reduced_image.read_header(reduced_filename)) {
nout << "Unable to read " << reduced_filename << "\n";
return false;
}
photo->_reduced_x_size = reduced_image.get_x_size();
photo->_reduced_y_size = reduced_image.get_y_size();
}
}
}

View File

@ -67,10 +67,10 @@ private:
static void draw_box(PNMImage &image);
static void draw_frame(PNMImage &image,
int frame_left, int frame_top,
int frame_width, int frame_height,
int hole_left, int hole_top,
int hole_width, int hole_height);
int frame_left, int frame_top,
int frame_width, int frame_height,
int hole_left, int hole_top,
int hole_width, int hole_height);
private:
RollDirectory *_dir;

View File

@ -238,10 +238,10 @@ escape_html(const string &input) {
bool found_match = false;
for (int i = 0; !found_match && tokens[i].name != NULL; i++) {
if (code == tokens[i].code) {
result += '&';
result += tokens[i].name;
result += ';';
found_match = true;
result += '&';
result += tokens[i].name;
result += ';';
found_match = true;
}
}

View File

@ -144,7 +144,7 @@ extern int thumb_interior_width;
extern int thumb_interior_height;
Filename compose_href(const Filename &rel_dir, const Filename &user_prefix,
const Filename &basename = Filename());
const Filename &basename = Filename());
string escape_html(const string &input);
bool copy_file(const Filename &source_file, const Filename &dest_dir);

View File

@ -323,12 +323,12 @@ handle_args(ProgramBase::Args &args) {
if (filename.is_directory()) {
string basename = filename.get_basename();
if (basename == "icons" || basename == "html" ||
basename == "reduced" || basename == "thumbs") {
nout << "Ignoring " << filename << "; indexify-generated directory.\n";
basename == "reduced" || basename == "thumbs") {
nout << "Ignoring " << filename << "; indexify-generated directory.\n";
} else {
RollDirectory *roll_dir = new RollDirectory(filename);
_roll_dirs.push_back(roll_dir);
RollDirectory *roll_dir = new RollDirectory(filename);
_roll_dirs.push_back(roll_dir);
}
} else if (filename.exists()) {
@ -417,8 +417,8 @@ post_command_line() {
if (!_font_filename.empty()) {
_text_maker = new PNMTextMaker(_font_filename, 0);
if (!_text_maker->is_valid()) {
delete _text_maker;
_text_maker = (PNMTextMaker *)NULL;
delete _text_maker;
_text_maker = (PNMTextMaker *)NULL;
}
}
@ -426,9 +426,9 @@ post_command_line() {
_text_maker = new PNMTextMaker((const char *)default_font,
default_font_size, 0);
if (!_text_maker->is_valid()) {
nout << "Unable to open default font.\n";
delete _text_maker;
_text_maker = (PNMTextMaker *)NULL;
nout << "Unable to open default font.\n";
delete _text_maker;
_text_maker = (PNMTextMaker *)NULL;
}
}
@ -445,80 +445,80 @@ post_command_line() {
Filename icon_filename(archive_dir, prev_icon);
if (force_regenerate || !icon_filename.exists()) {
nout << "Generating " << icon_filename << "\n";
icon_filename.make_dir();
icon_filename.set_binary();
nout << "Generating " << icon_filename << "\n";
icon_filename.make_dir();
icon_filename.set_binary();
ofstream output;
if (!icon_filename.open_write(output)) {
nout << "Unable to write to " << icon_filename << "\n";
exit(1);
}
output.write((const char *)default_left_icon, default_left_icon_len);
ofstream output;
if (!icon_filename.open_write(output)) {
nout << "Unable to write to " << icon_filename << "\n";
exit(1);
}
output.write((const char *)default_left_icon, default_left_icon_len);
}
}
if (next_icon.empty()) {
next_icon = Filename("icons", default_right_icon_filename);
Filename icon_filename(archive_dir, next_icon);
if (force_regenerate || !icon_filename.exists()) {
nout << "Generating " << icon_filename << "\n";
icon_filename.make_dir();
icon_filename.set_binary();
ofstream output;
if (!icon_filename.open_write(output)) {
nout << "Unable to write to " << icon_filename << "\n";
exit(1);
}
output.write((const char *)default_right_icon, default_right_icon_len);
nout << "Generating " << icon_filename << "\n";
icon_filename.make_dir();
icon_filename.set_binary();
ofstream output;
if (!icon_filename.open_write(output)) {
nout << "Unable to write to " << icon_filename << "\n";
exit(1);
}
output.write((const char *)default_right_icon, default_right_icon_len);
}
}
if (up_icon.empty()) {
up_icon = Filename("icons", default_up_icon_filename);
Filename icon_filename(archive_dir, up_icon);
if (force_regenerate || !icon_filename.exists()) {
nout << "Generating " << icon_filename << "\n";
icon_filename.make_dir();
icon_filename.set_binary();
nout << "Generating " << icon_filename << "\n";
icon_filename.make_dir();
icon_filename.set_binary();
ofstream output;
if (!icon_filename.open_write(output)) {
nout << "Unable to write to " << icon_filename << "\n";
exit(1);
}
output.write((const char *)default_up_icon, default_up_icon_len);
ofstream output;
if (!icon_filename.open_write(output)) {
nout << "Unable to write to " << icon_filename << "\n";
exit(1);
}
output.write((const char *)default_up_icon, default_up_icon_len);
}
}
if (movie_icon.empty()) {
movie_icon = Filename("icons", default_movie_icon_filename);
Filename icon_filename(archive_dir, movie_icon);
if (force_regenerate || !icon_filename.exists()) {
nout << "Generating " << icon_filename << "\n";
icon_filename.make_dir();
icon_filename.set_binary();
nout << "Generating " << icon_filename << "\n";
icon_filename.make_dir();
icon_filename.set_binary();
ofstream output;
if (!icon_filename.open_write(output)) {
nout << "Unable to write to " << icon_filename << "\n";
exit(1);
}
output.write((const char *)default_movie_icon, default_movie_icon_len);
ofstream output;
if (!icon_filename.open_write(output)) {
nout << "Unable to write to " << icon_filename << "\n";
exit(1);
}
output.write((const char *)default_movie_icon, default_movie_icon_len);
}
}
if (sound_icon.empty()) {
sound_icon = Filename("icons", default_sound_icon_filename);
Filename icon_filename(archive_dir, sound_icon);
if (force_regenerate || !icon_filename.exists()) {
nout << "Generating " << icon_filename << "\n";
icon_filename.make_dir();
icon_filename.set_binary();
nout << "Generating " << icon_filename << "\n";
icon_filename.make_dir();
icon_filename.set_binary();
ofstream output;
if (!icon_filename.open_write(output)) {
nout << "Unable to write to " << icon_filename << "\n";
exit(1);
}
output.write((const char *)default_sound_icon, default_sound_icon_len);
ofstream output;
if (!icon_filename.open_write(output)) {
nout << "Unable to write to " << icon_filename << "\n";
exit(1);
}
output.write((const char *)default_sound_icon, default_sound_icon_len);
}
}
}
@ -694,10 +694,10 @@ do_generate_images() {
RollDirectory *roll_dir = (*di);
if (!roll_dir->is_empty()) {
index_html
<< "<a name=\"" << roll_dir->get_basename() << "\">\n"
<< "<li><a href=\"html/" << roll_dir->get_basename() << ".htm\">"
<< roll_dir->get_name() << " " << escape_html(roll_dir->get_desc())
<< "</a></li>\n";
<< "<a name=\"" << roll_dir->get_basename() << "\">\n"
<< "<li><a href=\"html/" << roll_dir->get_basename() << ".htm\">"
<< roll_dir->get_name() << " " << escape_html(roll_dir->get_desc())
<< "</a></li>\n";
}
}

View File

@ -42,7 +42,7 @@ Photo(RollDirectory *dir, const Filename &basename,
if (_frame_number.substr(0, dirname.length()) == dirname) {
_frame_number = _frame_number.substr(dirname.length());
while (_frame_number.length() > 1 && _frame_number[0] == '0') {
_frame_number = _frame_number.substr(1);
_frame_number = _frame_number.substr(1);
}
}
}

View File

@ -148,18 +148,18 @@ scan(const string &photo_extension, const string &movie_extension,
string word;
ds >> word;
while (!ds.eof() && !ds.fail()) {
if (!_desc.empty()) {
_desc += ' ';
}
_desc += word;
word = string();
ds >> word;
if (!_desc.empty()) {
_desc += ' ';
}
_desc += word;
word = string();
ds >> word;
}
if (!word.empty()) {
if (!_desc.empty()) {
_desc += ' ';
}
_desc += word;
if (!_desc.empty()) {
_desc += ' ';
}
_desc += word;
}
}
}
@ -180,33 +180,33 @@ scan(const string &photo_extension, const string &movie_extension,
string word;
ls >> word;
while (!ls.eof() && !ls.fail()) {
any_words = true;
Filename try_filename(_dir, word);
if (!try_filename.exists()) {
try_filename = Filename(_dir, word + "." + photo_extension);
}
if (!try_filename.exists()) {
try_filename = Filename(_dir, _basename + word + "." + photo_extension);
}
if (!try_filename.exists()) {
try_filename = Filename(_dir, _basename + "0" + word + "." + photo_extension);
}
if (try_filename.exists()) {
any_words = true;
Filename try_filename(_dir, word);
if (!try_filename.exists()) {
try_filename = Filename(_dir, word + "." + photo_extension);
}
if (!try_filename.exists()) {
try_filename = Filename(_dir, _basename + word + "." + photo_extension);
}
if (!try_filename.exists()) {
try_filename = Filename(_dir, _basename + "0" + word + "." + photo_extension);
}
if (try_filename.exists()) {
add_photo(try_filename.get_basename(), movie_extension,
sound_extension);
} else {
nout << "Frame " << word << " not found in " << _name << "\n";
}
ls >> word;
sound_extension);
} else {
nout << "Frame " << word << " not found in " << _name << "\n";
}
ls >> word;
}
if (!any_words) {
// An empty .ls file just means reverse the order.
reverse_order = true;
// An empty .ls file just means reverse the order.
reverse_order = true;
} else {
// A non-empty .ls file has listed all the files we need; no
// need to scan the directory.
explicit_list = true;
// A non-empty .ls file has listed all the files we need; no
// need to scan the directory.
explicit_list = true;
}
}
}
@ -445,14 +445,14 @@ generate_html(const Filename &archive_dir, const Filename &roll_dir_root) {
// If the comment file for the roll exists, insert its contents
// here instead of the generic header.
if (!insert_html_comment(comment_strm, cm_filename)) {
return false;
return false;
}
} else {
comment_strm
<< "<h2>" << _name << "</h2>\n";
<< "<h2>" << _name << "</h2>\n";
if (!_desc.empty()) {
comment_strm << "<p>" << escape_html(_desc) << ".</p>\n";
comment_strm << "<p>" << escape_html(_desc) << ".</p>\n";
}
}
}
@ -695,7 +695,7 @@ insert_html_comment(ostream &html, Filename cm_filename) {
////////////////////////////////////////////////////////////////////
void RollDirectory::
add_photo(const Filename &basename, const string &movie_extension,
const string &sound_extension) {
const string &sound_extension) {
Photo *photo = new Photo(this, basename, movie_extension, sound_extension);
_photos.push_back(photo);
}

View File

@ -43,7 +43,7 @@ public:
const string &get_name() const;
const string &get_desc() const;
bool scan(const string &photo_extension, const string &movie_extension,
const string &sound_extension);
const string &sound_extension);
void collect_index_images();
bool sort_date_before(const RollDirectory &other) const;
@ -59,7 +59,7 @@ public:
bool generate_images(const Filename &archive_dir, PNMTextMaker *text_maker);
bool generate_html(const Filename &archive_dir,
const Filename &roll_dir_root);
const Filename &roll_dir_root);
const string &get_comment_html() const;
const string &get_index_html() const;
@ -72,14 +72,14 @@ public:
private:
void add_photo(const Filename &basename, const string &movie_extension,
const string &sound_extension);
const string &sound_extension);
void add_contributing_filename(const Filename &filename);
static bool insert_html_comment_body(ostream &html, istream &cm);
static string format_basename(const string &basename);
void generate_nav_buttons(ostream &html,
const Filename &prev_roll_filename,
const Filename &next_roll_filename,
const string &up_href);
const Filename &prev_roll_filename,
const Filename &next_roll_filename,
const string &up_href);
static bool compare_filenames(const string &a, const string &b);
public:

View File

@ -442,7 +442,7 @@ vec3: '(' NUMBER NUMBER NUMBER ')'
;
length_pair:
'(' length ',' length ')'
'(' length ',' length ')'
{
$$.set($2, $4, 0.0, 0.0);
$<num_components>$ = 2;

View File

@ -330,23 +330,23 @@ process(istream &in) {
if (get_group()) {
switch (_state) {
case ST_top:
state_top();
break;
state_top();
break;
case ST_section:
state_section();
break;
state_section();
break;
case ST_entity:
state_entity();
break;
state_entity();
break;
case ST_verts:
state_verts();
break;
state_verts();
break;
default:
break;
break;
}
}
}
@ -460,8 +460,8 @@ find_color(double r, double g, double b) {
for (int i = 0; i < 255; i++) {
double diff = ((r - _colors[i].r) * (r - _colors[i].r) +
(g - _colors[i].g) * (g - _colors[i].g) +
(b - _colors[i].b) * (b - _colors[i].b));
(g - _colors[i].g) * (g - _colors[i].g) +
(b - _colors[i].b) * (b - _colors[i].b));
if (diff < best_diff) {
best_diff = diff;
best_index = i;
@ -546,9 +546,9 @@ compute_ocs() {
// Now build a rotate matrix from these vectors.
LMatrix4d
ocs( x[0], x[1], x[2], 0,
y[0], y[1], y[2], 0,
_z[0], _z[1], _z[2], 0,
0, 0, 0, 1);
y[0], y[1], y[2], 0,
_z[0], _z[1], _z[2], 0,
0, 0, 0, 1);
_ocs2wcs.invert_from(ocs);
}
@ -714,29 +714,29 @@ void DXFFile::
state_top() {
if (_code != 0) {
nout << "Group code 0 not found at top level; found code " << _code
<< " instead.\n";
<< " instead.\n";
change_state(ST_error);
} else {
if (_string == "SECTION") {
if (get_group()) {
if (_code != 2) {
nout << "Group code 0 not immediately followed by code 2; found code "
<< _code << " instead.\n";
} else {
if (_string == "HEADER") {
change_section(SE_header);
} else if (_string == "TABLES") {
change_section(SE_tables);
} else if (_string == "BLOCKS") {
change_section(SE_blocks);
} else if (_string == "ENTITIES") {
change_section(SE_entities);
} else if (_string == "OBJECTS") {
change_section(SE_objects);
} else {
change_section(SE_unknown);
}
}
if (_code != 2) {
nout << "Group code 0 not immediately followed by code 2; found code "
<< _code << " instead.\n";
} else {
if (_string == "HEADER") {
change_section(SE_header);
} else if (_string == "TABLES") {
change_section(SE_tables);
} else if (_string == "BLOCKS") {
change_section(SE_blocks);
} else if (_string == "ENTITIES") {
change_section(SE_entities);
} else if (_string == "OBJECTS") {
change_section(SE_objects);
} else {
change_section(SE_unknown);
}
}
}
} else if (_string == "EOF") {
change_state(ST_done);
@ -765,19 +765,19 @@ state_section() {
change_state(ST_top);
} else {
if (_section == SE_entities) {
if (_string == "3DFACE") {
change_entity(EN_3dface);
} else if (_string == "POINT") {
change_entity(EN_point);
} else if (_string == "INSERT") {
change_entity(EN_insert);
} else if (_string == "VERTEX") {
change_entity(EN_vertex);
} else if (_string == "POLYLINE") {
change_entity(EN_polyline);
} else {
change_entity(EN_unknown);
}
if (_string == "3DFACE") {
change_entity(EN_3dface);
} else if (_string == "POINT") {
change_entity(EN_point);
} else if (_string == "INSERT") {
change_entity(EN_insert);
} else if (_string == "VERTEX") {
change_entity(EN_vertex);
} else if (_string == "POLYLINE") {
change_entity(EN_polyline);
} else {
change_entity(EN_unknown);
}
}
}
break;

View File

@ -33,7 +33,7 @@ static const int DXF_max_line = 256;
static const int DXF_num_colors = 256;
////////////////////////////////////////////////////////////////////
// Class : DXFFile
// Class : DXFFile
// Description : A generic DXF-reading class. This class can read a
// DXF file but doesn't actually do anything with the
// data; it's intended to be inherited from and the

View File

@ -23,7 +23,7 @@
#include "namable.h"
////////////////////////////////////////////////////////////////////
// Class : DXFLayer
// Class : DXFLayer
// Description : This represents a "layer" as read from the DXF file.
// A layer may be defined by reading the header part of
// the file, or it may be implicitly defined by an

View File

@ -26,7 +26,7 @@ class DXFLayer;
class DXFFile;
////////////////////////////////////////////////////////////////////
// Class : DXFLayerMap
// Class : DXFLayerMap
// Description : A map of string (layer name) to DXFLayer: that is,
// the layers of a file ordered by name. This is used
// as a lookup within DXFFile to locate the layer

View File

@ -24,7 +24,7 @@
#include "luse.h"
////////////////////////////////////////////////////////////////////
// Class : DXFVertex
// Class : DXFVertex
// Description : Stored within DXFFile, this is the basic Vertex data
// of a DXF file. When DXFFile::DoneEntity() is called,
// if the entity is a type to have vertices, then

View File

@ -32,7 +32,7 @@ class DXFVertex;
class DXFToEggConverter;
////////////////////////////////////////////////////////////////////
// Class : DXFToEggLayer
// Class : DXFToEggLayer
// Description : The specialization of DXFLayer used by
// DXFToEggConverter. It contains a pointer to an
// EggGroup and a vertex pool; these are used to build

View File

@ -147,9 +147,9 @@ write_polyline(EggPolygon *poly, ostream &out) {
EggVertex *vtx = (*vi);
LVecBase3d pos = vtx->get_pos3() * _group->get_vertex_frame();
out << "0\nVERTEX\n"
<< "10\n" << pos[0] << "\n"
<< "20\n" << pos[1] << "\n"
<< "30\n" << pos[2] << "\n";
<< "10\n" << pos[0] << "\n"
<< "20\n" << pos[1] << "\n"
<< "30\n" << pos[2] << "\n";
}
out << "0\nSEQEND\n";
}
@ -171,14 +171,14 @@ write_3d_face(EggPolygon *poly, ostream &out) {
for (ci = group->begin(); ci != group->end(); ++ci) {
EggNode *child = (*ci);
if (child->is_of_type(EggPolygon::get_class_type())) {
write_3d_face(DCAST(EggPolygon, child), out);
write_3d_face(DCAST(EggPolygon, child), out);
}
}
} else if (poly->size() > 2) {
// Otherwise, if we have a tri or a quad, just write it out.
out << "0\n3DFACE\n"
<< "8\n" << _group->get_name() << "\n";
<< "8\n" << _group->get_name() << "\n";
// Since DXF uses a clockwise ordering convention, we must
// reverse the order in which we write out the vertices.
@ -188,13 +188,13 @@ write_3d_face(EggPolygon *poly, ostream &out) {
EggVertex *vtx = (*vi);
LVecBase3d pos = vtx->get_pos3() * _group->get_vertex_frame();
out << 10 + i << "\n" << pos[0] << "\n"
<< 20 + i << "\n" << pos[1] << "\n"
<< 30 + i << "\n" << pos[2] << "\n";
<< 20 + i << "\n" << pos[1] << "\n"
<< 30 + i << "\n" << pos[2] << "\n";
if (i == 2 && poly->size() == 3) {
// A special case for triangles: repeat the last vertex.
out << 11 + i << "\n" << pos[0] << "\n"
<< 21 + i << "\n" << pos[1] << "\n"
<< 31 + i << "\n" << pos[2] << "\n";
// A special case for triangles: repeat the last vertex.
out << 11 + i << "\n" << pos[0] << "\n"
<< 21 + i << "\n" << pos[1] << "\n"
<< 31 + i << "\n" << pos[2] << "\n";
}
}
}
@ -215,9 +215,9 @@ write_entities(ostream &out) {
if (child->is_of_type(EggPolygon::get_class_type())) {
EggPolygon *poly = DCAST(EggPolygon, child);
if (_egg2dxf->_use_polyline) {
write_polyline(poly, out);
write_polyline(poly, out);
} else {
write_3d_face(poly, out);
write_3d_face(poly, out);
}
}
}

View File

@ -157,7 +157,7 @@ run() {
} else {
nout << _surfaces.size() << " NURBS surfaces found; "
<< default_entry.get_num_surfaces()
<< default_entry.get_num_surfaces()
<< " unaccounted for by input file.\n";
}

View File

@ -63,35 +63,35 @@ get_scores(int subdiv, int across, double ratio,
for (i = -1; i < _maxi; i++) {
double u = (double)(i+1) / (double)(_maxi+1);
if (s) {
surf->eval_point(u, v, pnext);
surf->eval_point(u, v, pnext);
} else {
surf->eval_point(v, u, pnext);
surf->eval_point(v, u, pnext);
}
// We'll ignore consecutive equal points. They don't contribute
// to curvature or size.
if (!pnext.almost_equal(p3)) {
num_points++;
p1 = p2;
p2 = p3;
p3 = pnext;
num_points++;
p1 = p2;
p2 = p3;
p3 = pnext;
v1 = v2;
v2 = p3 - p2;
double vlength = length(v2);
v2 /= vlength;
v1 = v2;
v2 = p3 - p2;
double vlength = length(v2);
v2 /= vlength;
if (i >= 0) {
_sscore[i] += vlength;
}
if (i >= 0) {
_sscore[i] += vlength;
}
if (num_points >= 3) {
// We only have a meaningful v1, v2 when we've read at least
// three non-equal points.
double d = v1.dot(v2);
_cscore[i] += acos(max(min(d, 1.0), -1.0));
}
if (num_points >= 3) {
// We only have a meaningful v1, v2 when we've read at least
// three non-equal points.
double d = v1.dot(v2);
_cscore[i] += acos(max(min(d, 1.0), -1.0));
}
}
}
}
@ -143,8 +143,8 @@ place(int count, pvector<double> &iso_points) {
// well as at least 50% more curvy than the average curvature, to
// qualify as a bend point.
if (_cscore[i] > _cscore[i-1]+0.001 &&
_cscore[i] > _cscore[i+1]+0.001 &&
_cscore[i] > 1.5 * avg_curve) {
_cscore[i] > _cscore[i+1]+0.001 &&
_cscore[i] > 1.5 * avg_curve) {
bpoints.push_back(i);
}
}
@ -161,7 +161,7 @@ place(int count, pvector<double> &iso_points) {
if (bnext != bpoints.end() && (*bnext) - (*bi) < min_separation) {
// Too close. Remove one.
if (_cscore[*bnext] > _cscore[*bi]) {
*bi = *bnext;
*bi = *bnext;
}
bpoints.erase(bnext);
} else {
@ -177,7 +177,7 @@ place(int count, pvector<double> &iso_points) {
BendPoints::iterator mi = bi;
for (++bi; bi != bpoints.end(); ++bi) {
if (_cscore[*bi] < _cscore[*mi]) {
mi = bi;
mi = bi;
}
}
bpoints.erase(mi);

Some files were not shown because too many files have changed in this diff Show More