mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
More compatibility with exotic compilers (yes, I actually tried to port Panda to clang)
This commit is contained in:
parent
6418e6f221
commit
102b46878e
@ -95,6 +95,8 @@
|
||||
#define _WIN32_WINNT 0x0502
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
#undef _POSIX_C_SOURCE
|
||||
#undef _XOPEN_SOURCE
|
||||
#include "pyconfig.h"
|
||||
#endif
|
||||
|
||||
|
@ -42,7 +42,7 @@ Filename(const char *filename) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE Filename::
|
||||
Filename(const Filename ©) :
|
||||
_filename(copy._filename),
|
||||
_filename(copy._filename.c_str()),
|
||||
_dirname_end(copy._dirname_end),
|
||||
_basename_start(copy._basename_start),
|
||||
_basename_end(copy._basename_end),
|
||||
@ -269,7 +269,7 @@ operator + (const string &other) const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE string Filename::
|
||||
get_fullpath() const {
|
||||
return _filename;
|
||||
return _filename.c_str();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
@ -1198,7 +1198,7 @@ to_os_specific() const {
|
||||
return convert_pathname(standard.get_fullpath());
|
||||
}
|
||||
#else // WIN32
|
||||
return standard;
|
||||
return standard.c_str();
|
||||
#endif // WIN32
|
||||
}
|
||||
|
||||
@ -2432,7 +2432,7 @@ touch() const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool Filename::
|
||||
chdir() const {
|
||||
Filename os_specific = to_os_specific();
|
||||
string os_specific = to_os_specific();
|
||||
return (::chdir(os_specific.c_str()) >= 0);
|
||||
}
|
||||
|
||||
|
@ -590,6 +590,9 @@ do_remove(AsyncTask *task) {
|
||||
removed = true;
|
||||
cleanup_task(task, false, false);
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return removed;
|
||||
|
@ -104,7 +104,7 @@ p() const {
|
||||
template<class T>
|
||||
INLINE PointerTo<T> &PointerTo<T>::
|
||||
operator = (To *ptr) {
|
||||
reassign(ptr);
|
||||
this->reassign(ptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ operator = (To *ptr) {
|
||||
template<class T>
|
||||
INLINE PointerTo<T> &PointerTo<T>::
|
||||
operator = (const PointerTo<T> ©) {
|
||||
reassign((const PointerToBase<T> &)copy);
|
||||
this->reassign((const PointerToBase<T> &)copy);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -226,7 +226,7 @@ p() const {
|
||||
template<class T>
|
||||
INLINE ConstPointerTo<T> &ConstPointerTo<T>::
|
||||
operator = (const To *ptr) {
|
||||
reassign((To *)ptr);
|
||||
this->reassign((To *)ptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ operator = (const To *ptr) {
|
||||
template<class T>
|
||||
INLINE ConstPointerTo<T> &ConstPointerTo<T>::
|
||||
operator = (const PointerTo<T> ©) {
|
||||
reassign((const PointerToBase<T> &)copy);
|
||||
this->reassign((const PointerToBase<T> &)copy);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -250,6 +250,6 @@ operator = (const PointerTo<T> ©) {
|
||||
template<class T>
|
||||
INLINE ConstPointerTo<T> &ConstPointerTo<T>::
|
||||
operator = (const ConstPointerTo<T> ©) {
|
||||
reassign((const PointerToBase<T> &)copy);
|
||||
this->reassign((const PointerToBase<T> &)copy);
|
||||
return *this;
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ template<class Element>
|
||||
INLINE void PointerToArray<Element>::
|
||||
reserve(TYPENAME PointerToArray<Element>::size_type n) {
|
||||
if ((this->_void_ptr) == NULL) {
|
||||
reassign(new ReferenceCountedVector<Element>(_type_handle));
|
||||
((PointerToArray<Element> *)this)->reassign(new ReferenceCountedVector<Element>(_type_handle));
|
||||
}
|
||||
((To *)(this->_void_ptr))->reserve(n);
|
||||
}
|
||||
@ -263,7 +263,7 @@ template<class Element>
|
||||
INLINE void PointerToArray<Element>::
|
||||
resize(TYPENAME PointerToArray<Element>::size_type n) {
|
||||
if ((this->_void_ptr) == NULL) {
|
||||
reassign(new ReferenceCountedVector<Element>(_type_handle));
|
||||
((PointerToArray<Element> *)this)->reassign(new ReferenceCountedVector<Element>(_type_handle));
|
||||
}
|
||||
((To *)(this->_void_ptr))->resize(n);
|
||||
}
|
||||
@ -323,7 +323,7 @@ template<class Element>
|
||||
INLINE TYPENAME PointerToArray<Element>::iterator PointerToArray<Element>::
|
||||
insert(iterator position, const Element &x) {
|
||||
if ((this->_void_ptr) == NULL) {
|
||||
reassign(new ReferenceCountedVector<Element>(_type_handle));
|
||||
((PointerToArray<Element> *)this)->reassign(new ReferenceCountedVector<Element>(_type_handle));
|
||||
position = end();
|
||||
}
|
||||
nassertr(position >= ((To *)(this->_void_ptr))->begin() &&
|
||||
@ -340,7 +340,7 @@ template<class Element>
|
||||
INLINE void PointerToArray<Element>::
|
||||
insert(iterator position, size_type n, const Element &x) {
|
||||
if ((this->_void_ptr) == NULL) {
|
||||
reassign(new ReferenceCountedVector<Element>(_type_handle));
|
||||
((PointerToArray<Element> *)this)->reassign(new ReferenceCountedVector<Element>(_type_handle));
|
||||
position = end();
|
||||
}
|
||||
nassertv(position >= ((To *)(this->_void_ptr))->begin() &&
|
||||
@ -416,7 +416,7 @@ template<class Element>
|
||||
INLINE void PointerToArray<Element>::
|
||||
push_back(const Element &x) {
|
||||
if ((this->_void_ptr) == NULL) {
|
||||
reassign(new ReferenceCountedVector<Element>(_type_handle));
|
||||
((PointerToArray<Element> *)this)->reassign(new ReferenceCountedVector<Element>(_type_handle));
|
||||
}
|
||||
((To *)(this->_void_ptr))->push_back(x);
|
||||
}
|
||||
@ -676,7 +676,7 @@ get_void_ptr() const {
|
||||
template<class Element>
|
||||
INLINE void PointerToArray<Element>::
|
||||
set_void_ptr(void *p) {
|
||||
reassign((To *)p);
|
||||
((PointerToArray<Element> *)this)->reassign((To *)p);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -735,7 +735,7 @@ node_unref() const {
|
||||
template<class Element>
|
||||
INLINE PointerToArray<Element> &PointerToArray<Element>::
|
||||
operator = (ReferenceCountedVector<Element> *ptr) {
|
||||
reassign(ptr);
|
||||
((PointerToArray<Element> *)this)->reassign(ptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -748,7 +748,7 @@ template<class Element>
|
||||
INLINE PointerToArray<Element> &PointerToArray<Element>::
|
||||
operator = (const PointerToArray<Element> ©) {
|
||||
_type_handle = copy._type_handle;
|
||||
reassign(copy);
|
||||
((PointerToArray<Element> *)this)->reassign(copy);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -762,7 +762,7 @@ operator = (const PointerToArray<Element> ©) {
|
||||
template<class Element>
|
||||
INLINE void PointerToArray<Element>::
|
||||
clear() {
|
||||
reassign((ReferenceCountedVector<Element> *)NULL);
|
||||
((PointerToArray<Element> *)this)->reassign((ReferenceCountedVector<Element> *)NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -1167,7 +1167,7 @@ node_unref() const {
|
||||
template<class Element>
|
||||
INLINE ConstPointerToArray<Element> &ConstPointerToArray<Element>::
|
||||
operator = (ReferenceCountedVector<Element> *ptr) {
|
||||
reassign(ptr);
|
||||
((ConstPointerToArray<Element> *)this)->reassign(ptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1180,7 +1180,7 @@ template<class Element>
|
||||
INLINE ConstPointerToArray<Element> &ConstPointerToArray<Element>::
|
||||
operator = (const PointerToArray<Element> ©) {
|
||||
_type_handle = copy._type_handle;
|
||||
reassign(copy);
|
||||
((ConstPointerToArray<Element> *)this)->reassign(copy);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1193,7 +1193,7 @@ template<class Element>
|
||||
INLINE ConstPointerToArray<Element> &ConstPointerToArray<Element>::
|
||||
operator = (const ConstPointerToArray<Element> ©) {
|
||||
_type_handle = copy._type_handle;
|
||||
reassign(copy);
|
||||
((ConstPointerToArray<Element> *)this)->reassign(copy);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1207,7 +1207,7 @@ operator = (const ConstPointerToArray<Element> ©) {
|
||||
template<class Element>
|
||||
INLINE void ConstPointerToArray<Element>::
|
||||
clear() {
|
||||
reassign((ReferenceCountedVector<Element> *)NULL);
|
||||
((ConstPointerToArray<Element> *)this)->reassign((ReferenceCountedVector<Element> *)NULL);
|
||||
}
|
||||
|
||||
#endif // CPPPARSER
|
||||
|
@ -122,7 +122,7 @@ get_orig() const {
|
||||
template<class T>
|
||||
INLINE WeakPointerTo<T> &WeakPointerTo<T>::
|
||||
operator = (To *ptr) {
|
||||
reassign(ptr);
|
||||
((WeakPointerTo<T> *)this)->reassign(ptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ operator = (To *ptr) {
|
||||
template<class T>
|
||||
INLINE WeakPointerTo<T> &WeakPointerTo<T>::
|
||||
operator = (const PointerTo<T> ©) {
|
||||
reassign((const PointerToBase<T> &)copy);
|
||||
((WeakPointerTo<T> *)this)->reassign((const PointerToBase<T> &)copy);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ operator = (const PointerTo<T> ©) {
|
||||
template<class T>
|
||||
INLINE WeakPointerTo<T> &WeakPointerTo<T>::
|
||||
operator = (const WeakPointerTo<T> ©) {
|
||||
reassign((const PointerToBase<T> &)copy);
|
||||
((WeakPointerTo<T> *)this)->reassign((const PointerToBase<T> &)copy);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -286,7 +286,7 @@ get_orig() const {
|
||||
template<class T>
|
||||
INLINE WeakConstPointerTo<T> &WeakConstPointerTo<T>::
|
||||
operator = (const To *ptr) {
|
||||
reassign((To *)ptr);
|
||||
((WeakConstPointerTo<T> *)this)->reassign((To *)ptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -298,7 +298,7 @@ operator = (const To *ptr) {
|
||||
template<class T>
|
||||
INLINE WeakConstPointerTo<T> &WeakConstPointerTo<T>::
|
||||
operator = (const PointerTo<T> ©) {
|
||||
reassign((const PointerToBase<T> &)copy);
|
||||
((WeakConstPointerTo<T> *)this)->reassign((const PointerToBase<T> &)copy);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -310,7 +310,7 @@ operator = (const PointerTo<T> ©) {
|
||||
template<class T>
|
||||
INLINE WeakConstPointerTo<T> &WeakConstPointerTo<T>::
|
||||
operator = (const ConstPointerTo<T> ©) {
|
||||
reassign((const PointerToBase<T> &)copy);
|
||||
((WeakConstPointerTo<T> *)this)->reassign((const PointerToBase<T> &)copy);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -322,7 +322,7 @@ operator = (const ConstPointerTo<T> ©) {
|
||||
template<class T>
|
||||
INLINE WeakConstPointerTo<T> &WeakConstPointerTo<T>::
|
||||
operator = (const WeakPointerTo<T> ©) {
|
||||
reassign((const PointerToBase<T> &)copy);
|
||||
((WeakConstPointerTo<T> *)this)->reassign((const PointerToBase<T> &)copy);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -334,6 +334,6 @@ operator = (const WeakPointerTo<T> ©) {
|
||||
template<class T>
|
||||
INLINE WeakConstPointerTo<T> &WeakConstPointerTo<T>::
|
||||
operator = (const WeakConstPointerTo<T> ©) {
|
||||
reassign((const PointerToBase<T> &)copy);
|
||||
((WeakConstPointerTo<T> *)this)->assign((const PointerToBase<T> &)copy);
|
||||
return *this;
|
||||
}
|
||||
|
@ -203,8 +203,7 @@ cp_errchk_parameter_float(ShaderArgInfo &p, int lo, int hi)
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool Shader::
|
||||
cp_errchk_parameter_ptr(ShaderArgInfo &p)
|
||||
{
|
||||
cp_errchk_parameter_ptr(ShaderArgInfo &p) {
|
||||
switch (p._class) {
|
||||
case SAC_scalar: return true;
|
||||
case SAC_vector: return true;
|
||||
@ -1342,6 +1341,10 @@ cg_compile_entry_point(const char *entry, const ShaderCaps &caps, ShaderType typ
|
||||
active = caps._active_gprofile;
|
||||
ultimate = caps._ultimate_gprofile;
|
||||
break;
|
||||
|
||||
case ST_none:
|
||||
active = CG_PROFILE_UNKNOWN;
|
||||
ultimate = CG_PROFILE_UNKNOWN;
|
||||
};
|
||||
|
||||
cgGetError();
|
||||
@ -1662,7 +1665,7 @@ cg_analyze_shader(const ShaderCaps &caps) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
CGprogram Shader::
|
||||
cg_program_from_shadertype(ShaderType type) {
|
||||
CGprogram prog = 0;
|
||||
CGprogram prog;
|
||||
|
||||
switch (type) {
|
||||
case ST_vertex:
|
||||
@ -1676,6 +1679,9 @@ cg_program_from_shadertype(ShaderType type) {
|
||||
case ST_geometry:
|
||||
prog = _cg_gprogram;
|
||||
break;
|
||||
|
||||
default:
|
||||
prog = 0;
|
||||
};
|
||||
|
||||
return prog;
|
||||
|
@ -611,6 +611,9 @@ estimate_texture_memory() const {
|
||||
case Texture::F_rgba32:
|
||||
bpp = 16;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
size_t bytes = pixels * bpp;
|
||||
@ -1377,6 +1380,9 @@ write(ostream &out, int indent_level) const {
|
||||
case T_float:
|
||||
out << " floats";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
out << ", ";
|
||||
@ -1390,6 +1396,15 @@ write(ostream &out, int indent_level) const {
|
||||
case F_depth_component:
|
||||
out << "depth_component";
|
||||
break;
|
||||
case F_depth_component16:
|
||||
out << "depth_component16";
|
||||
break;
|
||||
case F_depth_component24:
|
||||
out << "depth_component24";
|
||||
break;
|
||||
case F_depth_component32:
|
||||
out << "depth_component32";
|
||||
break;
|
||||
|
||||
case F_rgba:
|
||||
out << "rgba";
|
||||
@ -3539,6 +3554,9 @@ do_compress_ram_image(Texture::CompressionMode compression,
|
||||
case CM_dxt5:
|
||||
squish_flags |= squish::kDxt5;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (squish_flags != 0) {
|
||||
@ -3557,6 +3575,9 @@ do_compress_ram_image(Texture::CompressionMode compression,
|
||||
case QL_best:
|
||||
squish_flags |= squish::kColourIterativeClusterFit;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (do_squish(compression, squish_flags)) {
|
||||
@ -3592,6 +3613,9 @@ do_uncompress_ram_image() {
|
||||
case CM_dxt5:
|
||||
squish_flags |= squish::kDxt5;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (squish_flags != 0) {
|
||||
@ -3896,6 +3920,9 @@ do_set_format(Texture::Format format) {
|
||||
case F_color_index:
|
||||
case F_depth_stencil:
|
||||
case F_depth_component:
|
||||
case F_depth_component16:
|
||||
case F_depth_component24:
|
||||
case F_depth_component32:
|
||||
case F_red:
|
||||
case F_green:
|
||||
case F_blue:
|
||||
@ -3951,6 +3978,10 @@ do_set_component_type(Texture::ComponentType component_type) {
|
||||
case T_float:
|
||||
_component_width = 4;
|
||||
break;
|
||||
|
||||
case T_unsigned_int_24_8:
|
||||
//FIXME: I have no idea...
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6356,6 +6387,8 @@ operator << (ostream &out, Texture::ComponentType ct) {
|
||||
return out << "unsigned_short";
|
||||
case Texture::T_float:
|
||||
return out << "float";
|
||||
case Texture::T_unsigned_int_24_8:
|
||||
return out << "unsigned_int_24_8";
|
||||
}
|
||||
|
||||
return out << "(**invalid Texture::ComponentType(" << (int)ct << ")**)";
|
||||
@ -6372,6 +6405,12 @@ operator << (ostream &out, Texture::Format f) {
|
||||
return out << "depth_stencil";
|
||||
case Texture::F_depth_component:
|
||||
return out << "depth_component";
|
||||
case Texture::F_depth_component16:
|
||||
return out << "depth_component16";
|
||||
case Texture::F_depth_component24:
|
||||
return out << "depth_component24";
|
||||
case Texture::F_depth_component32:
|
||||
return out << "depth_component32";
|
||||
case Texture::F_color_index:
|
||||
return out << "color_index";
|
||||
case Texture::F_red:
|
||||
|
@ -86,7 +86,7 @@ TexturePeeker(Texture *tex) {
|
||||
_get_component = Texture::get_unsigned_short;
|
||||
break;
|
||||
|
||||
case Texture::T_float:
|
||||
default:
|
||||
// Not supported.
|
||||
_image.clear();
|
||||
return;
|
||||
@ -95,10 +95,6 @@ TexturePeeker(Texture *tex) {
|
||||
switch (_format) {
|
||||
case Texture::F_depth_stencil:
|
||||
case Texture::F_depth_component:
|
||||
case Texture::F_color_index:
|
||||
// Not supported.
|
||||
_image.clear();
|
||||
return;
|
||||
|
||||
case Texture::F_red:
|
||||
_get_texel = get_texel_r;
|
||||
@ -143,6 +139,10 @@ TexturePeeker(Texture *tex) {
|
||||
case Texture::F_rgba32:
|
||||
_get_texel = get_texel_rgba;
|
||||
break;
|
||||
default:
|
||||
// Not supported.
|
||||
_image.clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user