mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-27 15:25:54 -04:00
cleanup: Fix assorted issues uncovered by clang-tidy
This commit is contained in:
parent
00f68fb8a5
commit
5e26aae1ff
@ -37,7 +37,7 @@ PUBLISHED:
|
|||||||
const DCClass *get_class() const;
|
const DCClass *get_class() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual DCPackerInterface *get_nested_field(int n) const;
|
virtual DCPackerInterface *get_nested_field(int n) const final;
|
||||||
|
|
||||||
virtual void output_instance(std::ostream &out, bool brief, const std::string &prename,
|
virtual void output_instance(std::ostream &out, bool brief, const std::string &prename,
|
||||||
const std::string &name, const std::string &postname) const;
|
const std::string &name, const std::string &postname) const;
|
||||||
|
@ -439,12 +439,7 @@ ns_set_environment_variable(const string &var, const string &value) {
|
|||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
_putenv_s(var.c_str(), value.c_str());
|
_putenv_s(var.c_str(), value.c_str());
|
||||||
#else
|
#else
|
||||||
string putstr = var + "=" + value;
|
setenv(var.c_str(), value.c_str(), 1);
|
||||||
|
|
||||||
// putenv() requires us to malloc a new C-style string.
|
|
||||||
char *put = (char *)malloc(putstr.length() + 1);
|
|
||||||
strcpy(put, putstr.c_str());
|
|
||||||
putenv(put);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,10 +24,13 @@
|
|||||||
|
|
||||||
#ifdef PHAVE_UTIME_H
|
#ifdef PHAVE_UTIME_H
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// We assume we have these too.
|
// We assume we have these too.
|
||||||
|
#ifndef _WIN32
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PHAVE_GLOB_H
|
#ifdef PHAVE_GLOB_H
|
||||||
@ -2317,7 +2320,7 @@ touch() const {
|
|||||||
// time. For these systems, we'll just temporarily open the file in append
|
// time. For these systems, we'll just temporarily open the file in append
|
||||||
// mode, then close it again (it gets closed when the pfstream goes out of
|
// mode, then close it again (it gets closed when the pfstream goes out of
|
||||||
// scope).
|
// scope).
|
||||||
pfstream file;
|
pofstream file;
|
||||||
return open_append(file);
|
return open_append(file);
|
||||||
#endif // _WIN32, PHAVE_UTIME_H
|
#endif // _WIN32, PHAVE_UTIME_H
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
* whose contents can be continuously extracted as a sequence of lines of
|
* whose contents can be continuously extracted as a sequence of lines of
|
||||||
* text.
|
* text.
|
||||||
*/
|
*/
|
||||||
class EXPCL_DTOOL_DTOOLUTIL LineStreamBuf : public std::streambuf {
|
class EXPCL_DTOOL_DTOOLUTIL LineStreamBuf final : public std::streambuf {
|
||||||
public:
|
public:
|
||||||
LineStreamBuf();
|
LineStreamBuf();
|
||||||
virtual ~LineStreamBuf();
|
virtual ~LineStreamBuf();
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
#endif // WIN_PIPE_CALLS
|
#endif // WIN_PIPE_CALLS
|
||||||
|
|
||||||
class EXPCL_DTOOL_DTOOLUTIL PipeStreamBuf : public std::streambuf {
|
class EXPCL_DTOOL_DTOOLUTIL PipeStreamBuf final : public std::streambuf {
|
||||||
public:
|
public:
|
||||||
enum Direction { Input, Output };
|
enum Direction { Input, Output };
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ get_call_str(const string &container, const vector_string &pexprs) const {
|
|||||||
separator = ", ";
|
separator = ", ";
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t pn = _first_true_parameter;
|
size_t pn;
|
||||||
size_t num_parameters = pexprs.size();
|
size_t num_parameters = pexprs.size();
|
||||||
|
|
||||||
for (pn = _first_true_parameter;
|
for (pn = _first_true_parameter;
|
||||||
|
@ -1664,11 +1664,6 @@ write_module_class(ostream &out, Object *obj) {
|
|||||||
std::string cClassName = obj->_itype.get_true_name();
|
std::string cClassName = obj->_itype.get_true_name();
|
||||||
std::string export_class_name = classNameFromCppName(obj->_itype.get_name(), false);
|
std::string export_class_name = classNameFromCppName(obj->_itype.get_name(), false);
|
||||||
|
|
||||||
bool is_runtime_typed = IsPandaTypedObject(obj->_itype._cpptype->as_struct_type());
|
|
||||||
if (!is_runtime_typed && has_get_class_type_function(obj->_itype._cpptype)) {
|
|
||||||
is_runtime_typed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
out << "/**\n";
|
out << "/**\n";
|
||||||
out << " * Python method tables for " << ClassName << " (" << export_class_name << ")\n" ;
|
out << " * Python method tables for " << ClassName << " (" << export_class_name << ")\n" ;
|
||||||
out << " */\n";
|
out << " */\n";
|
||||||
@ -5109,9 +5104,8 @@ write_function_instance(ostream &out, FunctionRemap *remap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CPPEnumType *enum_type = (CPPEnumType *)TypeManager::unwrap(type);
|
CPPEnumType *enum_type = (CPPEnumType *)TypeManager::unwrap(type);
|
||||||
CPPType *underlying_type = enum_type->get_underlying_type();
|
//CPPType *underlying_type = enum_type->get_underlying_type();
|
||||||
underlying_type = TypeManager::unwrap_const(underlying_type);
|
//underlying_type = TypeManager::unwrap_const(underlying_type);
|
||||||
|
|
||||||
//indent(out, indent_level);
|
//indent(out, indent_level);
|
||||||
//underlying_type->output_instance(out, param_name + "_val", &parser);
|
//underlying_type->output_instance(out, param_name + "_val", &parser);
|
||||||
//out << default_expr << ";\n";
|
//out << default_expr << ";\n";
|
||||||
|
@ -122,13 +122,13 @@ reload_implicit_pages() {
|
|||||||
const char *log_filename;
|
const char *log_filename;
|
||||||
};
|
};
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
const BlobInfo *blobinfo = (const BlobInfo *)GetProcAddress(GetModuleHandle(NULL), "blobinfo");
|
const BlobInfo *blobinfo = (const BlobInfo *)GetProcAddress(GetModuleHandle(nullptr), "blobinfo");
|
||||||
#elif defined(RTLD_MAIN_ONLY)
|
#elif defined(RTLD_MAIN_ONLY)
|
||||||
const BlobInfo *blobinfo = (const BlobInfo *)dlsym(RTLD_MAIN_ONLY, "blobinfo");
|
const BlobInfo *blobinfo = (const BlobInfo *)dlsym(RTLD_MAIN_ONLY, "blobinfo");
|
||||||
//#elif defined(RTLD_SELF)
|
//#elif defined(RTLD_SELF)
|
||||||
// const BlobInfo *blobinfo = (const BlobInfo *)dlsym(RTLD_SELF, "blobinfo");
|
// const BlobInfo *blobinfo = (const BlobInfo *)dlsym(RTLD_SELF, "blobinfo");
|
||||||
#else
|
#else
|
||||||
const BlobInfo *blobinfo = (const BlobInfo *)dlsym(dlopen(NULL, RTLD_NOW), "blobinfo");
|
const BlobInfo *blobinfo = (const BlobInfo *)dlsym(dlopen(nullptr, RTLD_NOW), "blobinfo");
|
||||||
#endif
|
#endif
|
||||||
if (blobinfo == nullptr) {
|
if (blobinfo == nullptr) {
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
@ -156,6 +156,36 @@ private:
|
|||||||
|
|
||||||
#define nassert_raise(message) Notify::write_string(message)
|
#define nassert_raise(message) Notify::write_string(message)
|
||||||
|
|
||||||
|
#elif defined(__clang_analyzer__)
|
||||||
|
|
||||||
|
// We define these so that clang-tidy can generally assume that assertions will
|
||||||
|
// not occur, since we don't really care about things like minor memory leaks
|
||||||
|
// on assertion failure.
|
||||||
|
|
||||||
|
#define nassertr(condition, return_value) \
|
||||||
|
{ \
|
||||||
|
if (!(condition)) { \
|
||||||
|
abort(); \
|
||||||
|
return return_value; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define nassertv(condition) \
|
||||||
|
{ \
|
||||||
|
if (!(condition)) { \
|
||||||
|
abort(); \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define nassertd(condition) \
|
||||||
|
if (!(condition))
|
||||||
|
|
||||||
|
#define nassertr_always(condition, return_value) nassertr(condition, return_value)
|
||||||
|
#define nassertv_always(condition) nassertv(condition)
|
||||||
|
|
||||||
|
#define nassert_raise(message) abort()
|
||||||
|
|
||||||
#else // NDEBUG
|
#else // NDEBUG
|
||||||
|
|
||||||
#define nassertr(condition, return_value) \
|
#define nassertr(condition, return_value) \
|
||||||
|
@ -52,7 +52,7 @@ set_3d_direction(LVector3 d) {
|
|||||||
LVector3 AudioSound::
|
LVector3 AudioSound::
|
||||||
get_3d_direction() const {
|
get_3d_direction() const {
|
||||||
// Intentionally blank.
|
// Intentionally blank.
|
||||||
return ( 0.0f, 0.0f, 0.0f );
|
return { 0.0f, 0.0f, 0.0f };
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioSound::
|
void AudioSound::
|
||||||
|
@ -36,7 +36,7 @@ class OpenALAudioSound;
|
|||||||
extern void al_audio_errcheck(const char *context);
|
extern void al_audio_errcheck(const char *context);
|
||||||
extern void alc_audio_errcheck(const char *context,ALCdevice* device);
|
extern void alc_audio_errcheck(const char *context,ALCdevice* device);
|
||||||
|
|
||||||
class EXPCL_OPENAL_AUDIO OpenALAudioManager : public AudioManager {
|
class EXPCL_OPENAL_AUDIO OpenALAudioManager final : public AudioManager {
|
||||||
class SoundData;
|
class SoundData;
|
||||||
|
|
||||||
friend class OpenALAudioSound;
|
friend class OpenALAudioSound;
|
||||||
|
@ -497,7 +497,7 @@ correct_calibrated_clock(double rtc, double t) {
|
|||||||
}
|
}
|
||||||
set_calibrated_clock(rtc, cc, scale);
|
set_calibrated_clock(rtc, cc, scale);
|
||||||
}
|
}
|
||||||
cc = (rtc - _calibrated_clock_base) * _calibrated_clock_scale;
|
//cc = (rtc - _calibrated_clock_base) * _calibrated_clock_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <AL/alc.h>
|
#include <AL/alc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class EXPCL_OPENAL_AUDIO OpenALAudioSound : public AudioSound {
|
class EXPCL_OPENAL_AUDIO OpenALAudioSound final : public AudioSound {
|
||||||
friend class OpenALAudioManager;
|
friend class OpenALAudioManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
|
|
||||||
virtual bool update_internals(PartBundle *root, PartGroup *parent,
|
virtual bool update_internals(PartBundle *root, PartGroup *parent,
|
||||||
bool self_changed, bool parent_changed,
|
bool self_changed, bool parent_changed,
|
||||||
Thread *current_thread);
|
Thread *current_thread) final;
|
||||||
virtual void do_xform(const LMatrix4 &mat, const LMatrix4 &inv_mat);
|
virtual void do_xform(const LMatrix4 &mat, const LMatrix4 &inv_mat);
|
||||||
|
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
|
@ -1251,7 +1251,7 @@ dist_to_polygon(const LPoint2 &p, const PointDef *points, size_t num_points) con
|
|||||||
if (d >= 0.0f) {
|
if (d >= 0.0f) {
|
||||||
if (!got_dist || d < best_dist) {
|
if (!got_dist || d < best_dist) {
|
||||||
best_dist = d;
|
best_dist = d;
|
||||||
got_dist = true;
|
//got_dist = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ set_highest_collision(const NodePath &target_node_path, const NodePath &from_nod
|
|||||||
if (!got_max && got_min) {
|
if (!got_max && got_min) {
|
||||||
// We've fallen through the world, but we're also under some walkable
|
// We've fallen through the world, but we're also under some walkable
|
||||||
// geometry. Move us up to the lowest surface:
|
// geometry. Move us up to the lowest surface:
|
||||||
got_max = true;
|
//got_max = true;
|
||||||
max_height = min_height;
|
max_height = min_height;
|
||||||
highest = lowest;
|
highest = lowest;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ EvdevInputDevice::
|
|||||||
if (_fd != -1) {
|
if (_fd != -1) {
|
||||||
if (_ff_id != -1) {
|
if (_ff_id != -1) {
|
||||||
// Remove force-feedback effect.
|
// Remove force-feedback effect.
|
||||||
do_set_vibration(0, 0);
|
EvdevInputDevice::do_set_vibration(0, 0);
|
||||||
ioctl(_fd, EVIOCRMFF, _ff_id);
|
ioctl(_fd, EVIOCRMFF, _ff_id);
|
||||||
_ff_id = -1;
|
_ff_id = -1;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ set_view_data(int view, const void *ptr) {
|
|||||||
Texture *tex = get_result();
|
Texture *tex = get_result();
|
||||||
PTA_uchar new_image = tex->modify_ram_image();
|
PTA_uchar new_image = tex->modify_ram_image();
|
||||||
unsigned char *image_ptr = new_image.p();
|
unsigned char *image_ptr = new_image.p();
|
||||||
size_t image_size = tex->get_ram_image_size();
|
size_t image_size;
|
||||||
if (z >= 0 || view > 0) {
|
if (z >= 0 || view > 0) {
|
||||||
image_size = tex->get_expected_ram_page_size();
|
image_size = tex->get_expected_ram_page_size();
|
||||||
if (z >= 0) {
|
if (z >= 0) {
|
||||||
@ -43,6 +43,8 @@ set_view_data(int view, const void *ptr) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
image_size = tex->get_ram_image_size();
|
||||||
}
|
}
|
||||||
memcpy(image_ptr, ptr, image_size);
|
memcpy(image_ptr, ptr, image_size);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* eyes together. To access the left or right eyes independently, use
|
* eyes together. To access the left or right eyes independently, use
|
||||||
* get_left_eye() and get_right_eye().
|
* get_left_eye() and get_right_eye().
|
||||||
*/
|
*/
|
||||||
class EXPCL_PANDA_DISPLAY StereoDisplayRegion : public DisplayRegion {
|
class EXPCL_PANDA_DISPLAY StereoDisplayRegion final : public DisplayRegion {
|
||||||
protected:
|
protected:
|
||||||
StereoDisplayRegion(GraphicsOutput *window,
|
StereoDisplayRegion(GraphicsOutput *window,
|
||||||
const LVecBase4 &dimensions,
|
const LVecBase4 &dimensions,
|
||||||
|
@ -785,9 +785,11 @@ main(int argc, char **argv) {
|
|||||||
// argument if there is not one already.
|
// argument if there is not one already.
|
||||||
if (argc >= 2) {
|
if (argc >= 2) {
|
||||||
if (*argv[1] != '-' && *argv[1] != '\0') {
|
if (*argv[1] != '-' && *argv[1] != '\0') {
|
||||||
char *new_arg = (char *)PANDA_MALLOC_ARRAY(strlen(argv[1]) + 2);
|
size_t len = strlen(argv[1]);
|
||||||
|
char *new_arg = (char *)PANDA_MALLOC_ARRAY(len + 2);
|
||||||
new_arg[0] = '-';
|
new_arg[0] = '-';
|
||||||
strcpy(new_arg + 1, argv[1]);
|
memcpy(new_arg + 1, argv[1], len);
|
||||||
|
new_arg[len + 1] = 0;
|
||||||
argv[1] = new_arg;
|
argv[1] = new_arg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1403,7 +1403,7 @@ ostream &operator << (ostream &out, EggGroup::CollideFlags t) {
|
|||||||
}
|
}
|
||||||
if (bits & EggGroup::CF_level) {
|
if (bits & EggGroup::CF_level) {
|
||||||
out << space << "level";
|
out << space << "level";
|
||||||
space = " ";
|
//space = " ";
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -241,8 +241,8 @@ make_output(const std::string &name,
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
eglGraphicsStateGuardian *eglgsg = 0;
|
eglGraphicsStateGuardian *eglgsg = nullptr;
|
||||||
if (gsg != 0) {
|
if (gsg != nullptr) {
|
||||||
DCAST_INTO_R(eglgsg, gsg, nullptr);
|
DCAST_INTO_R(eglgsg, gsg, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ make_output(const std::string &name,
|
|||||||
|
|
||||||
// Second thing to try: a GL(ES(2))GraphicsBuffer
|
// Second thing to try: a GL(ES(2))GraphicsBuffer
|
||||||
if (retry == 1) {
|
if (retry == 1) {
|
||||||
if ((host==0)||
|
if (host == nullptr ||
|
||||||
// (!gl_support_fbo)||
|
// (!gl_support_fbo)||
|
||||||
((flags&BF_require_parasite)!=0)||
|
((flags&BF_require_parasite)!=0)||
|
||||||
((flags&BF_require_window)!=0)) {
|
((flags&BF_require_window)!=0)) {
|
||||||
@ -290,7 +290,7 @@ make_output(const std::string &name,
|
|||||||
}
|
}
|
||||||
// Early failure - if we are sure that this buffer WONT meet specs, we can
|
// Early failure - if we are sure that this buffer WONT meet specs, we can
|
||||||
// bail out early.
|
// bail out early.
|
||||||
if ((flags & BF_fb_props_optional)==0) {
|
if ((flags & BF_fb_props_optional) == 0) {
|
||||||
if (fb_prop.get_indexed_color() > 0 ||
|
if (fb_prop.get_indexed_color() > 0 ||
|
||||||
fb_prop.get_back_buffers() > 0 ||
|
fb_prop.get_back_buffers() > 0 ||
|
||||||
fb_prop.get_accum_bits() > 0) {
|
fb_prop.get_accum_bits() > 0) {
|
||||||
@ -299,12 +299,12 @@ make_output(const std::string &name,
|
|||||||
}
|
}
|
||||||
// Early success - if we are sure that this buffer WILL meet specs, we can
|
// Early success - if we are sure that this buffer WILL meet specs, we can
|
||||||
// precertify it.
|
// precertify it.
|
||||||
if ((eglgsg != 0) &&
|
if (eglgsg != nullptr &&
|
||||||
(eglgsg->is_valid()) &&
|
eglgsg->is_valid() &&
|
||||||
(!eglgsg->needs_reset()) &&
|
!eglgsg->needs_reset() &&
|
||||||
(eglgsg->_supports_framebuffer_object) &&
|
eglgsg->_supports_framebuffer_object &&
|
||||||
(eglgsg->_glDrawBuffers != 0)&&
|
eglgsg->_glDrawBuffers != nullptr &&
|
||||||
(fb_prop.is_basic())) {
|
fb_prop.is_basic()) {
|
||||||
precertify = true;
|
precertify = true;
|
||||||
}
|
}
|
||||||
#ifdef OPENGLES_2
|
#ifdef OPENGLES_2
|
||||||
|
@ -209,7 +209,7 @@ set_name(const string &name) {
|
|||||||
--p;
|
--p;
|
||||||
trimmed = p;
|
trimmed = p;
|
||||||
} else {
|
} else {
|
||||||
p = trimmed;
|
//p = trimmed;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,7 +237,7 @@ get_name_prefix() const {
|
|||||||
--p;
|
--p;
|
||||||
trimmed = p;
|
trimmed = p;
|
||||||
} else {
|
} else {
|
||||||
p = trimmed;
|
//p = trimmed;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ protected:
|
|||||||
|
|
||||||
bool do_has_task(AsyncTask *task) const;
|
bool do_has_task(AsyncTask *task) const;
|
||||||
|
|
||||||
virtual void do_output(std::ostream &out) const;
|
void do_output(std::ostream &out) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void make_global_ptr();
|
static void make_global_ptr();
|
||||||
|
@ -1074,7 +1074,7 @@ compute_file_patches(ostream &write_stream,
|
|||||||
uint32_t remaining_bytes = result_file_length - start_pos;
|
uint32_t remaining_bytes = result_file_length - start_pos;
|
||||||
cache_add_and_copy(write_stream, remaining_bytes, &buffer_new[start_pos],
|
cache_add_and_copy(write_stream, remaining_bytes, &buffer_new[start_pos],
|
||||||
0, 0);
|
0, 0);
|
||||||
start_pos += remaining_bytes;
|
//start_pos += remaining_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
PANDA_FREE_ARRAY(link_table);
|
PANDA_FREE_ARRAY(link_table);
|
||||||
|
@ -128,7 +128,6 @@ update_page(AdaptiveLruPage *page) {
|
|||||||
page->_average_frame_utilization *= 1.0f - _weight;
|
page->_average_frame_utilization *= 1.0f - _weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
target_priority = page->_priority;
|
|
||||||
if (page->_average_frame_utilization >= 1.0f) {
|
if (page->_average_frame_utilization >= 1.0f) {
|
||||||
int integer_average_frame_utilization;
|
int integer_average_frame_utilization;
|
||||||
|
|
||||||
|
@ -1350,8 +1350,6 @@ get_next_modified() {
|
|||||||
*/
|
*/
|
||||||
void Geom::
|
void Geom::
|
||||||
compute_internal_bounds(Geom::CData *cdata, Thread *current_thread) const {
|
compute_internal_bounds(Geom::CData *cdata, Thread *current_thread) const {
|
||||||
int num_vertices = 0;
|
|
||||||
|
|
||||||
// Get the vertex data, after animation.
|
// Get the vertex data, after animation.
|
||||||
CPT(GeomVertexData) vertex_data = get_animated_vertex_data(true, current_thread);
|
CPT(GeomVertexData) vertex_data = get_animated_vertex_data(true, current_thread);
|
||||||
|
|
||||||
@ -1451,16 +1449,8 @@ compute_internal_bounds(Geom::CData *cdata, Thread *current_thread) const {
|
|||||||
case BoundingVolume::BT_box:
|
case BoundingVolume::BT_box:
|
||||||
cdata->_internal_bounds = new BoundingBox(pmin, pmax);
|
cdata->_internal_bounds = new BoundingBox(pmin, pmax);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Primitives::const_iterator pi;
|
else {
|
||||||
for (pi = cdata->_primitives.begin();
|
|
||||||
pi != cdata->_primitives.end();
|
|
||||||
++pi) {
|
|
||||||
CPT(GeomPrimitive) prim = (*pi).get_read_pointer(current_thread);
|
|
||||||
num_vertices += prim->get_num_vertices();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// No points; empty bounding volume.
|
// No points; empty bounding volume.
|
||||||
if (btype == BoundingVolume::BT_sphere) {
|
if (btype == BoundingVolume::BT_sphere) {
|
||||||
cdata->_internal_bounds = new BoundingSphere;
|
cdata->_internal_bounds = new BoundingSphere;
|
||||||
|
@ -6105,14 +6105,6 @@ do_compress_ram_image(CData *cdata, Texture::CompressionMode compression,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Choose an appropriate quality level.
|
|
||||||
if (quality_level == Texture::QL_default) {
|
|
||||||
quality_level = cdata->_quality_level;
|
|
||||||
}
|
|
||||||
if (quality_level == Texture::QL_default) {
|
|
||||||
quality_level = texture_quality_level;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (compression == CM_rgtc) {
|
if (compression == CM_rgtc) {
|
||||||
// We should compress RGTC ourselves, as squish does not support it.
|
// We should compress RGTC ourselves, as squish does not support it.
|
||||||
if (cdata->_component_type != T_unsigned_byte) {
|
if (cdata->_component_type != T_unsigned_byte) {
|
||||||
@ -6185,6 +6177,14 @@ do_compress_ram_image(CData *cdata, Texture::CompressionMode compression,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SQUISH
|
#ifdef HAVE_SQUISH
|
||||||
|
// Choose an appropriate quality level.
|
||||||
|
if (quality_level == Texture::QL_default) {
|
||||||
|
quality_level = cdata->_quality_level;
|
||||||
|
}
|
||||||
|
if (quality_level == Texture::QL_default) {
|
||||||
|
quality_level = texture_quality_level;
|
||||||
|
}
|
||||||
|
|
||||||
if (cdata->_texture_type != TT_3d_texture &&
|
if (cdata->_texture_type != TT_3d_texture &&
|
||||||
cdata->_texture_type != TT_2d_texture_array &&
|
cdata->_texture_type != TT_2d_texture_array &&
|
||||||
cdata->_component_type == T_unsigned_byte) {
|
cdata->_component_type == T_unsigned_byte) {
|
||||||
|
@ -126,8 +126,6 @@ void MeshDrawer2D::end() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws a tiled rectangle, size of tiles is in us and vs
|
* Draws a tiled rectangle, size of tiles is in us and vs
|
||||||
*/
|
*/
|
||||||
@ -138,7 +136,7 @@ rectangle_tiled(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
PN_stdfloat x_fit = w/us;
|
PN_stdfloat x_fit = w/us;
|
||||||
PN_stdfloat y_fit = h/vs;
|
PN_stdfloat y_fit;
|
||||||
PN_stdfloat x_pos = x;
|
PN_stdfloat x_pos = x;
|
||||||
|
|
||||||
while (x_fit > 0){
|
while (x_fit > 0){
|
||||||
@ -149,7 +147,7 @@ rectangle_tiled(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
|
|||||||
PN_stdfloat fixed_us = us;
|
PN_stdfloat fixed_us = us;
|
||||||
PN_stdfloat fixed_vs = vs;
|
PN_stdfloat fixed_vs = vs;
|
||||||
|
|
||||||
// we are cuttin in the middle of a tile x direction
|
// we are cutting in the middle of a tile x direction
|
||||||
if (x_fit < 1){
|
if (x_fit < 1){
|
||||||
fixed_us = w;
|
fixed_us = w;
|
||||||
while (fixed_us > us){
|
while (fixed_us > us){
|
||||||
@ -157,7 +155,7 @@ rectangle_tiled(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we are cuttin in the middel of a tile y directon
|
// we are cutting in the middle of a tile y directon
|
||||||
if (y_fit < 1){
|
if (y_fit < 1){
|
||||||
fixed_vs = h;
|
fixed_vs = h;
|
||||||
while (fixed_vs > vs){
|
while (fixed_vs > vs){
|
||||||
@ -173,11 +171,8 @@ rectangle_tiled(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
|
|||||||
x_pos += us;
|
x_pos += us;
|
||||||
x_fit -= 1;
|
x_fit -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws a 2d rectangle, with borders and corders, taken from the surrounding
|
* Draws a 2d rectangle, with borders and corders, taken from the surrounding
|
||||||
* texture
|
* texture
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
virtual LPoint3 get_max() const;
|
virtual LPoint3 get_max() const;
|
||||||
|
|
||||||
virtual LPoint3 get_approx_center() const;
|
virtual LPoint3 get_approx_center() const;
|
||||||
virtual void xform(const LMatrix4 &mat);
|
virtual void xform(const LMatrix4 &mat) final;
|
||||||
|
|
||||||
virtual void output(std::ostream &out) const;
|
virtual void output(std::ostream &out) const;
|
||||||
virtual void write(std::ostream &out, int indent_level = 0) const;
|
virtual void write(std::ostream &out, int indent_level = 0) const;
|
||||||
|
@ -501,9 +501,9 @@ contains_lineseg(const LPoint3 &a, const LPoint3 &b) const {
|
|||||||
|
|
||||||
if (IS_NEARLY_ZERO(radical)) {
|
if (IS_NEARLY_ZERO(radical)) {
|
||||||
// Tangent.
|
// Tangent.
|
||||||
t1 = t2 = -B / (2.0f*A);
|
t1 = -B / (2.0f*A);
|
||||||
return (t1 >= 0.0f && t1 <= 1.0f) ?
|
return (t1 >= 0.0f && t1 <= 1.0f) ?
|
||||||
IF_possible | IF_some : IF_no_intersection;
|
IF_possible | IF_some : IF_no_intersection;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (radical < 0.0f) {
|
if (radical < 0.0f) {
|
||||||
|
@ -32,8 +32,8 @@ OdeJoint::
|
|||||||
OdeJoint() :
|
OdeJoint() :
|
||||||
_id(nullptr) {
|
_id(nullptr) {
|
||||||
if (odejoint_cat.is_debug()) {
|
if (odejoint_cat.is_debug()) {
|
||||||
std::ostream &out = odejoint_cat.debug();
|
odejoint_cat.debug()
|
||||||
out << get_type() << "(" << _id << ")\n";
|
<< "OdeJoint(" << _id << ")\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,8 +41,8 @@ OdeJoint::
|
|||||||
OdeJoint(dJointID id) :
|
OdeJoint(dJointID id) :
|
||||||
_id(id) {
|
_id(id) {
|
||||||
if (odejoint_cat.is_debug()) {
|
if (odejoint_cat.is_debug()) {
|
||||||
std::ostream &out = odejoint_cat.debug();
|
odejoint_cat.debug()
|
||||||
out << get_type() << "(" << _id << ")\n";
|
<< "OdeJoint(" << _id << ")\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ OdeTriMeshData(const NodePath& model, bool use_normals) :
|
|||||||
_num_vertices(0),
|
_num_vertices(0),
|
||||||
_num_faces(0) {
|
_num_faces(0) {
|
||||||
if (odetrimeshdata_cat.is_debug()) {
|
if (odetrimeshdata_cat.is_debug()) {
|
||||||
odetrimeshdata_cat.debug() << get_type() << "(" << _id << ")" << "\n";
|
odetrimeshdata_cat.debug() << "OdeTriMeshData(" << _id << ")" << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
process_model(model, use_normals);
|
process_model(model, use_normals);
|
||||||
@ -142,7 +142,7 @@ OdeTriMeshData(const OdeTriMeshData &other) {
|
|||||||
OdeTriMeshData::
|
OdeTriMeshData::
|
||||||
~OdeTriMeshData() {
|
~OdeTriMeshData() {
|
||||||
if (odetrimeshdata_cat.is_debug()) {
|
if (odetrimeshdata_cat.is_debug()) {
|
||||||
odetrimeshdata_cat.debug() << "~" << get_type() << "(" << _id << ")" << "\n";
|
odetrimeshdata_cat.debug() << "~OdeTriMeshData(" << _id << ")" << "\n";
|
||||||
}
|
}
|
||||||
destroy();
|
destroy();
|
||||||
if (_vertices != nullptr) {
|
if (_vertices != nullptr) {
|
||||||
@ -165,7 +165,7 @@ OdeTriMeshData::
|
|||||||
void OdeTriMeshData::
|
void OdeTriMeshData::
|
||||||
destroy() {
|
destroy() {
|
||||||
if (odetrimeshdata_cat.is_debug()) {
|
if (odetrimeshdata_cat.is_debug()) {
|
||||||
odetrimeshdata_cat.debug() << get_type() << "::destroy(" << _id << ")" << "\n";
|
odetrimeshdata_cat.debug() << "OdeTriMeshData::destroy(" << _id << ")" << "\n";
|
||||||
}
|
}
|
||||||
if (_id != nullptr) {
|
if (_id != nullptr) {
|
||||||
dGeomTriMeshDataDestroy(_id);
|
dGeomTriMeshDataDestroy(_id);
|
||||||
|
@ -21,7 +21,7 @@ OdeWorld::
|
|||||||
OdeWorld() :
|
OdeWorld() :
|
||||||
_id(dWorldCreate()) {
|
_id(dWorldCreate()) {
|
||||||
if (odeworld_cat.is_debug()) {
|
if (odeworld_cat.is_debug()) {
|
||||||
odeworld_cat.debug() << get_type() << "(" << _id << ")" << "\n";
|
odeworld_cat.debug() << "OdeWorld(" << _id << ")" << "\n";
|
||||||
}
|
}
|
||||||
_num_surfaces = 0;
|
_num_surfaces = 0;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ OdeWorld(const OdeWorld ©) :
|
|||||||
OdeWorld::
|
OdeWorld::
|
||||||
~OdeWorld() {
|
~OdeWorld() {
|
||||||
if (odeworld_cat.is_debug()) {
|
if (odeworld_cat.is_debug()) {
|
||||||
odeworld_cat.debug() << "~" << get_type() << "(" << _id << ")" << "\n";
|
odeworld_cat.debug() << "~OdeWorld(" << _id << ")" << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
* "NurbsCurve" instead of this one, and performs most of the NURBS curve
|
* "NurbsCurve" instead of this one, and performs most of the NURBS curve
|
||||||
* functions. This class then becomes vestigial.
|
* functions. This class then becomes vestigial.
|
||||||
*/
|
*/
|
||||||
class EXPCL_PANDA_PARAMETRICS NurbsCurve : public PiecewiseCurve, public NurbsCurveInterface {
|
class EXPCL_PANDA_PARAMETRICS NurbsCurve final : public PiecewiseCurve, public NurbsCurveInterface {
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
NurbsCurve();
|
NurbsCurve();
|
||||||
NurbsCurve(const ParametricCurve &pc);
|
NurbsCurve(const ParametricCurve &pc);
|
||||||
|
@ -85,7 +85,9 @@ bool PiecewiseCurve::
|
|||||||
get_tangent(PN_stdfloat t, LVecBase3 &tangent) const {
|
get_tangent(PN_stdfloat t, LVecBase3 &tangent) const {
|
||||||
const ParametricCurve *curve;
|
const ParametricCurve *curve;
|
||||||
bool result = find_curve(curve, t);
|
bool result = find_curve(curve, t);
|
||||||
|
if (curve == nullptr){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// We use | instead of || so we won't short-circuit this calculation.
|
// We use | instead of || so we won't short-circuit this calculation.
|
||||||
return result | curve->get_tangent(t, tangent);
|
return result | curve->get_tangent(t, tangent);
|
||||||
}
|
}
|
||||||
@ -98,7 +100,9 @@ bool PiecewiseCurve::
|
|||||||
get_2ndtangent(PN_stdfloat t, LVecBase3 &tangent2) const {
|
get_2ndtangent(PN_stdfloat t, LVecBase3 &tangent2) const {
|
||||||
const ParametricCurve *curve;
|
const ParametricCurve *curve;
|
||||||
bool result = find_curve(curve, t);
|
bool result = find_curve(curve, t);
|
||||||
|
if (curve == nullptr){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// We use | instead of || so we won't short-circuit this calculation.
|
// We use | instead of || so we won't short-circuit this calculation.
|
||||||
return result | curve->get_2ndtangent(t, tangent2);
|
return result | curve->get_2ndtangent(t, tangent2);
|
||||||
}
|
}
|
||||||
@ -185,7 +189,9 @@ bool PiecewiseCurve::
|
|||||||
get_pt(PN_stdfloat t, LVecBase3 &point, LVecBase3 &tangent) const {
|
get_pt(PN_stdfloat t, LVecBase3 &point, LVecBase3 &tangent) const {
|
||||||
const ParametricCurve *curve;
|
const ParametricCurve *curve;
|
||||||
bool result = find_curve(curve, t);
|
bool result = find_curve(curve, t);
|
||||||
|
if (curve == nullptr){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// We use | instead of || so we won't short-circuit this calculation.
|
// We use | instead of || so we won't short-circuit this calculation.
|
||||||
return result | curve->get_pt(t, point, tangent);
|
return result | curve->get_pt(t, point, tangent);
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ protected:
|
|||||||
Curveseg(ParametricCurve *c, PN_stdfloat t) : _curve(c), _tend(t) {}
|
Curveseg(ParametricCurve *c, PN_stdfloat t) : _curve(c), _tend(t) {}
|
||||||
|
|
||||||
PT(ParametricCurve) _curve;
|
PT(ParametricCurve) _curve;
|
||||||
PN_stdfloat _tend;
|
PN_stdfloat _tend = 0.0f;
|
||||||
};
|
};
|
||||||
|
|
||||||
pvector<Curveseg> _segs;
|
pvector<Curveseg> _segs;
|
||||||
|
@ -71,10 +71,10 @@ private:
|
|||||||
|
|
||||||
virtual void birth_particle(int index);
|
virtual void birth_particle(int index);
|
||||||
virtual void kill_particle(int index);
|
virtual void kill_particle(int index);
|
||||||
virtual void init_geoms();
|
virtual void init_geoms() final;
|
||||||
virtual void render(pvector< PT(PhysicsObject) >& po_vector,
|
virtual void render(pvector< PT(PhysicsObject) >& po_vector,
|
||||||
int ttl_particles);
|
int ttl_particles);
|
||||||
virtual void resize_pool(int new_size);
|
virtual void resize_pool(int new_size) final;
|
||||||
|
|
||||||
static PStatCollector _render_collector;
|
static PStatCollector _render_collector;
|
||||||
};
|
};
|
||||||
|
@ -89,10 +89,10 @@ private:
|
|||||||
|
|
||||||
virtual void birth_particle(int index);
|
virtual void birth_particle(int index);
|
||||||
virtual void kill_particle(int index);
|
virtual void kill_particle(int index);
|
||||||
virtual void init_geoms();
|
virtual void init_geoms() final;
|
||||||
virtual void render(pvector< PT(PhysicsObject) >& po_vector,
|
virtual void render(pvector< PT(PhysicsObject) >& po_vector,
|
||||||
int ttl_particles);
|
int ttl_particles);
|
||||||
virtual void resize_pool(int new_size);
|
virtual void resize_pool(int new_size) final;
|
||||||
|
|
||||||
static PStatCollector _render_collector;
|
static PStatCollector _render_collector;
|
||||||
};
|
};
|
||||||
|
@ -89,10 +89,10 @@ private:
|
|||||||
|
|
||||||
virtual void birth_particle(int index);
|
virtual void birth_particle(int index);
|
||||||
virtual void kill_particle(int index);
|
virtual void kill_particle(int index);
|
||||||
virtual void init_geoms();
|
virtual void init_geoms() final;
|
||||||
virtual void render(pvector< PT(PhysicsObject) >& po_vector,
|
virtual void render(pvector< PT(PhysicsObject) >& po_vector,
|
||||||
int ttl_particles);
|
int ttl_particles);
|
||||||
virtual void resize_pool(int new_size);
|
virtual void resize_pool(int new_size) final;
|
||||||
|
|
||||||
static PStatCollector _render_collector;
|
static PStatCollector _render_collector;
|
||||||
};
|
};
|
||||||
|
@ -259,7 +259,7 @@ private:
|
|||||||
|
|
||||||
virtual void birth_particle(int index);
|
virtual void birth_particle(int index);
|
||||||
virtual void kill_particle(int index);
|
virtual void kill_particle(int index);
|
||||||
virtual void init_geoms();
|
virtual void init_geoms() final;
|
||||||
virtual void render(pvector< PT(PhysicsObject) > &po_vector,
|
virtual void render(pvector< PT(PhysicsObject) > &po_vector,
|
||||||
int ttl_particles);
|
int ttl_particles);
|
||||||
virtual void resize_pool(int new_size);
|
virtual void resize_pool(int new_size);
|
||||||
|
@ -106,7 +106,7 @@ output(std::ostream &out) const {
|
|||||||
}
|
}
|
||||||
if ((_mode & M_better) != 0) {
|
if ((_mode & M_better) != 0) {
|
||||||
out << sep << "better";
|
out << sep << "better";
|
||||||
sep = '|';
|
//sep = '|';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ read_node(bool report_errors) {
|
|||||||
object = read_object();
|
object = read_object();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (object == TypedWritable::Null) {
|
if (object == nullptr) {
|
||||||
if (report_errors) {
|
if (report_errors) {
|
||||||
loader_cat.error() << "Bam file " << _bam_filename << " is empty.\n";
|
loader_cat.error() << "Bam file " << _bam_filename << " is empty.\n";
|
||||||
}
|
}
|
||||||
|
@ -1460,6 +1460,10 @@ remove_unused_vertices(const GeomVertexData *vdata) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int num_vertices = vdata->get_num_rows();
|
int num_vertices = vdata->get_num_rows();
|
||||||
|
if (num_vertices <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int new_num_vertices = referenced_vertices.get_num_on_bits();
|
int new_num_vertices = referenced_vertices.get_num_on_bits();
|
||||||
if (num_vertices <= new_num_vertices) {
|
if (num_vertices <= new_num_vertices) {
|
||||||
// All vertices are used.
|
// All vertices are used.
|
||||||
|
@ -208,6 +208,7 @@ prepare_portal(const NodePath &node_path)
|
|||||||
if (node->is_of_type(PortalNode::get_class_type())) {
|
if (node->is_of_type(PortalNode::get_class_type())) {
|
||||||
_portal_node = DCAST(PortalNode, node);
|
_portal_node = DCAST(PortalNode, node);
|
||||||
}
|
}
|
||||||
|
nassertr(_portal_node != nullptr, false);
|
||||||
|
|
||||||
// Get the geometry from the portal
|
// Get the geometry from the portal
|
||||||
if (portal_cat.is_spam()) {
|
if (portal_cat.is_spam()) {
|
||||||
|
@ -1897,8 +1897,6 @@ int RenderState::
|
|||||||
complete_pointers(TypedWritable **p_list, BamReader *manager) {
|
complete_pointers(TypedWritable **p_list, BamReader *manager) {
|
||||||
int pi = TypedWritable::complete_pointers(p_list, manager);
|
int pi = TypedWritable::complete_pointers(p_list, manager);
|
||||||
|
|
||||||
int num_attribs = 0;
|
|
||||||
|
|
||||||
RenderAttribRegistry *reg = RenderAttribRegistry::quick_get_global_ptr();
|
RenderAttribRegistry *reg = RenderAttribRegistry::quick_get_global_ptr();
|
||||||
for (size_t i = 0; i < (*_read_overrides).size(); ++i) {
|
for (size_t i = 0; i < (*_read_overrides).size(); ++i) {
|
||||||
int override = (*_read_overrides)[i];
|
int override = (*_read_overrides)[i];
|
||||||
@ -1909,7 +1907,6 @@ complete_pointers(TypedWritable **p_list, BamReader *manager) {
|
|||||||
if (slot > 0 && slot < reg->get_max_slots()) {
|
if (slot > 0 && slot < reg->get_max_slots()) {
|
||||||
_attributes[slot].set(attrib, override);
|
_attributes[slot].set(attrib, override);
|
||||||
_filled_slots.set_bit(slot);
|
_filled_slots.set_bit(slot);
|
||||||
++num_attribs;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -346,7 +346,7 @@ r_apply_attribs(PandaNode *node, const AccumulatedAttribs &attribs,
|
|||||||
|
|
||||||
new_node->copy_children(child_node);
|
new_node->copy_children(child_node);
|
||||||
node->replace_child(child_node, new_node);
|
node->replace_child(child_node, new_node);
|
||||||
child_node = new_node;
|
//child_node = new_node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ PUBLISHED:
|
|||||||
void set_text_def(int state, TextNode *node);
|
void set_text_def(int state, TextNode *node);
|
||||||
TextNode *get_text_def(int state) const;
|
TextNode *get_text_def(int state) const;
|
||||||
|
|
||||||
virtual void set_active(bool active);
|
virtual void set_active(bool active) final;
|
||||||
virtual void set_focus(bool focus);
|
virtual void set_focus(bool focus);
|
||||||
|
|
||||||
INLINE static std::string get_accept_prefix();
|
INLINE static std::string get_accept_prefix();
|
||||||
|
@ -96,7 +96,7 @@ PUBLISHED:
|
|||||||
INLINE static std::string get_adjust_prefix();
|
INLINE static std::string get_adjust_prefix();
|
||||||
INLINE std::string get_adjust_event() const;
|
INLINE std::string get_adjust_event() const;
|
||||||
|
|
||||||
virtual void set_active(bool active);
|
virtual void set_active(bool active) final;
|
||||||
|
|
||||||
void remanage();
|
void remanage();
|
||||||
void recompute();
|
void recompute();
|
||||||
|
@ -64,7 +64,6 @@ private:
|
|||||||
const PipelineCycler<CycleDataType> *_cycler;
|
const PipelineCycler<CycleDataType> *_cycler;
|
||||||
Thread *_current_thread;
|
Thread *_current_thread;
|
||||||
const CycleDataType *_pointer;
|
const CycleDataType *_pointer;
|
||||||
CycleDataType *_write_pointer;
|
|
||||||
#else // !DO_PIPELINING
|
#else // !DO_PIPELINING
|
||||||
// This is all we need for the trivial, do-nothing implementation.
|
// This is all we need for the trivial, do-nothing implementation.
|
||||||
const CycleDataType *_pointer;
|
const CycleDataType *_pointer;
|
||||||
|
@ -56,7 +56,6 @@ private:
|
|||||||
const PipelineCycler<CycleDataType> *_cycler;
|
const PipelineCycler<CycleDataType> *_cycler;
|
||||||
Thread *_current_thread;
|
Thread *_current_thread;
|
||||||
const CycleDataType *_pointer;
|
const CycleDataType *_pointer;
|
||||||
CycleDataType *_write_pointer;
|
|
||||||
#else // !DO_PIPELINING
|
#else // !DO_PIPELINING
|
||||||
// This is all we need for the trivial, do-nothing implementation.
|
// This is all we need for the trivial, do-nothing implementation.
|
||||||
const CycleDataType *_pointer;
|
const CycleDataType *_pointer;
|
||||||
|
@ -195,7 +195,7 @@ cycle() {
|
|||||||
|
|
||||||
if (cycler->is_dirty()) {
|
if (cycler->is_dirty()) {
|
||||||
// The cycler is still dirty. Add it back to the dirty list.
|
// The cycler is still dirty. Add it back to the dirty list.
|
||||||
nassertd(!cycler->is_dirty(prev_seq));
|
nassertd(!cycler->is_dirty(prev_seq)) break;
|
||||||
cycler->insert_before(&_dirty);
|
cycler->insert_before(&_dirty);
|
||||||
cycler->mark_dirty(next_seq);
|
cycler->mark_dirty(next_seq);
|
||||||
++_num_dirty_cyclers;
|
++_num_dirty_cyclers;
|
||||||
|
@ -1991,13 +1991,11 @@ quantize(size_t max_colors) {
|
|||||||
void PNMImage::
|
void PNMImage::
|
||||||
perlin_noise_fill(float sx, float sy, int table_size, unsigned long seed,
|
perlin_noise_fill(float sx, float sy, int table_size, unsigned long seed,
|
||||||
float ox, float oy) {
|
float ox, float oy) {
|
||||||
float x, y;
|
|
||||||
float noise;
|
|
||||||
PerlinNoise2 perlin (sx * _x_size, sy * _y_size, table_size, seed);
|
PerlinNoise2 perlin (sx * _x_size, sy * _y_size, table_size, seed);
|
||||||
for (x = 0; x < _x_size; ++x) {
|
for (int x = 0; x < _x_size; ++x) {
|
||||||
for (y = 0; y < _y_size; ++y) {
|
for (int y = 0; y < _y_size; ++y) {
|
||||||
noise = perlin.noise(x + ox, y + oy);
|
float noise = perlin.noise(x + ox, y + oy);
|
||||||
set_xel(x, y, 0.5 * (noise + 1.0));
|
set_xel(x, y, 0.5f * (noise + 1.0f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2008,12 +2006,10 @@ perlin_noise_fill(float sx, float sy, int table_size, unsigned long seed,
|
|||||||
*/
|
*/
|
||||||
void PNMImage::
|
void PNMImage::
|
||||||
perlin_noise_fill(StackedPerlinNoise2 &perlin) {
|
perlin_noise_fill(StackedPerlinNoise2 &perlin) {
|
||||||
float x, y;
|
for (int x = 0; x < _x_size; ++x) {
|
||||||
float noise;
|
for (int y = 0; y < _y_size; ++y) {
|
||||||
for (x = 0; x < _x_size; ++x) {
|
float noise = perlin.noise(x / (float) _x_size, y / (float) _y_size);
|
||||||
for (y = 0; y < _y_size; ++y) {
|
set_xel(x, y, 0.5f * (noise + 1.0f));
|
||||||
noise = perlin.noise(x / (float) _x_size, y / (float) _y_size);
|
|
||||||
set_xel(x, y, 0.5 * (noise + 1.0));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,13 +52,12 @@ pm_error(const char *format, ...) {
|
|||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
|
|
||||||
static const size_t buffer_size = 1024;
|
static const size_t buffer_size = 1024;
|
||||||
char buffer[buffer_size];
|
char buffer[buffer_size + 1];
|
||||||
|
|
||||||
vsnprintf(buffer, buffer_size, format, ap);
|
vsnprintf(buffer, buffer_size, format, ap);
|
||||||
|
buffer[buffer_size] = 0;
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
nassertv(strlen(buffer) < buffer_size);
|
|
||||||
|
|
||||||
pnmimage_cat.error() << buffer << "\n";
|
pnmimage_cat.error() << buffer << "\n";
|
||||||
|
|
||||||
// Now we're supposed to exit. Inconvenient if we were running Panda
|
// Now we're supposed to exit. Inconvenient if we were running Panda
|
||||||
|
@ -113,7 +113,7 @@ typedef gray xelval;
|
|||||||
// pnm defines these functions, and it's easier to emulate them than to
|
// pnm defines these functions, and it's easier to emulate them than to
|
||||||
// rewrite the code that calls them.
|
// rewrite the code that calls them.
|
||||||
EXPCL_PANDA_PNMIMAGE void pm_message(const char *format, ...);
|
EXPCL_PANDA_PNMIMAGE void pm_message(const char *format, ...);
|
||||||
EXPCL_PANDA_PNMIMAGE void pm_error(const char *format, ...); // doesn't return.
|
EXPCL_PANDA_PNMIMAGE void pm_error [[noreturn]] (const char *format, ...);
|
||||||
|
|
||||||
EXPCL_PANDA_PNMIMAGE int pm_maxvaltobits(int maxval);
|
EXPCL_PANDA_PNMIMAGE int pm_maxvaltobits(int maxval);
|
||||||
EXPCL_PANDA_PNMIMAGE int pm_bitstomaxval(int bits);
|
EXPCL_PANDA_PNMIMAGE int pm_bitstomaxval(int bits);
|
||||||
|
@ -386,10 +386,10 @@ rle_decompress(ScanElem *src,
|
|||||||
--srcleft;
|
--srcleft;
|
||||||
count = (int)(el & 0x7f);
|
count = (int)(el & 0x7f);
|
||||||
|
|
||||||
if( count == 0 )
|
|
||||||
return;
|
|
||||||
if( destleft < count )
|
if( destleft < count )
|
||||||
pm_error("RLE error: too much input data (space left %d, need %d)", destleft, count);
|
pm_error("RLE error: too much input data (space left %d, need %d)", destleft, count);
|
||||||
|
if( count == 0 )
|
||||||
|
return;
|
||||||
destleft -= count;
|
destleft -= count;
|
||||||
if( el & 0x80 ) {
|
if( el & 0x80 ) {
|
||||||
if( srcleft < count )
|
if( srcleft < count )
|
||||||
|
@ -203,8 +203,6 @@ find_hole(int &x, int &y, int x_size, int y_size) const {
|
|||||||
// Scan along the row at 'y'.
|
// Scan along the row at 'y'.
|
||||||
x = 0;
|
x = 0;
|
||||||
while (x + x_size <= _size[0]) {
|
while (x + x_size <= _size[0]) {
|
||||||
int next_x = x;
|
|
||||||
|
|
||||||
// Consider the spot at x, y.
|
// Consider the spot at x, y.
|
||||||
DynamicTextGlyph *overlap = find_overlap(x, y, x_size, y_size);
|
DynamicTextGlyph *overlap = find_overlap(x, y, x_size, y_size);
|
||||||
|
|
||||||
@ -213,7 +211,7 @@ find_hole(int &x, int &y, int x_size, int y_size) const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
next_x = overlap->_x + overlap->_x_size;
|
int next_x = overlap->_x + overlap->_x_size;
|
||||||
next_y = std::min(next_y, overlap->_y + overlap->_y_size);
|
next_y = std::min(next_y, overlap->_y + overlap->_y_size);
|
||||||
nassertr(next_x > x, false);
|
nassertr(next_x > x, false);
|
||||||
x = next_x;
|
x = next_x;
|
||||||
|
@ -538,6 +538,7 @@ assemble_text() {
|
|||||||
PlacedGlyphs::const_iterator pgi;
|
PlacedGlyphs::const_iterator pgi;
|
||||||
for (pgi = placed_glyphs.begin(); pgi != placed_glyphs.end(); ++pgi) {
|
for (pgi = placed_glyphs.begin(); pgi != placed_glyphs.end(); ++pgi) {
|
||||||
const GlyphPlacement &placement = (*pgi);
|
const GlyphPlacement &placement = (*pgi);
|
||||||
|
nassertd(placement._properties != nullptr) continue;
|
||||||
|
|
||||||
if (placement._properties != properties) {
|
if (placement._properties != properties) {
|
||||||
// Get a new set of properties for future glyphs.
|
// Get a new set of properties for future glyphs.
|
||||||
|
@ -437,7 +437,7 @@ send_startup_notification() {
|
|||||||
|
|
||||||
// Allocate enough room for the message, with room for escape characters.
|
// Allocate enough room for the message, with room for escape characters.
|
||||||
char *message = (char *)alloca(_startup_id.size() * 2 + 14);
|
char *message = (char *)alloca(_startup_id.size() * 2 + 14);
|
||||||
strcpy(message, "remove: ID=\"");
|
memcpy(message, "remove: ID=\"", 12);
|
||||||
|
|
||||||
char *p = message + 12;
|
char *p = message + 12;
|
||||||
for (char c : _startup_id) {
|
for (char c : _startup_id) {
|
||||||
|
@ -379,7 +379,8 @@ run() {
|
|||||||
|
|
||||||
EggVertex *v1, *v2, *v3, *v4;
|
EggVertex *v1, *v2, *v3, *v4;
|
||||||
|
|
||||||
if (!_got_pixel_scale) {
|
bool got_pixel_scale = _got_pixel_scale;
|
||||||
|
if (!got_pixel_scale) {
|
||||||
// If we don't have a per-texture pixel scale, all the polygons will be
|
// If we don't have a per-texture pixel scale, all the polygons will be
|
||||||
// the same size, and hence may all share the same four vertices.
|
// the same size, and hence may all share the same four vertices.
|
||||||
make_vertices(_polygon_geometry, vpool, v1, v2, v3, v4);
|
make_vertices(_polygon_geometry, vpool, v1, v2, v3, v4);
|
||||||
@ -410,7 +411,7 @@ run() {
|
|||||||
all_ok = false;
|
all_ok = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_got_pixel_scale) {
|
if (got_pixel_scale) {
|
||||||
if (texture_ok) {
|
if (texture_ok) {
|
||||||
make_vertices(geometry, vpool, v1, v2, v3, v4);
|
make_vertices(geometry, vpool, v1, v2, v3, v4);
|
||||||
} else {
|
} else {
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
#define GTKSTATSCHARTMENU_H
|
#define GTKSTATSCHARTMENU_H
|
||||||
|
|
||||||
#include "pandatoolbase.h"
|
#include "pandatoolbase.h"
|
||||||
|
#include "gtkStatsMonitor.h"
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
class GtkStatsMonitor;
|
|
||||||
class PStatView;
|
class PStatView;
|
||||||
class PStatViewLevel;
|
class PStatViewLevel;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class GtkStatsLabel;
|
|||||||
* A window that draws a flame chart, which shows the collectors explicitly
|
* A window that draws a flame chart, which shows the collectors explicitly
|
||||||
* stopping and starting, one frame at a time.
|
* stopping and starting, one frame at a time.
|
||||||
*/
|
*/
|
||||||
class GtkStatsFlameGraph : public PStatFlameGraph, public GtkStatsGraph {
|
class GtkStatsFlameGraph final : public PStatFlameGraph, public GtkStatsGraph {
|
||||||
public:
|
public:
|
||||||
GtkStatsFlameGraph(GtkStatsMonitor *monitor, int thread_index,
|
GtkStatsFlameGraph(GtkStatsMonitor *monitor, int thread_index,
|
||||||
int collector_index=-1);
|
int collector_index=-1);
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#define GTKSTATSLABEL_H
|
#define GTKSTATSLABEL_H
|
||||||
|
|
||||||
#include "pandatoolbase.h"
|
#include "pandatoolbase.h"
|
||||||
|
#include "luse.h"
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <cairo.h>
|
#include <cairo.h>
|
||||||
|
@ -547,7 +547,7 @@ setup_speed_menu() {
|
|||||||
self->set_scroll_speed(12);
|
self->set_scroll_speed(12);
|
||||||
}
|
}
|
||||||
}), this);
|
}), this);
|
||||||
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(item));
|
//group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(item));
|
||||||
|
|
||||||
item = gtk_separator_menu_item_new();
|
item = gtk_separator_menu_item_new();
|
||||||
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
|
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
#include "pandatoolbase.h"
|
#include "pandatoolbase.h"
|
||||||
|
|
||||||
#include "gtkStatsGraph.h"
|
|
||||||
#include "pStatMonitor.h"
|
#include "pStatMonitor.h"
|
||||||
#include "pointerTo.h"
|
#include "pointerTo.h"
|
||||||
#include "pset.h"
|
#include "pset.h"
|
||||||
@ -25,6 +24,7 @@
|
|||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
class GtkStatsGraph;
|
||||||
class GtkStatsServer;
|
class GtkStatsServer;
|
||||||
class GtkStatsChartMenu;
|
class GtkStatsChartMenu;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class GtkStatsMonitor;
|
|||||||
* A window that draws a piano-roll style chart, which shows the collectors
|
* A window that draws a piano-roll style chart, which shows the collectors
|
||||||
* explicitly stopping and starting, one frame at a time.
|
* explicitly stopping and starting, one frame at a time.
|
||||||
*/
|
*/
|
||||||
class GtkStatsPianoRoll : public PStatPianoRoll, public GtkStatsGraph {
|
class GtkStatsPianoRoll final : public PStatPianoRoll, public GtkStatsGraph {
|
||||||
public:
|
public:
|
||||||
GtkStatsPianoRoll(GtkStatsMonitor *monitor, int thread_index);
|
GtkStatsPianoRoll(GtkStatsMonitor *monitor, int thread_index);
|
||||||
virtual ~GtkStatsPianoRoll();
|
virtual ~GtkStatsPianoRoll();
|
||||||
|
@ -27,7 +27,7 @@ class GtkStatsMonitor;
|
|||||||
/**
|
/**
|
||||||
* A window that draws a strip chart, given a view.
|
* A window that draws a strip chart, given a view.
|
||||||
*/
|
*/
|
||||||
class GtkStatsStripChart : public PStatStripChart, public GtkStatsGraph {
|
class GtkStatsStripChart final : public PStatStripChart, public GtkStatsGraph {
|
||||||
public:
|
public:
|
||||||
GtkStatsStripChart(GtkStatsMonitor *monitor,
|
GtkStatsStripChart(GtkStatsMonitor *monitor,
|
||||||
int thread_index, int collector_index, bool show_level);
|
int thread_index, int collector_index, bool show_level);
|
||||||
|
@ -26,7 +26,7 @@ class GtkStatsMonitor;
|
|||||||
* horizontal scrolling timeline, with concurrent start/stop pairs stacked
|
* horizontal scrolling timeline, with concurrent start/stop pairs stacked
|
||||||
* underneath each other.
|
* underneath each other.
|
||||||
*/
|
*/
|
||||||
class GtkStatsTimeline : public PStatTimeline, public GtkStatsGraph {
|
class GtkStatsTimeline final : public PStatTimeline, public GtkStatsGraph {
|
||||||
public:
|
public:
|
||||||
GtkStatsTimeline(GtkStatsMonitor *monitor);
|
GtkStatsTimeline(GtkStatsMonitor *monitor);
|
||||||
virtual ~GtkStatsTimeline();
|
virtual ~GtkStatsTimeline();
|
||||||
|
@ -789,8 +789,6 @@ find_hole(int &x, int &y, int x_size, int y_size) const {
|
|||||||
// Scan along the row at 'y'.
|
// Scan along the row at 'y'.
|
||||||
x = 0;
|
x = 0;
|
||||||
while (x + x_size <= _x_size) {
|
while (x + x_size <= _x_size) {
|
||||||
int next_x = x;
|
|
||||||
|
|
||||||
// Consider the spot at x, y.
|
// Consider the spot at x, y.
|
||||||
TexturePlacement *overlap = find_overlap(x, y, x_size, y_size);
|
TexturePlacement *overlap = find_overlap(x, y, x_size, y_size);
|
||||||
|
|
||||||
@ -799,7 +797,7 @@ find_hole(int &x, int &y, int x_size, int y_size) const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
next_x = overlap->get_placed_x() + overlap->get_placed_x_size();
|
int next_x = overlap->get_placed_x() + overlap->get_placed_x_size();
|
||||||
next_y = std::min(next_y, overlap->get_placed_y() + overlap->get_placed_y_size());
|
next_y = std::min(next_y, overlap->get_placed_y() + overlap->get_placed_y_size());
|
||||||
nassertr(next_x > x, false);
|
nassertr(next_x > x, false);
|
||||||
x = next_x;
|
x = next_x;
|
||||||
|
@ -25,7 +25,7 @@ class WordWrapStream;
|
|||||||
* Used by WordWrapStream to implement an ostream that flushes its output to
|
* Used by WordWrapStream to implement an ostream that flushes its output to
|
||||||
* ProgramBase::show_text().
|
* ProgramBase::show_text().
|
||||||
*/
|
*/
|
||||||
class WordWrapStreamBuf : public std::streambuf {
|
class WordWrapStreamBuf final : public std::streambuf {
|
||||||
public:
|
public:
|
||||||
WordWrapStreamBuf(WordWrapStream *owner, ProgramBase *program);
|
WordWrapStreamBuf(WordWrapStream *owner, ProgramBase *program);
|
||||||
virtual ~WordWrapStreamBuf();
|
virtual ~WordWrapStreamBuf();
|
||||||
|
@ -34,7 +34,7 @@ public:
|
|||||||
XFile(bool keep_names=false);
|
XFile(bool keep_names=false);
|
||||||
~XFile();
|
~XFile();
|
||||||
|
|
||||||
virtual void clear();
|
virtual void clear() final;
|
||||||
|
|
||||||
bool read(Filename filename);
|
bool read(Filename filename);
|
||||||
bool read(std::istream &in, const std::string &filename = std::string());
|
bool read(std::istream &in, const std::string &filename = std::string());
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
Type type, XFileTemplate *xtemplate = nullptr);
|
Type type, XFileTemplate *xtemplate = nullptr);
|
||||||
virtual ~XFileDataDef();
|
virtual ~XFileDataDef();
|
||||||
|
|
||||||
virtual void clear();
|
virtual void clear() final;
|
||||||
void add_array_def(const XFileArrayDef &array_def);
|
void add_array_def(const XFileArrayDef &array_def);
|
||||||
|
|
||||||
INLINE Type get_data_type() const;
|
INLINE Type get_data_type() const;
|
||||||
|
@ -34,7 +34,7 @@ public:
|
|||||||
|
|
||||||
virtual bool is_template_def() const;
|
virtual bool is_template_def() const;
|
||||||
|
|
||||||
virtual void clear();
|
virtual void clear() final;
|
||||||
virtual void write_text(std::ostream &out, int indent_level) const;
|
virtual void write_text(std::ostream &out, int indent_level) const;
|
||||||
|
|
||||||
INLINE bool is_standard() const;
|
INLINE bool is_standard() const;
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* A Bison parser, made by GNU Bison 2.4.2. */
|
/* A Bison parser, made by GNU Bison 2.4.2. */
|
||||||
|
|
||||||
/* Skeleton implementation for Bison's Yacc-like parsers in C
|
/* Skeleton implementation for Bison's Yacc-like parsers in C
|
||||||
|
|
||||||
Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
|
Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
|
||||||
Foundation, Inc.
|
Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
@ -27,7 +27,7 @@
|
|||||||
special exception, which will cause the skeleton and the resulting
|
special exception, which will cause the skeleton and the resulting
|
||||||
Bison output files to be licensed under the GNU General Public
|
Bison output files to be licensed under the GNU General Public
|
||||||
License without this special exception.
|
License without this special exception.
|
||||||
|
|
||||||
This special exception was added by the Free Software Foundation in
|
This special exception was added by the Free Software Foundation in
|
||||||
version 2.2 of Bison. */
|
version 2.2 of Bison. */
|
||||||
|
|
||||||
@ -96,8 +96,8 @@
|
|||||||
#define YYINITDEPTH 1000
|
#define YYINITDEPTH 1000
|
||||||
#define YYMAXDEPTH 1000
|
#define YYMAXDEPTH 1000
|
||||||
|
|
||||||
static XFile *x_file = (XFile *)NULL;
|
static XFile *x_file = nullptr;
|
||||||
static XFileNode *current_node = (XFileNode *)NULL;
|
static XFileNode *current_node = nullptr;
|
||||||
static PT(XFileDataDef) current_data_def;
|
static PT(XFileDataDef) current_data_def;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -113,8 +113,8 @@ x_init_parser(std::istream &in, const std::string &filename, XFile &file) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
x_cleanup_parser() {
|
x_cleanup_parser() {
|
||||||
x_file = (XFile *)NULL;
|
x_file = nullptr;
|
||||||
current_node = (XFileNode *)NULL;
|
current_node = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1576,7 +1576,7 @@ yyreduce:
|
|||||||
#line 172 "xParser.yxx"
|
#line 172 "xParser.yxx"
|
||||||
{
|
{
|
||||||
XFileTemplate *xtemplate = x_file->find_template((yyvsp[(1) - (3)].str));
|
XFileTemplate *xtemplate = x_file->find_template((yyvsp[(1) - (3)].str));
|
||||||
if (xtemplate == (XFileTemplate *)NULL) {
|
if (xtemplate == nullptr) {
|
||||||
yyerror("Unknown template: " + (yyvsp[(1) - (3)].str));
|
yyerror("Unknown template: " + (yyvsp[(1) - (3)].str));
|
||||||
} else {
|
} else {
|
||||||
current_data_def = new XFileDataDef(x_file, (yyvsp[(2) - (3)].str), XFileDataDef::T_template, xtemplate);
|
current_data_def = new XFileDataDef(x_file, (yyvsp[(2) - (3)].str), XFileDataDef::T_template, xtemplate);
|
||||||
@ -1700,7 +1700,7 @@ yyreduce:
|
|||||||
#line 237 "xParser.yxx"
|
#line 237 "xParser.yxx"
|
||||||
{
|
{
|
||||||
XFileTemplate *xtemplate = x_file->find_template((yyvsp[(1) - (2)].str));
|
XFileTemplate *xtemplate = x_file->find_template((yyvsp[(1) - (2)].str));
|
||||||
if (xtemplate == (XFileTemplate *)NULL) {
|
if (xtemplate == nullptr) {
|
||||||
yyerror("Unknown template: " + (yyvsp[(1) - (2)].str));
|
yyerror("Unknown template: " + (yyvsp[(1) - (2)].str));
|
||||||
} else {
|
} else {
|
||||||
current_data_def = new XFileDataDef(x_file, (yyvsp[(2) - (2)].str), XFileDataDef::T_template, xtemplate);
|
current_data_def = new XFileDataDef(x_file, (yyvsp[(2) - (2)].str), XFileDataDef::T_template, xtemplate);
|
||||||
@ -1724,7 +1724,7 @@ yyreduce:
|
|||||||
#line 263 "xParser.yxx"
|
#line 263 "xParser.yxx"
|
||||||
{
|
{
|
||||||
XFileNode *data_def = current_node->find_child((yyvsp[(1) - (1)].str));
|
XFileNode *data_def = current_node->find_child((yyvsp[(1) - (1)].str));
|
||||||
if (data_def == (XFileNode *)NULL) {
|
if (data_def == nullptr) {
|
||||||
yyerror("Unknown identifier: " + (yyvsp[(1) - (1)].str));
|
yyerror("Unknown identifier: " + (yyvsp[(1) - (1)].str));
|
||||||
} else {
|
} else {
|
||||||
current_data_def->add_array_def(XFileArrayDef(DCAST(XFileDataDef, data_def)));
|
current_data_def->add_array_def(XFileArrayDef(DCAST(XFileDataDef, data_def)));
|
||||||
@ -1754,7 +1754,7 @@ yyreduce:
|
|||||||
#line 284 "xParser.yxx"
|
#line 284 "xParser.yxx"
|
||||||
{
|
{
|
||||||
XFileTemplate *xtemplate = x_file->find_template((yyvsp[(1) - (1)].str));
|
XFileTemplate *xtemplate = x_file->find_template((yyvsp[(1) - (1)].str));
|
||||||
if (xtemplate == (XFileTemplate *)NULL) {
|
if (xtemplate == nullptr) {
|
||||||
yyerror("Unknown template: " + (yyvsp[(1) - (1)].str));
|
yyerror("Unknown template: " + (yyvsp[(1) - (1)].str));
|
||||||
} else {
|
} else {
|
||||||
DCAST(XFileTemplate, current_node)->add_option(xtemplate);
|
DCAST(XFileTemplate, current_node)->add_option(xtemplate);
|
||||||
@ -1768,7 +1768,7 @@ yyreduce:
|
|||||||
#line 293 "xParser.yxx"
|
#line 293 "xParser.yxx"
|
||||||
{
|
{
|
||||||
XFileTemplate *xtemplate = x_file->find_template((yyvsp[(2) - (2)].guid));
|
XFileTemplate *xtemplate = x_file->find_template((yyvsp[(2) - (2)].guid));
|
||||||
if (xtemplate == (XFileTemplate *)NULL) {
|
if (xtemplate == nullptr) {
|
||||||
yyerror("Unknown template: " + (yyvsp[(1) - (2)].str));
|
yyerror("Unknown template: " + (yyvsp[(1) - (2)].str));
|
||||||
} else {
|
} else {
|
||||||
if (xtemplate->get_name() != (yyvsp[(1) - (2)].str)) {
|
if (xtemplate->get_name() != (yyvsp[(1) - (2)].str)) {
|
||||||
@ -1823,11 +1823,11 @@ yyreduce:
|
|||||||
{
|
{
|
||||||
XFileTemplate *xtemplate = x_file->find_template((yyvsp[(1) - (3)].str));
|
XFileTemplate *xtemplate = x_file->find_template((yyvsp[(1) - (3)].str));
|
||||||
(yyval.u.node) = current_node;
|
(yyval.u.node) = current_node;
|
||||||
|
|
||||||
if (xtemplate == (XFileTemplate *)NULL) {
|
if (xtemplate == nullptr) {
|
||||||
yyerror("Unknown template: " + (yyvsp[(1) - (3)].str));
|
yyerror("Unknown template: " + (yyvsp[(1) - (3)].str));
|
||||||
} else {
|
} else {
|
||||||
XFileDataNodeTemplate *templ =
|
XFileDataNodeTemplate *templ =
|
||||||
new XFileDataNodeTemplate(x_file, (yyvsp[(2) - (3)].str), xtemplate);
|
new XFileDataNodeTemplate(x_file, (yyvsp[(2) - (3)].str), xtemplate);
|
||||||
current_node->add_child(templ);
|
current_node->add_child(templ);
|
||||||
current_node = templ;
|
current_node = templ;
|
||||||
@ -1841,7 +1841,7 @@ yyreduce:
|
|||||||
#line 363 "xParser.yxx"
|
#line 363 "xParser.yxx"
|
||||||
{
|
{
|
||||||
if (current_node->is_exact_type(XFileDataNodeTemplate::get_class_type())) {
|
if (current_node->is_exact_type(XFileDataNodeTemplate::get_class_type())) {
|
||||||
XFileDataNodeTemplate *current_template =
|
XFileDataNodeTemplate *current_template =
|
||||||
DCAST(XFileDataNodeTemplate, current_node);
|
DCAST(XFileDataNodeTemplate, current_node);
|
||||||
current_template->finalize_parse_data();
|
current_template->finalize_parse_data();
|
||||||
}
|
}
|
||||||
@ -1876,7 +1876,7 @@ yyreduce:
|
|||||||
#line 391 "xParser.yxx"
|
#line 391 "xParser.yxx"
|
||||||
{
|
{
|
||||||
if (current_node->is_exact_type(XFileDataNodeTemplate::get_class_type())) {
|
if (current_node->is_exact_type(XFileDataNodeTemplate::get_class_type())) {
|
||||||
XFileDataNodeTemplate *current_template =
|
XFileDataNodeTemplate *current_template =
|
||||||
DCAST(XFileDataNodeTemplate, current_node);
|
DCAST(XFileDataNodeTemplate, current_node);
|
||||||
current_template->add_parse_int((yyvsp[(1) - (1)].int_list));
|
current_template->add_parse_int((yyvsp[(1) - (1)].int_list));
|
||||||
}
|
}
|
||||||
@ -1889,7 +1889,7 @@ yyreduce:
|
|||||||
#line 399 "xParser.yxx"
|
#line 399 "xParser.yxx"
|
||||||
{
|
{
|
||||||
if (current_node->is_exact_type(XFileDataNodeTemplate::get_class_type())) {
|
if (current_node->is_exact_type(XFileDataNodeTemplate::get_class_type())) {
|
||||||
XFileDataNodeTemplate *current_template =
|
XFileDataNodeTemplate *current_template =
|
||||||
DCAST(XFileDataNodeTemplate, current_node);
|
DCAST(XFileDataNodeTemplate, current_node);
|
||||||
current_template->add_parse_double((yyvsp[(1) - (1)].double_list));
|
current_template->add_parse_double((yyvsp[(1) - (1)].double_list));
|
||||||
}
|
}
|
||||||
@ -1902,7 +1902,7 @@ yyreduce:
|
|||||||
#line 407 "xParser.yxx"
|
#line 407 "xParser.yxx"
|
||||||
{
|
{
|
||||||
if (current_node->is_exact_type(XFileDataNodeTemplate::get_class_type())) {
|
if (current_node->is_exact_type(XFileDataNodeTemplate::get_class_type())) {
|
||||||
XFileDataNodeTemplate *current_template =
|
XFileDataNodeTemplate *current_template =
|
||||||
DCAST(XFileDataNodeTemplate, current_node);
|
DCAST(XFileDataNodeTemplate, current_node);
|
||||||
current_template->add_parse_string((yyvsp[(1) - (2)].str));
|
current_template->add_parse_string((yyvsp[(1) - (2)].str));
|
||||||
}
|
}
|
||||||
@ -1923,7 +1923,7 @@ yyreduce:
|
|||||||
#line 438 "xParser.yxx"
|
#line 438 "xParser.yxx"
|
||||||
{
|
{
|
||||||
XFileDataNodeTemplate *data_object = x_file->find_data_object((yyvsp[(1) - (1)].str));
|
XFileDataNodeTemplate *data_object = x_file->find_data_object((yyvsp[(1) - (1)].str));
|
||||||
if (data_object == (XFileDataObject *)NULL) {
|
if (data_object == nullptr) {
|
||||||
yyerror("Unknown data_object: " + (yyvsp[(1) - (1)].str));
|
yyerror("Unknown data_object: " + (yyvsp[(1) - (1)].str));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1937,7 +1937,7 @@ yyreduce:
|
|||||||
#line 447 "xParser.yxx"
|
#line 447 "xParser.yxx"
|
||||||
{
|
{
|
||||||
XFileDataNodeTemplate *data_object = x_file->find_data_object((yyvsp[(2) - (2)].guid));
|
XFileDataNodeTemplate *data_object = x_file->find_data_object((yyvsp[(2) - (2)].guid));
|
||||||
if (data_object == (XFileDataObject *)NULL) {
|
if (data_object == nullptr) {
|
||||||
yyerror("Unknown data_object: " + (yyvsp[(1) - (2)].str));
|
yyerror("Unknown data_object: " + (yyvsp[(1) - (2)].str));
|
||||||
} else {
|
} else {
|
||||||
if (data_object->get_name() != (yyvsp[(1) - (2)].str)) {
|
if (data_object->get_name() != (yyvsp[(1) - (2)].str)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user