Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
b350d18e9d
|
|
@ -24,7 +24,7 @@ Installing Panda3D
|
|||
==================
|
||||
|
||||
The latest Panda3D SDK can be downloaded from
|
||||
[this page](https://www.panda3d.org/download/sdk-1-10-12/).
|
||||
[this page](https://www.panda3d.org/download/sdk-1-10-13/).
|
||||
If you are familiar with installing Python packages, you can use
|
||||
the following command:
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ import time
|
|||
import sys
|
||||
|
||||
|
||||
class NotifierException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class Notifier:
|
||||
serverDelta = 0
|
||||
|
||||
|
|
@ -116,7 +120,7 @@ class Notifier:
|
|||
return NSError
|
||||
|
||||
# error funcs
|
||||
def error(self, errorString, exception=Exception):
|
||||
def error(self, errorString, exception=NotifierException):
|
||||
"""
|
||||
Raise an exception with given string and optional type:
|
||||
Exception: error
|
||||
|
|
|
|||
|
|
@ -1720,9 +1720,10 @@ class bdist_apps(setuptools.Command):
|
|||
optval = getattr(self, opt)
|
||||
if optval is not None:
|
||||
setattr(build_cmd, opt, optval)
|
||||
build_cmd.finalize_options()
|
||||
if not self.skip_build:
|
||||
self.run_command('build_apps')
|
||||
else:
|
||||
build_cmd.finalize_options()
|
||||
|
||||
platforms = build_cmd.platforms
|
||||
build_base = os.path.abspath(build_cmd.build_base)
|
||||
|
|
|
|||
|
|
@ -605,7 +605,8 @@ flush() {
|
|||
|
||||
#ifdef HAVE_OPENSSL
|
||||
if (_http_conn) {
|
||||
return _http_conn->flush();
|
||||
_http_conn->flush();
|
||||
return !_http_conn->is_closed();
|
||||
}
|
||||
#endif // HAVE_OPENSSL
|
||||
|
||||
|
|
|
|||
|
|
@ -487,11 +487,15 @@ class ShowBase(DirectObject.DirectObject):
|
|||
DGG.setDefaultClickSound(self.loader.loadSfx("audio/sfx/GUI_click.wav"))
|
||||
DGG.setDefaultRolloverSound(self.loader.loadSfx("audio/sfx/GUI_rollover.wav"))
|
||||
|
||||
# Create a private DirectObject - allowing base.accept for window-event
|
||||
# as well as allowing ShowBase's default handling of this.
|
||||
self.__directObject = DirectObject.DirectObject()
|
||||
|
||||
# Now hang a hook on the window-event from Panda. This allows
|
||||
# us to detect when the user resizes, minimizes, or closes the
|
||||
# main window.
|
||||
self.__prevWindowProperties = None
|
||||
self.accept('window-event', self.windowEvent)
|
||||
self.__directObject.accept('window-event', self.windowEvent)
|
||||
|
||||
# Transition effects (fade, iris, etc)
|
||||
from . import Transitions
|
||||
|
|
@ -579,7 +583,17 @@ class ShowBase(DirectObject.DirectObject):
|
|||
exitfunc and will be called at application exit time
|
||||
automatically.
|
||||
|
||||
This function is designed to be safe to call multiple times."""
|
||||
This function is designed to be safe to call multiple times.
|
||||
|
||||
When called from a thread other than the main thread, this will create
|
||||
a task to schedule the destroy on the main thread, and wait for this to
|
||||
complete.
|
||||
"""
|
||||
|
||||
if Thread.getCurrentThread() != Thread.getMainThread():
|
||||
task = taskMgr.add(self.destroy, extraArgs=[])
|
||||
task.wait()
|
||||
return
|
||||
|
||||
for cb in self.finalExitCallbacks[:]:
|
||||
cb()
|
||||
|
|
@ -2579,9 +2593,9 @@ class ShowBase(DirectObject.DirectObject):
|
|||
self.oobeVis.setLightOff(1)
|
||||
self.oobeCullFrustum = None
|
||||
|
||||
self.accept('oobe-down', self.__oobeButton, extraArgs = [''])
|
||||
self.accept('oobe-repeat', self.__oobeButton, extraArgs = ['-repeat'])
|
||||
self.accept('oobe-up', self.__oobeButton, extraArgs = ['-up'])
|
||||
self.__directObject.accept('oobe-down', self.__oobeButton, extraArgs = [''])
|
||||
self.__directObject.accept('oobe-repeat', self.__oobeButton, extraArgs = ['-repeat'])
|
||||
self.__directObject.accept('oobe-up', self.__oobeButton, extraArgs = ['-up'])
|
||||
|
||||
if self.oobeMode:
|
||||
# Disable OOBE mode.
|
||||
|
|
@ -3332,7 +3346,13 @@ class ShowBase(DirectObject.DirectObject):
|
|||
not running from within a p3d file. When we *are* within a p3d
|
||||
file, the Panda3D runtime has to be responsible for running the
|
||||
main loop, so we can't allow the application to do it.
|
||||
|
||||
This method must be called from the main thread, otherwise an error is
|
||||
thrown.
|
||||
"""
|
||||
if Thread.getCurrentThread() != Thread.getMainThread():
|
||||
self.notify.error("run() must be called from the main thread.")
|
||||
return
|
||||
|
||||
if self.appRunner is None or self.appRunner.dummy or \
|
||||
(self.appRunner.interactiveConsole and not self.appRunner.initialAppImport):
|
||||
|
|
|
|||
|
|
@ -53,16 +53,16 @@
|
|||
#ifdef _WIN32
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#endif
|
||||
#endif // !NOMINMAX
|
||||
#endif // _WIN32
|
||||
|
||||
#ifndef __has_builtin
|
||||
#define __has_builtin(x) 0
|
||||
#endif
|
||||
#endif // !__has_builtin
|
||||
|
||||
#ifndef __has_attribute
|
||||
#define __has_attribute(x) 0
|
||||
#endif
|
||||
#endif // !__has_attribute
|
||||
|
||||
// Use NODEFAULT to optimize a switch() stmt to tell MSVC to automatically go
|
||||
// to the final untested case after it has failed all the other cases (i.e.
|
||||
|
|
@ -73,30 +73,30 @@
|
|||
#define NODEFAULT default: __builtin_unreachable();
|
||||
#elif defined(_MSC_VER)
|
||||
#define NODEFAULT default: __assume(0); // special VC keyword
|
||||
#else
|
||||
#else // NODEFAULT
|
||||
#define NODEFAULT
|
||||
#endif
|
||||
#endif // NODEFAULT
|
||||
|
||||
// Use this to hint the compiler that a memory address is aligned.
|
||||
#if __has_builtin(__builtin_assume_aligned) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
|
||||
#define ASSUME_ALIGNED(x, y) (__builtin_assume_aligned(x, y))
|
||||
#else
|
||||
#else // ASSUME_ALIGNED
|
||||
#define ASSUME_ALIGNED(x, y) (x)
|
||||
#endif
|
||||
#endif // ASSUME_ALIGNED
|
||||
|
||||
#if __has_attribute(assume_aligned) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)
|
||||
#define RETURNS_ALIGNED(x) __attribute__((assume_aligned(x)))
|
||||
#else
|
||||
#else // RETURNS_ALIGNED
|
||||
#define RETURNS_ALIGNED(x)
|
||||
#endif
|
||||
#endif // RETURNS_ALIGNED
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define LIKELY(x) __builtin_expect(!!(x), 1)
|
||||
#define UNLIKELY(x) __builtin_expect(!!(x), 0)
|
||||
#else
|
||||
#else // LIKELY/UNLIKELY
|
||||
#define LIKELY(x) (x)
|
||||
#define UNLIKELY(x) (x)
|
||||
#endif
|
||||
#endif // LIKELY/UNLIKELY
|
||||
|
||||
/*
|
||||
include win32 defns for everything up to WinServer2003, and assume
|
||||
|
|
@ -105,17 +105,17 @@
|
|||
*/
|
||||
#ifdef _WIN32_WINNT
|
||||
#undef _WIN32_WINNT
|
||||
#endif
|
||||
#endif // _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0600
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS
|
||||
#endif
|
||||
#endif // !__STDC_LIMIT_MACROS
|
||||
#ifndef __STDC_CONSTANT_MACROS
|
||||
#define __STDC_CONSTANT_MACROS
|
||||
#endif
|
||||
#endif
|
||||
#endif // !__STDC_CONSTANT_MACROS
|
||||
#endif // __cplusplus
|
||||
|
||||
// This is a workaround for a glibc bug that is triggered by clang when
|
||||
// compiling with -ffast-math.
|
||||
|
|
@ -123,8 +123,8 @@
|
|||
#include <sys/cdefs.h>
|
||||
#ifndef __extern_always_inline
|
||||
#define __extern_always_inline extern __always_inline
|
||||
#endif
|
||||
#endif
|
||||
#endif // !__extern_always_inline
|
||||
#endif // __clang__ && __GLIBC__
|
||||
|
||||
// Instead of including the Python headers, which will implicitly add a linker
|
||||
// flag to link in Python, we'll just excerpt the forward declaration of
|
||||
|
|
@ -134,7 +134,7 @@ typedef struct _object PyObject;
|
|||
#ifndef HAVE_EIGEN
|
||||
// If we don't have the Eigen library, don't define LINMATH_ALIGN.
|
||||
#undef LINMATH_ALIGN
|
||||
#endif
|
||||
#endif // !HAVE_EIGEN
|
||||
|
||||
#include "dtoolsymbols.h"
|
||||
|
||||
|
|
@ -146,73 +146,75 @@ typedef struct _object PyObject;
|
|||
// headers
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#define _LARGEFILE_SOURCE 1
|
||||
#endif
|
||||
#endif // __GNUC__
|
||||
|
||||
#ifdef PHAVE_TYPES_H
|
||||
#include <types.h>
|
||||
#endif
|
||||
#endif // PHAVE_TYPES_H
|
||||
|
||||
#ifdef PHAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#endif // PHAVE_SYS_TYPES_H
|
||||
|
||||
#ifdef PHAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#endif // PHAVE_MALLOC_H
|
||||
|
||||
#ifdef PHAVE_SYS_MALLOC_H
|
||||
#include <sys/malloc.h>
|
||||
#endif
|
||||
#endif // PHAVE_SYS_MALLOC_H
|
||||
|
||||
#ifdef PHAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
#endif // PHAVE_ALLOCA_H
|
||||
|
||||
#ifdef PHAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif // PHAVE_UNISTD_H
|
||||
|
||||
#ifdef PHAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif
|
||||
#endif // PHAVE_IO_H
|
||||
|
||||
#ifdef PHAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#endif
|
||||
#endif // PHAVE_LOCALE_H
|
||||
|
||||
#ifdef PHAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#endif // PHAVE_STRING_H
|
||||
|
||||
#ifdef PHAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#endif // PHAVE_STDLIB_H
|
||||
|
||||
#ifdef PHAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
#endif // PHAVE_LIMITS_H
|
||||
|
||||
#ifdef PHAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#endif // PHAVE_SYS_TIME_H
|
||||
|
||||
#ifdef PHAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#endif // PHAVE_STDINT_H
|
||||
|
||||
#ifdef CPPPARSER
|
||||
#include <stdtypedefs.h>
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
// Also pick up the forward declaration of PyObject.
|
||||
#include <Python.h>
|
||||
#endif
|
||||
#endif // HAVE_PYTHON
|
||||
#endif // CPPPARSER
|
||||
|
||||
#ifdef USE_TAU
|
||||
/* If we're building with the Tau instrumentor, include the
|
||||
appropriate header file to pick up the TAU macros. */
|
||||
#include <TAU.h>
|
||||
#include <Profile/Profiler.h>
|
||||
#else
|
||||
#else // USE_TAU
|
||||
/* Otherwise, if we're not building with the Tau instrumentor, turn
|
||||
off all the TAU macros. We could include the Tau header file to do
|
||||
this, but it's better not to assume that Tau is installed. */
|
||||
|
|
@ -324,7 +326,7 @@ typedef struct _object PyObject;
|
|||
#undef WORDS_BIGENDIAN
|
||||
#define WORDS_BIGENDIAN 1
|
||||
|
||||
#endif
|
||||
#endif // WORDS_BIGENDIAN
|
||||
|
||||
/* Try to determine if we're compiling in a 64-bit mode. */
|
||||
|
||||
|
|
@ -332,9 +334,9 @@ typedef struct _object PyObject;
|
|||
#define NATIVE_WORDSIZE __WORDSIZE
|
||||
#elif defined(_LP64) || defined(_WIN64)
|
||||
#define NATIVE_WORDSIZE 64
|
||||
#else
|
||||
#else // __WORDSIZE
|
||||
#define NATIVE_WORDSIZE 32
|
||||
#endif
|
||||
#endif // __WORDSIZE
|
||||
|
||||
/* Some byte-alignment macros. */
|
||||
#ifdef CPPPARSER
|
||||
|
|
@ -355,13 +357,13 @@ typedef struct _object PyObject;
|
|||
#define ALIGN_16BYTE __attribute__ ((aligned (16)))
|
||||
#define ALIGN_32BYTE __attribute__ ((aligned (32)))
|
||||
#define ALIGN_64BYTE __attribute__ ((aligned (64)))
|
||||
#else
|
||||
#else // ALIGN_*
|
||||
#define ALIGN_4BYTE
|
||||
#define ALIGN_8BYTE
|
||||
#define ALIGN_16BYTE
|
||||
#define ALIGN_32BYTE
|
||||
#define ALIGN_64BYTE
|
||||
#endif
|
||||
#endif // ALIGN_*
|
||||
|
||||
// Do we need to implement memory-alignment enforcement within the MemoryHook
|
||||
// class, or will the underlying malloc implementation provide it
|
||||
|
|
@ -398,13 +400,13 @@ typedef struct _object PyObject;
|
|||
#elif defined(MEMORY_HOOK_DO_ALIGN)
|
||||
// We need memory alignment, and we're willing to provide it ourselves.
|
||||
|
||||
#else
|
||||
#else // malloc alignment
|
||||
// We need memory alignment, and we haven't specified whether it should be
|
||||
// provided on top of the existing malloc library, or otherwise. Let's rely
|
||||
// on dlmalloc to provide it, it seems to be the most memory-efficient option.
|
||||
#define USE_MEMORY_DLMALLOC 1
|
||||
|
||||
#endif
|
||||
#endif // malloc alignment
|
||||
|
||||
#ifdef LINMATH_ALIGN
|
||||
/* We require 16-byte alignment of certain structures, to support SSE2. We
|
||||
|
|
@ -413,37 +415,37 @@ typedef struct _object PyObject;
|
|||
/* Eigen uses AVX instructions, but let's only enable this when compiling with
|
||||
double precision, so that we can keep our ABI a bit more stable. */
|
||||
#define MEMORY_HOOK_ALIGNMENT 32
|
||||
#else
|
||||
#else // HAVE_EIGEN alignment
|
||||
#define MEMORY_HOOK_ALIGNMENT 16
|
||||
#endif
|
||||
#endif // HAVE_EIGEN alignment
|
||||
/* Otherwise, align to two words. This seems to be pretty standard to the
|
||||
point where some code may rely on this being the case. */
|
||||
#elif defined(IS_OSX) || NATIVE_WORDSIZE >= 64
|
||||
#define MEMORY_HOOK_ALIGNMENT 16
|
||||
#else
|
||||
#else // memory alignment
|
||||
#define MEMORY_HOOK_ALIGNMENT 8
|
||||
#endif
|
||||
#endif // memory alignment
|
||||
|
||||
#ifdef HAVE_EIGEN
|
||||
/* Make sure that Eigen doesn't assume alignment guarantees we don't offer. */
|
||||
#define EIGEN_MAX_ALIGN_BYTES MEMORY_HOOK_ALIGNMENT
|
||||
#ifndef EIGEN_MPL2_ONLY
|
||||
#define EIGEN_MPL2_ONLY 1
|
||||
#endif
|
||||
#endif // !EIGEN_MPL2_ONLY
|
||||
#if !defined(_DEBUG) && !defined(EIGEN_NO_DEBUG)
|
||||
#define EIGEN_NO_DEBUG 1
|
||||
#endif
|
||||
#endif
|
||||
#endif // !_DEBUG && !EIGEN_NO_DEBUG
|
||||
#endif // HAVE_EIGEN
|
||||
|
||||
/* Determine our memory-allocation requirements. */
|
||||
#if defined(USE_MEMORY_MIMALLOC) || defined(USE_MEMORY_PTMALLOC2) || defined(USE_MEMORY_DLMALLOC) || defined(DO_MEMORY_USAGE) || defined(MEMORY_HOOK_DO_ALIGN)
|
||||
/* In this case we have some custom memory management requirements. */
|
||||
#else
|
||||
#else // memory allocation wrappers
|
||||
/* Otherwise, if we have no custom memory management needs at all, we
|
||||
might as well turn it all off and go straight to the OS-level
|
||||
calls. */
|
||||
#define USE_MEMORY_NOWRAPPERS 1
|
||||
#endif
|
||||
#endif // memory allocation wrappers
|
||||
|
||||
/* We must always use the STL allocator nowadays, because we have
|
||||
redefined the constructors for pvector, pmap, etc. */
|
||||
|
|
@ -468,7 +470,18 @@ typedef struct _object PyObject;
|
|||
#define MAKE_MAP_KEYS_SEQ(property_name, ...) __make_map_keys_seq(property_name, __VA_ARGS__)
|
||||
#define EXTENSION(x) __extension x
|
||||
#define EXTEND __extension
|
||||
#else
|
||||
#ifdef HAVE_PYTHON
|
||||
#define PY_EXTENSION(x) __extension x
|
||||
#define PY_EXTEND(...) __extension __VA_ARGS__
|
||||
#define PY_MAKE_PROPERTY(property_name, ...) __make_property(property_name, __VA_ARGS__)
|
||||
#define PY_MAKE_SEQ_PROPERTY(property_name, ...) __make_seq_property(property_name, __VA_ARGS__)
|
||||
#else // HAVE_PYTHON
|
||||
#define PY_EXTENSION(x)
|
||||
#define PY_EXTEND(...)
|
||||
#define PY_MAKE_PROPERTY(property_name, ...)
|
||||
#define PY_MAKE_SEQ_PROPERTY(property_name, ...)
|
||||
#endif // HAVE_PYTHON
|
||||
#else // CPPPARSER
|
||||
#define BEGIN_PUBLISH
|
||||
#define END_PUBLISH
|
||||
#define BLOCKING
|
||||
|
|
@ -480,7 +493,11 @@ typedef struct _object PyObject;
|
|||
#define MAKE_MAP_KEYS_SEQ(property_name, ...)
|
||||
#define EXTENSION(x)
|
||||
#define EXTEND
|
||||
#endif
|
||||
#define PY_EXTENSION(x)
|
||||
#define PY_EXTEND(...)
|
||||
#define PY_MAKE_PROPERTY(property_name, ...)
|
||||
#define PY_MAKE_SEQ_PROPERTY(property_name, ...)
|
||||
#endif // CPPPARSER
|
||||
|
||||
/* These symbols are used in dtoolsymbols.h and pandasymbols.h. */
|
||||
#if defined(_WIN32) && !defined(CPPPARSER) && !defined(LINK_ALL_STATIC)
|
||||
|
|
@ -489,10 +506,10 @@ typedef struct _object PyObject;
|
|||
#elif __GNUC__ >= 4 && !defined(CPPPARSER) && !defined(LINK_ALL_STATIC)
|
||||
#define EXPORT_CLASS __attribute__((visibility("default")))
|
||||
#define IMPORT_CLASS
|
||||
#else
|
||||
#else // IMPORT/EXPORT
|
||||
#define EXPORT_CLASS
|
||||
#define IMPORT_CLASS
|
||||
#endif
|
||||
#endif // IMPORT/EXPORT
|
||||
|
||||
/* "extern template" is now part of the C++11 standard. */
|
||||
#if defined(CPPPARSER) || defined(LINK_ALL_STATIC)
|
||||
|
|
@ -507,13 +524,13 @@ typedef struct _object PyObject;
|
|||
duplicate template instantiations that this causes. */
|
||||
#define EXPORT_TEMPL
|
||||
#define IMPORT_TEMPL extern
|
||||
#else
|
||||
#else // IMPORT/EXPORT template
|
||||
#define EXPORT_TEMPL extern
|
||||
#define IMPORT_TEMPL extern
|
||||
#endif
|
||||
#endif // IMPORT/EXPORT template
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "dtoolbase_cc.h"
|
||||
#endif
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
#endif // !DTOOLBASE_H
|
||||
|
|
|
|||
|
|
@ -166,25 +166,6 @@ get_python_type() const {
|
|||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return the Index of the BEst fit Classs from a set
|
||||
*/
|
||||
int TypeHandle::
|
||||
get_best_parent_from_Set(const std::set< int > &legal_vals) const {
|
||||
if (legal_vals.find(_index) != legal_vals.end()) {
|
||||
return _index;
|
||||
}
|
||||
|
||||
for (int pi = 0; pi < get_num_parent_classes(); ++pi) {
|
||||
TypeHandle ph = get_parent_class(pi);
|
||||
int val = ph.get_best_parent_from_Set(legal_vals);
|
||||
if (val > 0) {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::ostream &
|
||||
operator << (std::ostream &out, TypeHandle::MemoryClass mem_class) {
|
||||
switch (mem_class) {
|
||||
|
|
|
|||
|
|
@ -97,9 +97,7 @@ PUBLISHED:
|
|||
// its value, it might happen after the value had already been set
|
||||
// previously by another static initializer!
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(static TypeHandle make(PyTypeObject *classobj));
|
||||
#endif
|
||||
PY_EXTENSION(static TypeHandle make(PyTypeObject *classobj));
|
||||
|
||||
INLINE bool operator == (const TypeHandle &other) const;
|
||||
INLINE bool operator != (const TypeHandle &other) const;
|
||||
|
|
@ -123,8 +121,6 @@ PUBLISHED:
|
|||
INLINE TypeHandle get_parent_towards(TypeHandle ancestor,
|
||||
TypedObject *object = nullptr) const;
|
||||
|
||||
int get_best_parent_from_Set(const std::set< int > &legal_vals) const;
|
||||
|
||||
size_t get_memory_usage(MemoryClass memory_class) const;
|
||||
void inc_memory_usage(MemoryClass memory_class, size_t size);
|
||||
void dec_memory_usage(MemoryClass memory_class, size_t size);
|
||||
|
|
@ -139,10 +135,8 @@ PUBLISHED:
|
|||
MAKE_SEQ_PROPERTY(parent_classes, get_num_parent_classes, get_parent_class);
|
||||
MAKE_SEQ_PROPERTY(child_classes, get_num_child_classes, get_child_class);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *__reduce__() const);
|
||||
EXTENSION(void __setstate__(PyObject *));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *__reduce__() const);
|
||||
PY_EXTENSION(void __setstate__(PyObject *));
|
||||
|
||||
public:
|
||||
#ifdef HAVE_PYTHON
|
||||
|
|
|
|||
|
|
@ -695,21 +695,3 @@ look_up_invalid(TypeHandle handle, TypedObject *object) const {
|
|||
|
||||
return _handle_registry[handle._index];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
*/
|
||||
extern "C" int
|
||||
get_best_parent_from_Set(int id, const std::set<int> &this_set) {
|
||||
// most common case..
|
||||
if (this_set.find(id) != this_set.end()) {
|
||||
return id;
|
||||
}
|
||||
|
||||
TypeHandle th = TypeRegistry::ptr()->find_type_by_id(id);
|
||||
if (th == TypeHandle::none()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return th.get_best_parent_from_Set(this_set);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,9 +118,6 @@ private:
|
|||
friend class TypeHandle;
|
||||
};
|
||||
|
||||
// Helper function to allow for "C" interaction into the type system
|
||||
extern "C" EXPCL_DTOOL_DTOOLBASE int get_best_parent_from_Set(int id, const std::set<int> &this_set);
|
||||
|
||||
#include "typeHandle.h"
|
||||
|
||||
#include "typeRegistry.I"
|
||||
|
|
|
|||
|
|
@ -43,14 +43,6 @@ is_exact_type(TypeHandle handle) const {
|
|||
return get_type() == handle;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
INLINE int TypedObject::
|
||||
get_best_parent_from_Set(const std::set<int> &inset) const {
|
||||
return get_type().get_best_parent_from_Set(inset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the object, upcast (if necessary) to a TypedObject pointer.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -106,8 +106,6 @@ PUBLISHED:
|
|||
INLINE bool is_exact_type(TypeHandle handle) const;
|
||||
|
||||
public:
|
||||
INLINE int get_best_parent_from_Set(const std::set<int> &) const;
|
||||
|
||||
// Derived classes should override this function to call init_type(). It
|
||||
// will only be called in error situations when the type was for some reason
|
||||
// not properly initialized.
|
||||
|
|
|
|||
|
|
@ -66,11 +66,9 @@ PUBLISHED:
|
|||
INLINE Filename();
|
||||
explicit Filename(const Filename &dirname, const Filename &basename);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(Filename(PyObject *path));
|
||||
PY_EXTENSION(Filename(PyObject *path));
|
||||
|
||||
EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
|
||||
// Static constructors to explicitly create a filename that refers to a text
|
||||
// or binary file. This is in lieu of calling set_text() or set_binary() or
|
||||
|
|
@ -114,10 +112,8 @@ PUBLISHED:
|
|||
INLINE size_t length() const;
|
||||
INLINE char operator [] (size_t n) const;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *__repr__() const);
|
||||
EXTENSION(PyObject *__fspath__() const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *__repr__() const);
|
||||
PY_EXTENSION(PyObject *__fspath__() const);
|
||||
|
||||
INLINE std::string substr(size_t begin) const;
|
||||
INLINE std::string substr(size_t begin, size_t end) const;
|
||||
|
|
@ -202,9 +198,7 @@ PUBLISHED:
|
|||
int find_on_searchpath(const DSearchPath &searchpath);
|
||||
|
||||
bool scan_directory(vector_string &contents) const;
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *scan_directory() const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *scan_directory() const);
|
||||
|
||||
bool open_read(std::ifstream &stream) const;
|
||||
bool open_write(std::ofstream &stream, bool truncate = true) const;
|
||||
|
|
|
|||
|
|
@ -54,28 +54,28 @@ PUBLISHED:
|
|||
INLINE static Encoding get_default_encoding();
|
||||
MAKE_PROPERTY(default_encoding, get_default_encoding, set_default_encoding);
|
||||
|
||||
#if defined(CPPPARSER) && defined(HAVE_PYTHON)
|
||||
EXTEND void set_text(PyObject *text);
|
||||
EXTEND void set_text(PyObject *text, Encoding encoding);
|
||||
#else // CPPPARSER && HAVE_PYTHON
|
||||
#if defined(CPPPARSER)
|
||||
PY_EXTEND(void set_text(PyObject *text));
|
||||
PY_EXTEND(void set_text(PyObject *text, Encoding encoding));
|
||||
#else // CPPPARSER
|
||||
INLINE void set_text(const std::string &text);
|
||||
INLINE void set_text(const std::string &text, Encoding encoding);
|
||||
#endif // CPPPARSER && HAVE_PYTHON
|
||||
#endif // CPPPARSER
|
||||
INLINE void clear_text();
|
||||
INLINE bool has_text() const;
|
||||
|
||||
void make_upper();
|
||||
void make_lower();
|
||||
|
||||
#if defined(CPPPARSER) && defined(HAVE_PYTHON)
|
||||
EXTEND PyObject *get_text() const;
|
||||
EXTEND PyObject *get_text(Encoding encoding) const;
|
||||
EXTEND void append_text(PyObject *text);
|
||||
#else // CPPPARSER && HAVE_PYTHON
|
||||
#if defined(CPPPARSER)
|
||||
PY_EXTEND(PyObject *get_text() const);
|
||||
PY_EXTEND(PyObject *get_text(Encoding encoding) const);
|
||||
PY_EXTEND(void append_text(PyObject *text));
|
||||
#else // CPPPARSER
|
||||
INLINE std::string get_text() const;
|
||||
INLINE std::string get_text(Encoding encoding) const;
|
||||
INLINE void append_text(const std::string &text);
|
||||
#endif // CPPPARSER && HAVE_PYTHON
|
||||
#endif // CPPPARSER
|
||||
INLINE void append_unicode_char(char32_t character);
|
||||
INLINE size_t get_num_chars() const;
|
||||
INLINE int get_unicode_char(size_t index) const;
|
||||
|
|
@ -108,19 +108,19 @@ PUBLISHED:
|
|||
std::wstring get_wtext_as_ascii() const;
|
||||
bool is_wtext() const;
|
||||
|
||||
#if defined(CPPPARSER) && defined(HAVE_PYTHON)
|
||||
EXTEND static PyObject *encode_wchar(char32_t ch, Encoding encoding);
|
||||
EXTEND INLINE PyObject *encode_wtext(const std::wstring &wtext) const;
|
||||
EXTEND static PyObject *encode_wtext(const std::wstring &wtext, Encoding encoding);
|
||||
EXTEND INLINE PyObject *decode_text(PyObject *text) const;
|
||||
EXTEND static PyObject *decode_text(PyObject *text, Encoding encoding);
|
||||
#else // CPPPARSER && HAVE_PYTHON
|
||||
#if defined(CPPPARSER)
|
||||
PY_EXTEND(static PyObject *encode_wchar(char32_t ch, Encoding encoding));
|
||||
PY_EXTEND(INLINE PyObject *encode_wtext(const std::wstring &wtext) const);
|
||||
PY_EXTEND(static PyObject *encode_wtext(const std::wstring &wtext, Encoding encoding));
|
||||
PY_EXTEND(INLINE PyObject *decode_text(PyObject *text) const);
|
||||
PY_EXTEND(static PyObject *decode_text(PyObject *text, Encoding encoding));
|
||||
#else // CPPPARSER
|
||||
static std::string encode_wchar(char32_t ch, Encoding encoding);
|
||||
INLINE std::string encode_wtext(const std::wstring &wtext) const;
|
||||
static std::string encode_wtext(const std::wstring &wtext, Encoding encoding);
|
||||
INLINE std::wstring decode_text(const std::string &text) const;
|
||||
static std::wstring decode_text(const std::string &text, Encoding encoding);
|
||||
#endif // CPPPARSER && HAVE_PYTHON
|
||||
#endif // CPPPARSER
|
||||
|
||||
MAKE_PROPERTY(text, get_text, set_text);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,9 +44,7 @@ PUBLISHED:
|
|||
|
||||
INLINE size_t get_num_words() const;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
|
||||
protected:
|
||||
INLINE const ConfigDeclaration *get_default_value() const;
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@ PUBLISHED:
|
|||
~Notify();
|
||||
|
||||
#if defined(CPPPARSER) && defined(HAVE_PYTHON)
|
||||
EXTEND void set_ostream_ptr(PyObject *ostream_ptr, bool delete_later);
|
||||
#else
|
||||
PY_EXTEND(void set_ostream_ptr(PyObject *ostream_ptr, bool delete_later));
|
||||
#else // CPPPARSER && HAVE_PYTHON
|
||||
void set_ostream_ptr(std::ostream *ostream_ptr, bool delete_later);
|
||||
#endif
|
||||
#endif // CPPPARSER && HAVE_PYTHON
|
||||
std::ostream *get_ostream_ptr() const;
|
||||
|
||||
typedef bool AssertHandler(const char *expression, int line,
|
||||
|
|
|
|||
|
|
@ -68,12 +68,10 @@ PUBLISHED:
|
|||
|
||||
BLOCKING void skip_bytes(size_t size);
|
||||
BLOCKING size_t extract_bytes(unsigned char *into, size_t size);
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *extract_bytes(size_t size));
|
||||
PY_EXTENSION(PyObject *extract_bytes(size_t size));
|
||||
|
||||
EXTENSION(PyObject *readline());
|
||||
EXTENSION(PyObject *readlines());
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *readline());
|
||||
PY_EXTENSION(PyObject *readlines());
|
||||
public:
|
||||
BLOCKING vector_uchar extract_bytes(size_t size);
|
||||
BLOCKING std::string readline();
|
||||
|
|
|
|||
|
|
@ -70,9 +70,7 @@ PUBLISHED:
|
|||
BLOCKING INLINE void add_fixed_string(const std::string &str, size_t size);
|
||||
|
||||
BLOCKING void pad_bytes(size_t size);
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(void append_data(PyObject *data));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(void append_data(PyObject *data));
|
||||
|
||||
BLOCKING INLINE void flush();
|
||||
|
||||
|
|
|
|||
|
|
@ -6320,6 +6320,8 @@ if PkgSkip("PYTHON") == 0:
|
|||
LibName('DEPLOYSTUB', "-Wl,--disable-new-dtags,-rpath,\\$ORIGIN")
|
||||
LibName('DEPLOYSTUB', "-Wl,-z,origin")
|
||||
LibName('DEPLOYSTUB', "-rdynamic")
|
||||
elif GetTarget() == 'darwin':
|
||||
LibName('DEPLOYSTUB', "-Wl,-sectcreate,__PANDA,__panda,/dev/null")
|
||||
|
||||
PyTargetAdd('deploy-stub.exe', input='deploy-stub.obj')
|
||||
if GetTarget() == 'windows':
|
||||
|
|
|
|||
|
|
@ -814,7 +814,12 @@ set_properties_now(WindowProperties &properties) {
|
|||
if (switched) {
|
||||
if (_window != nil) {
|
||||
// For some reason, setting the style mask makes it give up its
|
||||
// first-responder status.
|
||||
// first-responder status. And for some reason, we need to first
|
||||
// restore the window to normal level before we switch fullscreen,
|
||||
// otherwise we may get a black bar if we're currently on Z_top.
|
||||
if (_properties.get_z_order() != WindowProperties::Z_normal) {
|
||||
[_window setLevel: NSNormalWindowLevel];
|
||||
}
|
||||
if ([_window respondsToSelector:@selector(setStyleMask:)]) {
|
||||
[_window setStyleMask:NSBorderlessWindowMask];
|
||||
}
|
||||
|
|
@ -847,8 +852,12 @@ set_properties_now(WindowProperties &properties) {
|
|||
_properties.set_fullscreen(false);
|
||||
|
||||
// Force properties to be reset to their actual values
|
||||
properties.set_undecorated(_properties.get_undecorated());
|
||||
properties.set_z_order(_properties.get_z_order());
|
||||
if (!properties.has_undecorated()) {
|
||||
properties.set_undecorated(_properties.get_undecorated());
|
||||
}
|
||||
if (!properties.has_z_order()) {
|
||||
properties.set_z_order(_properties.get_z_order());
|
||||
}
|
||||
properties.clear_fullscreen();
|
||||
}
|
||||
}
|
||||
|
|
@ -865,6 +874,58 @@ set_properties_now(WindowProperties &properties) {
|
|||
properties.clear_minimized();
|
||||
}
|
||||
|
||||
if (properties.has_title() && _window != nil) {
|
||||
_properties.set_title(properties.get_title());
|
||||
[_window setTitle:[NSString stringWithUTF8String:properties.get_title().c_str()]];
|
||||
properties.clear_title();
|
||||
}
|
||||
|
||||
if (properties.has_fixed_size() && _window != nil) {
|
||||
_properties.set_fixed_size(properties.get_fixed_size());
|
||||
[_window setShowsResizeIndicator:!properties.get_fixed_size()];
|
||||
|
||||
if (!_properties.get_fullscreen()) {
|
||||
// If our window is decorated, change the style mask to show or hide the
|
||||
// resize button appropriately. However, if we're specifying the
|
||||
// 'undecorated' property also, then we'll be setting the style mask
|
||||
// about 25 LOC further down, so we won't need to bother setting it
|
||||
// here.
|
||||
if (!properties.has_undecorated() && !_properties.get_undecorated() &&
|
||||
[_window respondsToSelector:@selector(setStyleMask:)]) {
|
||||
if (properties.get_fixed_size()) {
|
||||
[_window setStyleMask:NSTitledWindowMask | NSClosableWindowMask |
|
||||
NSMiniaturizableWindowMask ];
|
||||
} else {
|
||||
[_window setStyleMask:NSTitledWindowMask | NSClosableWindowMask |
|
||||
NSMiniaturizableWindowMask | NSResizableWindowMask ];
|
||||
}
|
||||
[_window makeFirstResponder:_view];
|
||||
}
|
||||
}
|
||||
|
||||
properties.clear_fixed_size();
|
||||
}
|
||||
|
||||
if (properties.has_undecorated() && _window != nil && [_window respondsToSelector:@selector(setStyleMask:)]) {
|
||||
_properties.set_undecorated(properties.get_undecorated());
|
||||
|
||||
if (!_properties.get_fullscreen()) {
|
||||
if (properties.get_undecorated()) {
|
||||
[_window setStyleMask: NSBorderlessWindowMask];
|
||||
} else if (_properties.get_fixed_size()) {
|
||||
// Fixed size windows should not show the resize button.
|
||||
[_window setStyleMask: NSTitledWindowMask | NSClosableWindowMask |
|
||||
NSMiniaturizableWindowMask ];
|
||||
} else {
|
||||
[_window setStyleMask: NSTitledWindowMask | NSClosableWindowMask |
|
||||
NSMiniaturizableWindowMask | NSResizableWindowMask ];
|
||||
}
|
||||
[_window makeFirstResponder:_view];
|
||||
}
|
||||
|
||||
properties.clear_undecorated();
|
||||
}
|
||||
|
||||
if (properties.has_size()) {
|
||||
int width = properties.get_x_size();
|
||||
int height = properties.get_y_size();
|
||||
|
|
@ -978,58 +1039,6 @@ set_properties_now(WindowProperties &properties) {
|
|||
properties.clear_maximized();
|
||||
}
|
||||
|
||||
if (properties.has_title() && _window != nil) {
|
||||
_properties.set_title(properties.get_title());
|
||||
[_window setTitle:[NSString stringWithUTF8String:properties.get_title().c_str()]];
|
||||
properties.clear_title();
|
||||
}
|
||||
|
||||
if (properties.has_fixed_size() && _window != nil) {
|
||||
_properties.set_fixed_size(properties.get_fixed_size());
|
||||
[_window setShowsResizeIndicator:!properties.get_fixed_size()];
|
||||
|
||||
if (!_properties.get_fullscreen()) {
|
||||
// If our window is decorated, change the style mask to show or hide the
|
||||
// resize button appropriately. However, if we're specifying the
|
||||
// 'undecorated' property also, then we'll be setting the style mask
|
||||
// about 25 LOC further down, so we won't need to bother setting it
|
||||
// here.
|
||||
if (!properties.has_undecorated() && !_properties.get_undecorated() &&
|
||||
[_window respondsToSelector:@selector(setStyleMask:)]) {
|
||||
if (properties.get_fixed_size()) {
|
||||
[_window setStyleMask:NSTitledWindowMask | NSClosableWindowMask |
|
||||
NSMiniaturizableWindowMask ];
|
||||
} else {
|
||||
[_window setStyleMask:NSTitledWindowMask | NSClosableWindowMask |
|
||||
NSMiniaturizableWindowMask | NSResizableWindowMask ];
|
||||
}
|
||||
[_window makeFirstResponder:_view];
|
||||
}
|
||||
}
|
||||
|
||||
properties.clear_fixed_size();
|
||||
}
|
||||
|
||||
if (properties.has_undecorated() && _window != nil && [_window respondsToSelector:@selector(setStyleMask:)]) {
|
||||
_properties.set_undecorated(properties.get_undecorated());
|
||||
|
||||
if (!_properties.get_fullscreen()) {
|
||||
if (properties.get_undecorated()) {
|
||||
[_window setStyleMask: NSBorderlessWindowMask];
|
||||
} else if (_properties.get_fixed_size()) {
|
||||
// Fixed size windows should not show the resize button.
|
||||
[_window setStyleMask: NSTitledWindowMask | NSClosableWindowMask |
|
||||
NSMiniaturizableWindowMask ];
|
||||
} else {
|
||||
[_window setStyleMask: NSTitledWindowMask | NSClosableWindowMask |
|
||||
NSMiniaturizableWindowMask | NSResizableWindowMask ];
|
||||
}
|
||||
[_window makeFirstResponder:_view];
|
||||
}
|
||||
|
||||
properties.clear_undecorated();
|
||||
}
|
||||
|
||||
if (properties.has_foreground() && !_properties.get_fullscreen() && _window != nil) {
|
||||
_properties.set_foreground(properties.get_foreground());
|
||||
if (!_properties.get_minimized()) {
|
||||
|
|
|
|||
|
|
@ -69,8 +69,8 @@ PUBLISHED:
|
|||
void flush();
|
||||
|
||||
// These help implement Python pickle support.
|
||||
EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
EXTENSION(void __setstate__(PyObject *self, vector_uchar data));
|
||||
PY_EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
PY_EXTENSION(void __setstate__(PyObject *self, vector_uchar data));
|
||||
|
||||
virtual void write_datagram(Datagram &destination) const;
|
||||
virtual void read_datagram(DatagramIterator &source);
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ PUBLISHED:
|
|||
PUBLISHED:
|
||||
MAKE_PROPERTY2(center, has_center, get_center, set_center, clear_center);
|
||||
|
||||
EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
EXTENSION(void __setstate__(PyObject *self, vector_uchar data, PyObject *nodepaths));
|
||||
PY_EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
PY_EXTENSION(void __setstate__(PyObject *self, vector_uchar data, PyObject *nodepaths));
|
||||
|
||||
protected:
|
||||
bool _has_contact; // Are we in contact with anything?
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ PUBLISHED:
|
|||
void output(std::ostream &out) const;
|
||||
void write(std::ostream &out, int indent_level = 0) const;
|
||||
|
||||
EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
PY_EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
|
||||
private:
|
||||
typedef pvector< PT(CollisionEntry) > Entries;
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ PUBLISHED:
|
|||
bool is_valid() const;
|
||||
bool is_concave() const;
|
||||
|
||||
EXTENSION(static bool verify_points(PyObject *points));
|
||||
EXTENSION(void setup_points(PyObject *points));
|
||||
PY_EXTENSION(static bool verify_points(PyObject *points));
|
||||
PY_EXTENSION(void setup_points(PyObject *points));
|
||||
|
||||
PUBLISHED:
|
||||
MAKE_SEQ_PROPERTY(points, get_num_points, get_point);
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ PUBLISHED:
|
|||
void output(std::ostream &out) const;
|
||||
void write(std::ostream &out, int indent_level) const;
|
||||
|
||||
EXTENSION(PyObject *__getstate__() const);
|
||||
EXTENSION(void __setstate__(PyObject *state));
|
||||
PY_EXTENSION(PyObject *__getstate__() const);
|
||||
PY_EXTENSION(void __setstate__(PyObject *state));
|
||||
|
||||
private:
|
||||
typedef pvector<CollisionLevelStateSingle> LevelStatesSingle;
|
||||
|
|
|
|||
|
|
@ -144,10 +144,8 @@ PUBLISHED:
|
|||
MAKE_PROPERTY(float_color, get_float_color, set_float_color);
|
||||
MAKE_PROPERTY(float_depth, get_float_depth, set_float_depth);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *__getstate__() const);
|
||||
EXTENSION(void __setstate__(PyObject *self, PyObject *state));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *__getstate__() const);
|
||||
PY_EXTENSION(void __setstate__(PyObject *self, PyObject *state));
|
||||
|
||||
// Other.
|
||||
|
||||
|
|
|
|||
|
|
@ -52,9 +52,7 @@ PUBLISHED:
|
|||
|
||||
INLINE static GraphicsPipeSelection *get_global_ptr();
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *__reduce__() const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *__reduce__() const);
|
||||
|
||||
public:
|
||||
typedef PT(GraphicsPipe) PipeConstructorFunc();
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@
|
|||
#include "colorScaleAttrib.h"
|
||||
#include "clipPlaneAttrib.h"
|
||||
#include "fogAttrib.h"
|
||||
#include "renderModeAttrib.h"
|
||||
#include "config_pstatclient.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
|
@ -1267,6 +1268,25 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name,
|
|||
}
|
||||
return;
|
||||
}
|
||||
case Shader::SMO_texconst_i: {
|
||||
const TexGenAttrib *tga;
|
||||
const TextureAttrib *ta;
|
||||
|
||||
int num_stages = 0;
|
||||
if (_target_rs->get_attrib(ta) && _target_rs->get_attrib(tga)) {
|
||||
num_stages = std::min(count, (int)ta->get_num_on_stages());
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for (; i < num_stages; ++i) {
|
||||
LVecBase3 value = tga->get_constant_value(ta->get_on_stage(i));
|
||||
into[i].set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, value[0], value[1], value[2], 1);
|
||||
}
|
||||
for (; i < count; ++i) {
|
||||
into[i] = LMatrix4::ident_mat();
|
||||
}
|
||||
return;
|
||||
}
|
||||
case Shader::SMO_tex_is_alpha_i: {
|
||||
// This is a hack so we can support both F_alpha and other formats in the
|
||||
// default shader, to fix font rendering in GLES2
|
||||
|
|
@ -1628,6 +1648,33 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name,
|
|||
}
|
||||
return;
|
||||
}
|
||||
case Shader::SMO_attr_pointparams: {
|
||||
const RenderModeAttrib *target_render_mode;
|
||||
_target_rs->get_attrib_def(target_render_mode);
|
||||
|
||||
PN_stdfloat thickness = target_render_mode->get_thickness();
|
||||
PN_stdfloat catten = thickness;
|
||||
PN_stdfloat patten = 0.0f;
|
||||
if (target_render_mode->get_perspective()) {
|
||||
LVecBase2i pixel_size = _current_display_region->get_pixel_size();
|
||||
|
||||
LVector3 height(0.0f, thickness, 1.0f);
|
||||
height = height * _projection_mat->get_mat();
|
||||
height = height * _internal_transform->get_scale()[1];
|
||||
PN_stdfloat s = height[1] * pixel_size[1];
|
||||
|
||||
if (_current_lens->is_orthographic()) {
|
||||
catten = s;
|
||||
patten = 0.0f;
|
||||
} else {
|
||||
catten = 0.0f;
|
||||
patten = s;
|
||||
}
|
||||
}
|
||||
|
||||
into[0].set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, thickness, catten, patten, 0.0f);
|
||||
return;
|
||||
}
|
||||
default:
|
||||
nassertv(false /*should never get here*/);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -254,9 +254,7 @@ PUBLISHED:
|
|||
MAKE_PROPERTY(texture_quality_override, get_texture_quality_override,
|
||||
set_texture_quality_override);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *get_prepared_textures() const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *get_prepared_textures() const);
|
||||
typedef bool TextureCallback(TextureContext *tc, void *callback_arg);
|
||||
void traverse_prepared_textures(TextureCallback *func, void *callback_arg);
|
||||
|
||||
|
|
|
|||
|
|
@ -56,9 +56,7 @@ PUBLISHED:
|
|||
void clear_rejected_properties();
|
||||
WindowProperties get_rejected_properties() const;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(void request_properties(PyObject *args, PyObject *kwds));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(void request_properties(PyObject *args, PyObject *kwds));
|
||||
|
||||
INLINE bool is_closed() const;
|
||||
virtual bool is_active() const;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
/**
|
||||
* A class representing an asynchronous request to save a screenshot.
|
||||
*/
|
||||
class EXPCL_PANDA_PGRAPH ScreenshotRequest : public AsyncFuture {
|
||||
class EXPCL_PANDA_DISPLAY ScreenshotRequest : public AsyncFuture {
|
||||
public:
|
||||
INLINE ScreenshotRequest(Texture *tex);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,9 +44,7 @@ PUBLISHED:
|
|||
M_confined,
|
||||
};
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(WindowProperties(PyObject *self, PyObject *args, PyObject *kwds));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(WindowProperties(PyObject *self, PyObject *args, PyObject *kwds));
|
||||
|
||||
PUBLISHED:
|
||||
void operator = (const WindowProperties ©);
|
||||
|
|
@ -207,10 +205,8 @@ PUBLISHED:
|
|||
MAKE_PROPERTY2(parent_window, has_parent_window, get_parent_window,
|
||||
set_parent_window, clear_parent_window);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *__getstate__(PyObject *self) const);
|
||||
EXTENSION(void __setstate__(PyObject *self, PyObject *state));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *__getstate__(PyObject *self) const);
|
||||
PY_EXTENSION(void __setstate__(PyObject *self, PyObject *state));
|
||||
|
||||
void add_properties(const WindowProperties &other);
|
||||
|
||||
|
|
|
|||
|
|
@ -131,15 +131,16 @@ get_tcp_header_size() const {
|
|||
INLINE bool SSWriter::
|
||||
consider_flush() {
|
||||
if (!_collect_tcp) {
|
||||
return flush();
|
||||
|
||||
flush();
|
||||
return !is_closed();
|
||||
} else {
|
||||
double elapsed =
|
||||
TrueClock::get_global_ptr()->get_short_time() - _queued_data_start;
|
||||
// If the elapsed time is negative, someone must have reset the clock
|
||||
// back, so just go ahead and flush.
|
||||
if (elapsed < 0.0 || elapsed >= _collect_tcp_interval) {
|
||||
return flush();
|
||||
flush();
|
||||
return !is_closed();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -150,11 +151,10 @@ consider_flush() {
|
|||
* Sends the most recently queued data now. This only has meaning if
|
||||
* set_collect_tcp() has been set to true.
|
||||
*/
|
||||
INLINE bool SSWriter::
|
||||
INLINE void SSWriter::
|
||||
flush() {
|
||||
_ostream->flush();
|
||||
_queued_data_start = TrueClock::get_global_ptr()->get_short_time();
|
||||
return !is_closed();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -176,9 +176,9 @@ OSocketStream(std::streambuf *buf) : std::ostream(buf), SSWriter(this) {
|
|||
* Sends the most recently queued data now. This only has meaning if
|
||||
* set_collect_tcp() has been set to true.
|
||||
*/
|
||||
INLINE bool OSocketStream::
|
||||
INLINE void OSocketStream::
|
||||
flush() {
|
||||
return SSWriter::flush();
|
||||
SSWriter::flush();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -212,7 +212,7 @@ get_tcp_header_size() const {
|
|||
* Sends the most recently queued data now. This only has meaning if
|
||||
* set_collect_tcp() has been set to true.
|
||||
*/
|
||||
INLINE bool SocketStream::
|
||||
INLINE void SocketStream::
|
||||
flush() {
|
||||
return SSWriter::flush();
|
||||
SSWriter::flush();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ PUBLISHED:
|
|||
INLINE int get_tcp_header_size() const;
|
||||
|
||||
INLINE bool consider_flush();
|
||||
INLINE bool flush();
|
||||
INLINE void flush();
|
||||
|
||||
private:
|
||||
std::ostream *_ostream;
|
||||
|
|
@ -168,7 +168,7 @@ PUBLISHED:
|
|||
virtual bool is_closed() = 0;
|
||||
virtual void close() = 0;
|
||||
|
||||
INLINE bool flush();
|
||||
INLINE void flush();
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -190,7 +190,7 @@ PUBLISHED:
|
|||
INLINE void set_tcp_header_size(int tcp_header_size);
|
||||
INLINE int get_tcp_header_size() const;
|
||||
|
||||
INLINE bool flush();
|
||||
INLINE void flush();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3149,6 +3149,7 @@ set_state_and_transform(const RenderState *target,
|
|||
}
|
||||
_target_rs = target;
|
||||
|
||||
int shader_deps = 0;
|
||||
determine_target_shader();
|
||||
|
||||
int alpha_test_slot = AlphaTestAttrib::get_class_slot();
|
||||
|
|
@ -3178,10 +3179,7 @@ set_state_and_transform(const RenderState *target,
|
|||
do_issue_color_scale();
|
||||
_state_mask.set_bit(color_slot);
|
||||
_state_mask.set_bit(color_scale_slot);
|
||||
if (_current_shader_context) {
|
||||
_current_shader_context->issue_parameters(this, Shader::SSD_color);
|
||||
_current_shader_context->issue_parameters(this, Shader::SSD_colorscale);
|
||||
}
|
||||
shader_deps |= Shader::SSD_color | Shader::SSD_colorscale;
|
||||
}
|
||||
|
||||
int cull_face_slot = CullFaceAttrib::get_class_slot();
|
||||
|
|
@ -3222,6 +3220,7 @@ set_state_and_transform(const RenderState *target,
|
|||
// PStatTimer timer(_draw_set_state_render_mode_pcollector);
|
||||
do_issue_render_mode();
|
||||
_state_mask.set_bit(render_mode_slot);
|
||||
shader_deps |= Shader::SSD_render_mode;
|
||||
}
|
||||
|
||||
int rescale_normal_slot = RescaleNormalAttrib::get_class_slot();
|
||||
|
|
@ -3285,6 +3284,7 @@ set_state_and_transform(const RenderState *target,
|
|||
_state_mask.set_bit(texture_slot);
|
||||
_state_mask.set_bit(tex_matrix_slot);
|
||||
_state_mask.set_bit(tex_gen_slot);
|
||||
shader_deps |= Shader::SSD_tex_matrix | Shader::SSD_tex_gen;
|
||||
}
|
||||
|
||||
int material_slot = MaterialAttrib::get_class_slot();
|
||||
|
|
@ -3293,9 +3293,7 @@ set_state_and_transform(const RenderState *target,
|
|||
// PStatTimer timer(_draw_set_state_material_pcollector);
|
||||
do_issue_material();
|
||||
_state_mask.set_bit(material_slot);
|
||||
if (_current_shader_context) {
|
||||
_current_shader_context->issue_parameters(this, Shader::SSD_material);
|
||||
}
|
||||
shader_deps |= Shader::SSD_material;
|
||||
}
|
||||
|
||||
int light_slot = LightAttrib::get_class_slot();
|
||||
|
|
@ -3320,9 +3318,7 @@ set_state_and_transform(const RenderState *target,
|
|||
// PStatTimer timer(_draw_set_state_fog_pcollector);
|
||||
do_issue_fog();
|
||||
_state_mask.set_bit(fog_slot);
|
||||
if (_current_shader_context) {
|
||||
_current_shader_context->issue_parameters(this, Shader::SSD_fog);
|
||||
}
|
||||
shader_deps |= Shader::SSD_fog;
|
||||
}
|
||||
|
||||
int scissor_slot = ScissorAttrib::get_class_slot();
|
||||
|
|
@ -3333,6 +3329,10 @@ set_state_and_transform(const RenderState *target,
|
|||
_state_mask.set_bit(scissor_slot);
|
||||
}
|
||||
|
||||
if (_current_shader_context != nullptr && shader_deps != 0) {
|
||||
_current_shader_context->issue_parameters(this, shader_deps);
|
||||
}
|
||||
|
||||
_state_rs = _target_rs;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -254,6 +254,7 @@ issue_parameters(GSG *gsg, int altered) {
|
|||
HRESULT hr;
|
||||
PN_stdfloat v [4];
|
||||
LMatrix4f temp_matrix = LCAST(float, *val);
|
||||
LMatrix3f temp_matrix3;
|
||||
|
||||
hr = D3D_OK;
|
||||
|
||||
|
|
@ -315,6 +316,33 @@ issue_parameters(GSG *gsg, int altered) {
|
|||
hr = cgD3D9SetUniform(p, v);
|
||||
break;
|
||||
|
||||
case Shader::SMP_upper3x3:
|
||||
// TRANSPOSE REQUIRED
|
||||
temp_matrix3 = temp_matrix.get_upper_3();
|
||||
temp_matrix3.transpose_in_place();
|
||||
data = temp_matrix3.get_data();
|
||||
|
||||
hr = cgD3D9SetUniform(p, data);
|
||||
break;
|
||||
|
||||
case Shader::SMP_transpose3x3:
|
||||
// NO TRANSPOSE REQUIRED
|
||||
temp_matrix3 = temp_matrix.get_upper_3();
|
||||
data = temp_matrix3.get_data();
|
||||
|
||||
hr = cgD3D9SetUniform(p, data);
|
||||
break;
|
||||
|
||||
case Shader::SMP_cell15:
|
||||
hr = cgD3D9SetUniform(p, data + 15);
|
||||
continue;
|
||||
case Shader::SMP_cell14:
|
||||
hr = cgD3D9SetUniform(p, data + 14);
|
||||
continue;
|
||||
case Shader::SMP_cell13:
|
||||
hr = cgD3D9SetUniform(p, data + 13);
|
||||
continue;
|
||||
|
||||
default:
|
||||
dxgsg9_cat.error()
|
||||
<< "issue_parameters () SMP parameter type not implemented " << spec._piece << "\n";
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ PUBLISHED:
|
|||
|
||||
virtual void write(std::ostream &out, int indent_level) const;
|
||||
|
||||
EXTENSION(PyObject *__reduce__() const);
|
||||
PY_EXTENSION(PyObject *__reduce__() const);
|
||||
|
||||
private:
|
||||
std::string _comment;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ PUBLISHED:
|
|||
|
||||
virtual void write(std::ostream &out, int indent_level) const;
|
||||
|
||||
EXTENSION(PyObject *__reduce__() const);
|
||||
PY_EXTENSION(PyObject *__reduce__() const);
|
||||
|
||||
private:
|
||||
CoordinateSystem _value;
|
||||
|
|
|
|||
|
|
@ -108,8 +108,8 @@ PUBLISHED:
|
|||
EggNode *get_first_child();
|
||||
EggNode *get_next_child();
|
||||
|
||||
EXTENSION(PyObject *get_children() const);
|
||||
MAKE_PROPERTY(children, get_children);
|
||||
PY_EXTENSION(PyObject *get_children() const);
|
||||
PY_MAKE_PROPERTY(children, get_children);
|
||||
|
||||
EggNode *add_child(EggNode *node);
|
||||
PT(EggNode) remove_child(EggNode *node);
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ PUBLISHED:
|
|||
void test_under_integrity() const { }
|
||||
#endif // _DEBUG
|
||||
|
||||
EXTENSION(PyObject *__reduce__() const);
|
||||
PY_EXTENSION(PyObject *__reduce__() const);
|
||||
|
||||
protected:
|
||||
enum UnderFlags {
|
||||
|
|
|
|||
|
|
@ -62,16 +62,12 @@ PUBLISHED:
|
|||
INLINE AsyncFuture();
|
||||
virtual ~AsyncFuture();
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(static PyObject *__await__(PyObject *self));
|
||||
EXTENSION(static PyObject *__iter__(PyObject *self));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(static PyObject *__await__(PyObject *self));
|
||||
PY_EXTENSION(static PyObject *__iter__(PyObject *self));
|
||||
|
||||
INLINE bool done() const;
|
||||
INLINE bool cancelled() const;
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *result(PyObject *self, PyObject *timeout = Py_None) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *result(PyObject *self, PyObject *timeout = Py_None) const);
|
||||
|
||||
virtual bool cancel();
|
||||
|
||||
|
|
@ -79,11 +75,9 @@ PUBLISHED:
|
|||
INLINE const std::string &get_done_event() const;
|
||||
MAKE_PROPERTY(done_event, get_done_event, set_done_event);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *add_done_callback(PyObject *self, PyObject *fn));
|
||||
PY_EXTENSION(PyObject *add_done_callback(PyObject *self, PyObject *fn));
|
||||
|
||||
EXTENSION(static PyObject *gather(PyObject *args));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(static PyObject *gather(PyObject *args));
|
||||
INLINE static PT(AsyncFuture) shield(PT(AsyncFuture) future);
|
||||
|
||||
virtual void output(std::ostream &out) const;
|
||||
|
|
@ -91,9 +85,7 @@ PUBLISHED:
|
|||
BLOCKING void wait();
|
||||
BLOCKING void wait(double timeout);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(void set_result(PyObject *));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(void set_result(PyObject *));
|
||||
public:
|
||||
INLINE void set_result(std::nullptr_t);
|
||||
INLINE void set_result(TypedReferenceCount *result);
|
||||
|
|
|
|||
|
|
@ -95,11 +95,9 @@ public:
|
|||
INLINE const void *get_data() const;
|
||||
|
||||
PUBLISHED:
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE PyObject *get_message() const);
|
||||
EXTENSION(INLINE PyObject *__bytes__() const);
|
||||
EXTENSION(PyObject *__reduce__() const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE PyObject *get_message() const);
|
||||
PY_EXTENSION(INLINE PyObject *__bytes__() const);
|
||||
PY_EXTENSION(PyObject *__reduce__() const);
|
||||
|
||||
INLINE size_t get_length() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ PUBLISHED:
|
|||
std::string get_type_name(size_t n) const;
|
||||
double get_age(size_t n) const;
|
||||
|
||||
#if defined(DO_MEMORY_USAGE) && defined(HAVE_PYTHON)
|
||||
EXTENSION(PyObject *get_python_pointer(size_t n) const);
|
||||
#endif // DO_MEMORY_USAGE && HAVE_PYTHON
|
||||
#if defined(DO_MEMORY_USAGE)
|
||||
PY_EXTENSION(PyObject *get_python_pointer(size_t n) const);
|
||||
#endif // DO_MEMORY_USAGE
|
||||
|
||||
void clear();
|
||||
|
||||
|
|
|
|||
|
|
@ -84,10 +84,8 @@ PUBLISHED:
|
|||
std::string update_subfile(const std::string &subfile_name, const Filename &filename,
|
||||
int compression_level);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE PyObject *set_encryption_password(PyObject *encryption_password) const);
|
||||
EXTENSION(INLINE PyObject *get_encryption_password() const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE PyObject *set_encryption_password(PyObject *encryption_password) const);
|
||||
PY_EXTENSION(INLINE PyObject *get_encryption_password() const);
|
||||
|
||||
#ifdef HAVE_OPENSSL
|
||||
bool add_signature(const Filename &certificate,
|
||||
|
|
|
|||
|
|
@ -96,9 +96,7 @@ PUBLISHED:
|
|||
INLINE static PointerToArray<Element> empty_array(size_type n, TypeHandle type_handle = get_type_handle(Element));
|
||||
INLINE PointerToArray(const PointerToArray<Element> ©);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PointerToArray(PyObject *self, PyObject *source));
|
||||
#endif // HAVE_PYTHON */
|
||||
PY_EXTENSION(PointerToArray(PyObject *self, PyObject *source));
|
||||
|
||||
INLINE void clear();
|
||||
|
||||
|
|
@ -109,25 +107,21 @@ PUBLISHED:
|
|||
INLINE void set_element(size_type n, const Element &value);
|
||||
EXTENSION(const Element &__getitem__(size_type n) const);
|
||||
EXTENSION(void __setitem__(size_type n, const Element &value));
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *get_data() const);
|
||||
EXTENSION(void set_data(PyObject *data));
|
||||
EXTENSION(PyObject *get_subdata(size_type n, size_type count) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *get_data() const);
|
||||
PY_EXTENSION(void set_data(PyObject *data));
|
||||
PY_EXTENSION(PyObject *get_subdata(size_type n, size_type count) const);
|
||||
INLINE void set_subdata(size_type n, size_type count, const std::string &data);
|
||||
INLINE int get_ref_count() const;
|
||||
INLINE int get_node_ref_count() const;
|
||||
|
||||
INLINE size_t count(const Element &) const;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
PY_EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
|
||||
EXTENSION(int __getbuffer__(PyObject *self, Py_buffer *view, int flags));
|
||||
EXTENSION(void __releasebuffer__(PyObject *self, Py_buffer *view) const);
|
||||
PY_EXTENSION(int __getbuffer__(PyObject *self, Py_buffer *view, int flags));
|
||||
PY_EXTENSION(void __releasebuffer__(PyObject *self, Py_buffer *view) const);
|
||||
|
||||
EXTENSION(PointerToArray<Element> __deepcopy__(PyObject *memo) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PointerToArray<Element> __deepcopy__(PyObject *memo) const);
|
||||
|
||||
#else // CPPPARSER
|
||||
// This is the actual, complete interface.
|
||||
|
|
@ -273,23 +267,19 @@ PUBLISHED:
|
|||
INLINE size_type size() const;
|
||||
INLINE const Element &get_element(size_type n) const;
|
||||
EXTENSION(const Element &__getitem__(size_type n) const);
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *get_data() const);
|
||||
EXTENSION(PyObject *get_subdata(size_type n, size_type count) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *get_data() const);
|
||||
PY_EXTENSION(PyObject *get_subdata(size_type n, size_type count) const);
|
||||
INLINE int get_ref_count() const;
|
||||
INLINE int get_node_ref_count() const;
|
||||
|
||||
INLINE size_t count(const Element &) const;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
PY_EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
|
||||
EXTENSION(int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const);
|
||||
EXTENSION(void __releasebuffer__(PyObject *self, Py_buffer *view) const);
|
||||
PY_EXTENSION(int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const);
|
||||
PY_EXTENSION(void __releasebuffer__(PyObject *self, Py_buffer *view) const);
|
||||
|
||||
EXTENSION(ConstPointerToArray<Element> __deepcopy__(PyObject *memo) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(ConstPointerToArray<Element> __deepcopy__(PyObject *memo) const);
|
||||
|
||||
#else // CPPPARSER
|
||||
// This is the actual, complete interface.
|
||||
|
|
|
|||
|
|
@ -28,20 +28,16 @@ PUBLISHED:
|
|||
|
||||
INLINE void seek(size_t pos);
|
||||
INLINE size_t tell() const;
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *read(size_t length));
|
||||
EXTENSION(PyObject *readline());
|
||||
EXTENSION(PyObject *readlines());
|
||||
PY_EXTENSION(PyObject *read(size_t length));
|
||||
PY_EXTENSION(PyObject *readline());
|
||||
PY_EXTENSION(PyObject *readlines());
|
||||
|
||||
EXTENSION(PyObject *get_data() const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *get_data() const);
|
||||
INLINE size_t get_data_size() const;
|
||||
INLINE void clear();
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *__getstate__() const);
|
||||
EXTENSION(void __setstate__(PyObject *state));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *__getstate__() const);
|
||||
PY_EXTENSION(void __setstate__(PyObject *state));
|
||||
public:
|
||||
std::string read(size_t length);
|
||||
std::string readline();
|
||||
|
|
|
|||
|
|
@ -30,9 +30,7 @@ public:
|
|||
INLINE StringStream(vector_uchar source);
|
||||
|
||||
PUBLISHED:
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(StringStream(PyObject *source));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(StringStream(PyObject *source));
|
||||
INLINE StringStream();
|
||||
|
||||
#if _MSC_VER >= 1800
|
||||
|
|
@ -42,12 +40,10 @@ PUBLISHED:
|
|||
INLINE void clear_data();
|
||||
INLINE size_t get_data_size();
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *get_data());
|
||||
EXTENSION(void set_data(PyObject *data));
|
||||
PY_EXTENSION(PyObject *get_data());
|
||||
PY_EXTENSION(void set_data(PyObject *data));
|
||||
|
||||
MAKE_PROPERTY(data, get_data, set_data);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_MAKE_PROPERTY(data, get_data, set_data);
|
||||
|
||||
public:
|
||||
#ifndef CPPPARSER
|
||||
|
|
|
|||
|
|
@ -56,16 +56,12 @@ PUBLISHED:
|
|||
BLOCKING void ls(std::ostream &out = std::cout) const;
|
||||
BLOCKING void ls_all(std::ostream &out = std::cout) const;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *read_file(bool auto_unwrap) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *read_file(bool auto_unwrap) const);
|
||||
BLOCKING virtual std::istream *open_read_file(bool auto_unwrap) const;
|
||||
BLOCKING virtual void close_read_file(std::istream *stream) const;
|
||||
virtual bool was_read_successful() const;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *write_file(PyObject *data, bool auto_wrap));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *write_file(PyObject *data, bool auto_wrap));
|
||||
BLOCKING virtual std::ostream *open_write_file(bool auto_wrap, bool truncate);
|
||||
BLOCKING virtual std::ostream *open_append_file();
|
||||
BLOCKING virtual void close_write_file(std::ostream *stream);
|
||||
|
|
|
|||
|
|
@ -98,15 +98,11 @@ PUBLISHED:
|
|||
|
||||
static VirtualFileSystem *get_global_ptr();
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *read_file(const Filename &filename, bool auto_unwrap) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *read_file(const Filename &filename, bool auto_unwrap) const);
|
||||
BLOCKING std::istream *open_read_file(const Filename &filename, bool auto_unwrap) const;
|
||||
BLOCKING static void close_read_file(std::istream *stream);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *write_file(const Filename &filename, PyObject *data, bool auto_wrap));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *write_file(const Filename &filename, PyObject *data, bool auto_wrap));
|
||||
BLOCKING std::ostream *open_write_file(const Filename &filename, bool auto_wrap, bool truncate);
|
||||
BLOCKING std::ostream *open_append_file(const Filename &filename);
|
||||
BLOCKING static void close_write_file(std::ostream *stream);
|
||||
|
|
|
|||
|
|
@ -486,6 +486,14 @@ set_state_and_transform(const RenderState *target_rs,
|
|||
target_rs->get_attrib(TexMatrixAttrib::get_class_slot())) {
|
||||
altered |= Shader::SSD_tex_matrix;
|
||||
}
|
||||
if (state_rs->get_attrib(TexGenAttrib::get_class_slot()) !=
|
||||
target_rs->get_attrib(TexGenAttrib::get_class_slot())) {
|
||||
altered |= Shader::SSD_tex_gen;
|
||||
}
|
||||
if (state_rs->get_attrib(RenderModeAttrib::get_class_slot()) !=
|
||||
target_rs->get_attrib(RenderModeAttrib::get_class_slot())) {
|
||||
altered |= Shader::SSD_render_mode;
|
||||
}
|
||||
_state_rs = target_rs;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -185,16 +185,16 @@ static const string default_vshader =
|
|||
#endif
|
||||
"in vec4 p3d_Vertex;\n"
|
||||
"in vec4 p3d_Color;\n"
|
||||
"in vec2 p3d_MultiTexCoord0;\n"
|
||||
"out vec2 texcoord;\n"
|
||||
"in vec4 p3d_MultiTexCoord0;\n"
|
||||
"out vec3 texcoord;\n"
|
||||
"out vec4 color;\n"
|
||||
#else
|
||||
"#version 100\n"
|
||||
"precision mediump float;\n"
|
||||
"attribute vec4 p3d_Vertex;\n"
|
||||
"attribute vec4 p3d_Color;\n"
|
||||
"attribute vec2 p3d_MultiTexCoord0;\n"
|
||||
"varying vec2 texcoord;\n"
|
||||
"attribute vec4 p3d_MultiTexCoord0;\n"
|
||||
"varying vec3 texcoord;\n"
|
||||
"varying lowp vec4 color;\n"
|
||||
#endif
|
||||
"uniform mat4 p3d_ModelViewProjectionMatrix;\n"
|
||||
|
|
@ -202,7 +202,7 @@ static const string default_vshader =
|
|||
"uniform vec4 p3d_ColorScale;\n"
|
||||
"void main(void) {\n"
|
||||
" gl_Position = p3d_ModelViewProjectionMatrix * p3d_Vertex;\n"
|
||||
" texcoord = (p3d_TextureMatrix * vec4(p3d_MultiTexCoord0.x, p3d_MultiTexCoord0.y, 0, 1)).xy;\n"
|
||||
" texcoord = (p3d_TextureMatrix * p3d_MultiTexCoord0).xyw;\n"
|
||||
" color = p3d_Color * p3d_ColorScale;\n"
|
||||
"}\n";
|
||||
|
||||
|
|
@ -218,8 +218,8 @@ static const string default_vshader_fp64 =
|
|||
"#extension GL_ARB_gpu_shader_fp64 : require\n"
|
||||
"in dvec3 p3d_Vertex;\n"
|
||||
"in vec4 p3d_Color;\n"
|
||||
"in dvec2 p3d_MultiTexCoord0;\n"
|
||||
"out vec2 texcoord;\n"
|
||||
"in dvec4 p3d_MultiTexCoord0;\n"
|
||||
"out vec3 texcoord;\n"
|
||||
"out vec4 color;\n"
|
||||
"uniform mat4 p3d_ModelViewMatrix;\n"
|
||||
"uniform mat4 p3d_ProjectionMatrix;\n"
|
||||
|
|
@ -227,7 +227,7 @@ static const string default_vshader_fp64 =
|
|||
"uniform vec4 p3d_ColorScale;\n"
|
||||
"void main(void) {\n" // Apply proj & modelview in two steps, more precise
|
||||
" gl_Position = vec4(dmat4(p3d_ProjectionMatrix) * (dmat4(p3d_ModelViewMatrix) * dvec4(p3d_Vertex, 1)));\n"
|
||||
" texcoord = (p3d_TextureMatrix * vec4(p3d_MultiTexCoord0.x, p3d_MultiTexCoord0.y, 0, 1)).xy;\n"
|
||||
" texcoord = (p3d_TextureMatrix * vec4(p3d_MultiTexCoord0)).xyw;\n"
|
||||
" color = p3d_Color * p3d_ColorScale;\n"
|
||||
"}\n";
|
||||
|
||||
|
|
@ -236,8 +236,8 @@ static const string default_vshader_fp64_gl41 =
|
|||
"#version 410\n"
|
||||
"in dvec3 p3d_Vertex;\n"
|
||||
"in vec4 p3d_Color;\n"
|
||||
"in dvec2 p3d_MultiTexCoord0;\n"
|
||||
"out vec2 texcoord;\n"
|
||||
"in dvec4 p3d_MultiTexCoord0;\n"
|
||||
"out vec3 texcoord;\n"
|
||||
"out vec4 color;\n"
|
||||
"uniform mat4 p3d_ModelViewMatrix;\n"
|
||||
"uniform mat4 p3d_ProjectionMatrix;\n"
|
||||
|
|
@ -245,7 +245,7 @@ static const string default_vshader_fp64_gl41 =
|
|||
"uniform vec4 p3d_ColorScale;\n"
|
||||
"void main(void) {\n" // Apply proj & modelview in two steps, more precise
|
||||
" gl_Position = vec4(dmat4(p3d_ProjectionMatrix) * (dmat4(p3d_ModelViewMatrix) * dvec4(p3d_Vertex, 1)));\n"
|
||||
" texcoord = (p3d_TextureMatrix * vec4(p3d_MultiTexCoord0.x, p3d_MultiTexCoord0.y, 0, 1)).xy;\n"
|
||||
" texcoord = (p3d_TextureMatrix * vec4(p3d_MultiTexCoord0)).xyw;\n"
|
||||
" color = p3d_Color * p3d_ColorScale;\n"
|
||||
"}\n";
|
||||
#endif
|
||||
|
|
@ -257,7 +257,7 @@ static const string default_fshader =
|
|||
#else
|
||||
"#version 130\n"
|
||||
#endif
|
||||
"in vec2 texcoord;\n"
|
||||
"in vec3 texcoord;\n"
|
||||
"in vec4 color;\n"
|
||||
"out vec4 p3d_FragColor;\n"
|
||||
"uniform sampler2D p3d_Texture0;\n"
|
||||
|
|
@ -265,18 +265,18 @@ static const string default_fshader =
|
|||
#else
|
||||
"#version 100\n"
|
||||
"precision mediump float;\n"
|
||||
"varying vec2 texcoord;\n"
|
||||
"varying vec3 texcoord;\n"
|
||||
"varying lowp vec4 color;\n"
|
||||
"uniform lowp sampler2D p3d_Texture0;\n"
|
||||
"uniform lowp vec4 p3d_TexAlphaOnly;\n"
|
||||
#endif
|
||||
"void main(void) {\n"
|
||||
#ifndef OPENGLES
|
||||
" p3d_FragColor = texture(p3d_Texture0, texcoord);\n"
|
||||
" p3d_FragColor = textureProj(p3d_Texture0, texcoord);\n"
|
||||
" p3d_FragColor += p3d_TexAlphaOnly;\n" // Hack for text rendering
|
||||
" p3d_FragColor *= color;\n"
|
||||
#else
|
||||
" gl_FragColor = texture2D(p3d_Texture0, texcoord);\n"
|
||||
" gl_FragColor = texture2DProj(p3d_Texture0, texcoord);\n"
|
||||
" gl_FragColor += p3d_TexAlphaOnly;\n" // Hack for text rendering
|
||||
" gl_FragColor *= color;\n"
|
||||
#endif
|
||||
|
|
@ -12340,6 +12340,8 @@ set_state_and_transform(const RenderState *target,
|
|||
}
|
||||
|
||||
int texture_slot = TextureAttrib::get_class_slot();
|
||||
int tex_gen_slot = TexGenAttrib::get_class_slot();
|
||||
int tex_matrix_slot = TexMatrixAttrib::get_class_slot();
|
||||
if (_target_rs->get_attrib(texture_slot) != _state_rs->get_attrib(texture_slot) ||
|
||||
!_state_mask.get_bit(texture_slot)) {
|
||||
//PStatGPUTimer timer(this, _draw_set_state_texture_pcollector);
|
||||
|
|
@ -12355,7 +12357,7 @@ set_state_and_transform(const RenderState *target,
|
|||
_target_texture = (const TextureAttrib *)
|
||||
_target_rs->get_attrib_def(TextureAttrib::get_class_slot());
|
||||
_target_tex_gen = (const TexGenAttrib *)
|
||||
_target_rs->get_attrib_def(TexGenAttrib::get_class_slot());
|
||||
_target_rs->get_attrib_def(tex_gen_slot);
|
||||
}
|
||||
#endif
|
||||
do_issue_texture();
|
||||
|
|
@ -12363,28 +12365,36 @@ set_state_and_transform(const RenderState *target,
|
|||
// Since the TexGen and TexMatrix states depend partly on the particular
|
||||
// set of textures in use, we should force both of those to be reissued
|
||||
// every time we change the texture state.
|
||||
_state_mask.clear_bit(TexGenAttrib::get_class_slot());
|
||||
_state_mask.clear_bit(TexMatrixAttrib::get_class_slot());
|
||||
_state_mask.clear_bit(tex_gen_slot);
|
||||
_state_mask.clear_bit(tex_matrix_slot);
|
||||
|
||||
_state_texture = _target_texture;
|
||||
_state_mask.set_bit(texture_slot);
|
||||
}
|
||||
else if (_target_rs->get_attrib(tex_gen_slot) != _state_rs->get_attrib(tex_gen_slot) ||
|
||||
!_state_mask.get_bit(tex_gen_slot)) {
|
||||
_target_tex_gen = (const TexGenAttrib *)_target_rs->get_attrib_def(tex_gen_slot);
|
||||
|
||||
// If one of the previously-loaded TexGen modes modified the texture matrix,
|
||||
// then if either state changed, we have to change both of them now.
|
||||
if (_tex_gen_modifies_mat) {
|
||||
int tex_gen_slot = TexGenAttrib::get_class_slot();
|
||||
int tex_matrix_slot = TexMatrixAttrib::get_class_slot();
|
||||
if (_target_rs->get_attrib(tex_gen_slot) != _state_rs->get_attrib(tex_gen_slot) ||
|
||||
_target_rs->get_attrib(tex_matrix_slot) != _state_rs->get_attrib(tex_matrix_slot) ||
|
||||
!_state_mask.get_bit(tex_gen_slot) ||
|
||||
!_state_mask.get_bit(tex_matrix_slot)) {
|
||||
#ifdef SUPPORT_FIXED_FUNCTION
|
||||
#ifdef OPENGLES_1
|
||||
if (_has_texture_alpha_scale) {
|
||||
#else
|
||||
if (_has_texture_alpha_scale && _current_shader == nullptr) {
|
||||
#endif
|
||||
PT(TextureStage) stage = get_alpha_scale_texture_stage();
|
||||
_target_tex_gen = DCAST(TexGenAttrib, _target_tex_gen->add_stage
|
||||
(stage, TexGenAttrib::M_constant, LTexCoord3(_current_color_scale[3], 0.0f, 0.0f)));
|
||||
}
|
||||
#endif // SUPPORT_FIXED_FUNCTION
|
||||
|
||||
// If one of the previously-loaded TexGen modes modified the texture matrix,
|
||||
// then if either state changed, we have to change both of them now.
|
||||
if (_tex_gen_modifies_mat) {
|
||||
_state_mask.clear_bit(tex_gen_slot);
|
||||
_state_mask.clear_bit(tex_matrix_slot);
|
||||
}
|
||||
}
|
||||
|
||||
int tex_matrix_slot = TexMatrixAttrib::get_class_slot();
|
||||
if (_target_rs->get_attrib(tex_matrix_slot) != _state_rs->get_attrib(tex_matrix_slot) ||
|
||||
!_state_mask.get_bit(tex_matrix_slot)) {
|
||||
// PStatGPUTimer timer(this, _draw_set_state_tex_matrix_pcollector);
|
||||
|
|
@ -12399,11 +12409,15 @@ set_state_and_transform(const RenderState *target,
|
|||
_current_shader_context->issue_parameters(Shader::SSD_tex_matrix);
|
||||
}
|
||||
#endif
|
||||
|
||||
// See previous occurrence of this check.
|
||||
if (_tex_gen_modifies_mat) {
|
||||
_state_mask.clear_bit(tex_gen_slot);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SUPPORT_FIXED_FUNCTION
|
||||
if (has_fixed_function_pipeline()) {
|
||||
int tex_gen_slot = TexGenAttrib::get_class_slot();
|
||||
if (_target_tex_gen != _state_tex_gen ||
|
||||
!_state_mask.get_bit(tex_gen_slot)) {
|
||||
// PStatGPUTimer timer(this, _draw_set_state_tex_gen_pcollector);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "fogAttrib.h"
|
||||
#include "lightAttrib.h"
|
||||
#include "clipPlaneAttrib.h"
|
||||
#include "renderModeAttrib.h"
|
||||
#include "bamCache.h"
|
||||
|
||||
using std::dec;
|
||||
|
|
@ -2078,6 +2079,14 @@ set_state_and_transform(const RenderState *target_rs,
|
|||
target_rs->get_attrib(TextureAttrib::get_class_slot())) {
|
||||
altered |= Shader::SSD_texture;
|
||||
}
|
||||
if (state_rs->get_attrib(TexGenAttrib::get_class_slot()) !=
|
||||
target_rs->get_attrib(TexGenAttrib::get_class_slot())) {
|
||||
altered |= Shader::SSD_tex_gen;
|
||||
}
|
||||
if (state_rs->get_attrib(RenderModeAttrib::get_class_slot()) !=
|
||||
target_rs->get_attrib(RenderModeAttrib::get_class_slot())) {
|
||||
altered |= Shader::SSD_render_mode;
|
||||
}
|
||||
_state_rs = target_rs;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,11 +114,9 @@ PUBLISHED:
|
|||
static void lru_epoch();
|
||||
INLINE static VertexDataBook &get_book();
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(int __getbuffer__(PyObject *self, Py_buffer *view, int flags));
|
||||
EXTENSION(int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const);
|
||||
EXTENSION(void __releasebuffer__(PyObject *self, Py_buffer *view) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(int __getbuffer__(PyObject *self, Py_buffer *view, int flags));
|
||||
PY_EXTENSION(int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const);
|
||||
PY_EXTENSION(void __releasebuffer__(PyObject *self, Py_buffer *view) const);
|
||||
|
||||
public:
|
||||
virtual void evict_lru();
|
||||
|
|
@ -310,14 +308,12 @@ PUBLISHED:
|
|||
const unsigned char *source,
|
||||
size_t from_start, size_t from_size);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(void copy_data_from(PyObject *buffer));
|
||||
EXTENSION(void copy_subdata_from(size_t to_start, size_t to_size,
|
||||
PyObject *buffer));
|
||||
EXTENSION(void copy_subdata_from(size_t to_start, size_t to_size,
|
||||
PyObject *buffer,
|
||||
size_t from_start, size_t from_size));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(void copy_data_from(PyObject *buffer));
|
||||
PY_EXTENSION(void copy_subdata_from(size_t to_start, size_t to_size,
|
||||
PyObject *buffer));
|
||||
PY_EXTENSION(void copy_subdata_from(size_t to_start, size_t to_size,
|
||||
PyObject *buffer,
|
||||
size_t from_start, size_t from_size));
|
||||
|
||||
INLINE vector_uchar get_data() const;
|
||||
void set_data(const vector_uchar &data);
|
||||
|
|
|
|||
|
|
@ -94,13 +94,11 @@ PUBLISHED:
|
|||
INLINE static PT(InternalName) get_view();
|
||||
INLINE static PT(InternalName) get_instance_matrix();
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
// These versions are exposed to Python, which have additional logic to map
|
||||
// from Python interned strings.
|
||||
EXTENSION(static PT(InternalName) make(PyObject *str));
|
||||
PY_EXTENSION(static PT(InternalName) make(PyObject *str));
|
||||
|
||||
EXTENSION(PyObject *__reduce__() const);
|
||||
#endif
|
||||
PY_EXTENSION(PyObject *__reduce__() const);
|
||||
|
||||
public:
|
||||
#ifdef HAVE_PYTHON
|
||||
|
|
|
|||
|
|
@ -500,6 +500,12 @@ cp_dependency(ShaderMatInput inp) {
|
|||
if (inp == SMO_tex_is_alpha_i || inp == SMO_texcolor_i) {
|
||||
dep |= SSD_texture | SSD_frame;
|
||||
}
|
||||
if (inp == SMO_texconst_i) {
|
||||
dep |= SSD_tex_gen;
|
||||
}
|
||||
if (inp == SMO_attr_pointparams) {
|
||||
dep |= SSD_render_mode | SSD_transform | SSD_frame;
|
||||
}
|
||||
|
||||
return dep;
|
||||
}
|
||||
|
|
@ -1116,6 +1122,17 @@ compile_parameter(ShaderArgInfo &p, int *arg_dim) {
|
|||
bind._part[1] = SMO_identity;
|
||||
bind._arg[1] = nullptr;
|
||||
bind._index = atoi(pieces[1].c_str() + 5);
|
||||
} else if (pieces[1] == "pointparams") {
|
||||
if (!cp_errchk_parameter_float(p,3,4)) {
|
||||
return false;
|
||||
}
|
||||
bind._id = p._id;
|
||||
bind._piece = SMP_row3;
|
||||
bind._func = SMF_first;
|
||||
bind._part[0] = SMO_attr_pointparams;
|
||||
bind._arg[0] = nullptr;
|
||||
bind._part[1] = SMO_identity;
|
||||
bind._arg[1] = nullptr;
|
||||
} else {
|
||||
cp_report_error(p,"Unknown attr parameter.");
|
||||
return false;
|
||||
|
|
@ -1282,6 +1299,27 @@ compile_parameter(ShaderArgInfo &p, int *arg_dim) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (pieces[0] == "texconst") {
|
||||
if ((!cp_errchk_parameter_words(p,2))||
|
||||
(!cp_errchk_parameter_in(p)) ||
|
||||
(!cp_errchk_parameter_uniform(p))||
|
||||
(!cp_errchk_parameter_float(p,3,4))) {
|
||||
return false;
|
||||
}
|
||||
ShaderMatSpec bind;
|
||||
bind._id = p._id;
|
||||
bind._piece = SMP_row3;
|
||||
bind._func = SMF_first;
|
||||
bind._part[0] = SMO_texconst_i;
|
||||
bind._arg[0] = nullptr;
|
||||
bind._part[1] = SMO_identity;
|
||||
bind._arg[1] = nullptr;
|
||||
bind._index = atoi(pieces[1].c_str());
|
||||
|
||||
cp_add_mat_spec(bind);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pieces[0] == "plane") {
|
||||
if ((!cp_errchk_parameter_words(p,2))||
|
||||
(!cp_errchk_parameter_in(p)) ||
|
||||
|
|
|
|||
|
|
@ -216,6 +216,12 @@ public:
|
|||
// Color of an M_blend texture stage.
|
||||
SMO_texcolor_i,
|
||||
|
||||
// Constant value of the TexGenAttrib of stage i.
|
||||
SMO_texconst_i,
|
||||
|
||||
// Point parameters
|
||||
SMO_attr_pointparams,
|
||||
|
||||
SMO_INVALID
|
||||
};
|
||||
|
||||
|
|
@ -323,6 +329,8 @@ public:
|
|||
SSD_projection = 0x800,
|
||||
SSD_texture = 0x1000,
|
||||
SSD_view_transform= 0x2000,
|
||||
SSD_tex_gen = 0x4000,
|
||||
SSD_render_mode = 0x8000,
|
||||
};
|
||||
|
||||
enum ShaderBug {
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ ConfigVariableEnum<Texture::QualityLevel> texture_quality_level
|
|||
"renderers. See Texture::set_quality_level()."));
|
||||
|
||||
PStatCollector Texture::_texture_read_pcollector("*:Texture:Read");
|
||||
PStatCollector Texture::_texture_write_pcollector("*:Texture:Write");
|
||||
TypeHandle Texture::_type_handle;
|
||||
TypeHandle Texture::CData::_type_handle;
|
||||
AutoTextureScale Texture::_textures_power_2 = ATS_unspecified;
|
||||
|
|
@ -5198,6 +5199,8 @@ do_read_ktx(CData *cdata, istream &in, const string &filename, bool header_only)
|
|||
bool Texture::
|
||||
do_write(CData *cdata,
|
||||
const Filename &fullpath, int z, int n, bool write_pages, bool write_mipmaps) {
|
||||
PStatTimer timer(_texture_write_pcollector);
|
||||
|
||||
if (is_txo_filename(fullpath)) {
|
||||
if (!do_has_bam_rawdata(cdata)) {
|
||||
do_get_bam_rawdata(cdata);
|
||||
|
|
|
|||
|
|
@ -461,9 +461,9 @@ PUBLISHED:
|
|||
size_t page_size = 0);
|
||||
void set_ram_image_as(CPTA_uchar image, const std::string &provided_format);
|
||||
#else // !CPPPARSER || !HAVE_PYTHON
|
||||
EXTEND void set_ram_image(PyObject *image, CompressionMode compression = CM_off,
|
||||
size_t page_size = 0);
|
||||
EXTEND void set_ram_image_as(PyObject *image, const std::string &provided_format);
|
||||
PY_EXTEND(void set_ram_image(PyObject *image, CompressionMode compression = CM_off,
|
||||
size_t page_size = 0));
|
||||
PY_EXTEND(void set_ram_image_as(PyObject *image, const std::string &provided_format));
|
||||
#endif // !CPPPARSER || !HAVE_PYTHON
|
||||
INLINE void clear_ram_image();
|
||||
INLINE void set_keep_ram_image(bool keep_ram_image);
|
||||
|
|
@ -474,7 +474,7 @@ PUBLISHED:
|
|||
MAKE_PROPERTY(keep_ram_image, get_keep_ram_image, set_keep_ram_image);
|
||||
MAKE_PROPERTY(cacheable, is_cacheable);
|
||||
|
||||
EXTENSION(PT(Texture) __deepcopy__(PyObject *memo) const);
|
||||
PY_EXTENSION(PT(Texture) __deepcopy__(PyObject *memo) const);
|
||||
|
||||
BLOCKING INLINE bool compress_ram_image(CompressionMode compression = CM_on,
|
||||
QualityLevel quality_level = QL_default,
|
||||
|
|
@ -1088,6 +1088,7 @@ private:
|
|||
|
||||
static AutoTextureScale _textures_power_2;
|
||||
static PStatCollector _texture_read_pcollector;
|
||||
static PStatCollector _texture_write_pcollector;
|
||||
|
||||
// Datagram stuff
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -29,10 +29,8 @@ PUBLISHED:
|
|||
void operator = (const TextureCollection ©);
|
||||
INLINE ~TextureCollection();
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(TextureCollection(PyObject *self, PyObject *sequence));
|
||||
EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
#endif
|
||||
PY_EXTENSION(TextureCollection(PyObject *self, PyObject *sequence));
|
||||
PY_EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
|
||||
void add_texture(Texture *texture);
|
||||
bool remove_texture(Texture *texture);
|
||||
|
|
|
|||
|
|
@ -98,11 +98,9 @@ PUBLISHED:
|
|||
TexturePoolFilter *get_filter(size_t i) const;
|
||||
MAKE_SEQ_PROPERTY(filters, get_num_filters, get_filter);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(bool register_filter(PyObject *tex_filter));
|
||||
EXTENSION(bool unregister_filter(PyObject *tex_filter));
|
||||
EXTENSION(bool is_filter_registered(PyObject *tex_filter));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(bool register_filter(PyObject *tex_filter));
|
||||
PY_EXTENSION(bool unregister_filter(PyObject *tex_filter));
|
||||
PY_EXTENSION(bool is_filter_registered(PyObject *tex_filter));
|
||||
|
||||
static TexturePool *get_global_ptr();
|
||||
|
||||
|
|
|
|||
|
|
@ -68,9 +68,7 @@ PUBLISHED:
|
|||
const FLOATNAME(LVecBase3) &);
|
||||
ALLOC_DELETED_CHAIN(FLOATNAME(LMatrix3));
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE_LINMATH PyObject *__reduce__(PyObject *self) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__reduce__(PyObject *self) const);
|
||||
|
||||
void fill(FLOATTYPE fill_value);
|
||||
INLINE_LINMATH void set(
|
||||
|
|
|
|||
|
|
@ -72,9 +72,7 @@ PUBLISHED:
|
|||
const FLOATNAME(LVecBase4) &);
|
||||
ALLOC_DELETED_CHAIN(FLOATNAME(LMatrix4));
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE_LINMATH PyObject *__reduce__(PyObject *self) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__reduce__(PyObject *self) const);
|
||||
|
||||
// Construct a 4x4 matrix given a 3x3 rotation matrix and an optional
|
||||
// translation component.
|
||||
|
|
|
|||
|
|
@ -22,10 +22,8 @@ PUBLISHED:
|
|||
INLINE_LINMATH FLOATNAME(LPoint2)(FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LPoint2)(FLOATTYPE x, FLOATTYPE y);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE_LINMATH PyObject *__getattr__(PyObject *self, const std::string &attr_name) const);
|
||||
EXTENSION(INLINE_LINMATH int __setattr__(PyObject *self, const std::string &attr_name, PyObject *assign));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__getattr__(PyObject *self, const std::string &attr_name) const);
|
||||
PY_EXTENSION(INLINE_LINMATH int __setattr__(PyObject *self, const std::string &attr_name, PyObject *assign));
|
||||
|
||||
INLINE_LINMATH static const FLOATNAME(LPoint2) &zero();
|
||||
INLINE_LINMATH static const FLOATNAME(LPoint2) &unit_x();
|
||||
|
|
|
|||
|
|
@ -26,10 +26,8 @@ PUBLISHED:
|
|||
INLINE_LINMATH FLOATNAME(LPoint3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z);
|
||||
INLINE_LINMATH FLOATNAME(LPoint3)(const FLOATNAME(LVecBase2) ©, FLOATTYPE z);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE_LINMATH PyObject *__getattr__(PyObject *self, const std::string &attr_name) const);
|
||||
EXTENSION(INLINE_LINMATH int __setattr__(PyObject *self, const std::string &attr_name, PyObject *assign));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__getattr__(PyObject *self, const std::string &attr_name) const);
|
||||
PY_EXTENSION(INLINE_LINMATH int __setattr__(PyObject *self, const std::string &attr_name, PyObject *assign));
|
||||
|
||||
INLINE_LINMATH static const FLOATNAME(LPoint3) &zero();
|
||||
INLINE_LINMATH static const FLOATNAME(LPoint3) &unit_x();
|
||||
|
|
|
|||
|
|
@ -22,10 +22,8 @@ PUBLISHED:
|
|||
INLINE_LINMATH FLOATNAME(LPoint4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w);
|
||||
INLINE_LINMATH FLOATNAME(LPoint4)(const FLOATNAME(LVecBase3) ©, FLOATTYPE w);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE_LINMATH PyObject *__getattr__(PyObject *self, const std::string &attr_name) const);
|
||||
EXTENSION(INLINE_LINMATH int __setattr__(PyObject *self, const std::string &attr_name, PyObject *assign));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__getattr__(PyObject *self, const std::string &attr_name) const);
|
||||
PY_EXTENSION(INLINE_LINMATH int __setattr__(PyObject *self, const std::string &attr_name, PyObject *assign));
|
||||
|
||||
INLINE_LINMATH static const FLOATNAME(LPoint4) &zero();
|
||||
INLINE_LINMATH static const FLOATNAME(LPoint4) &unit_x();
|
||||
|
|
|
|||
|
|
@ -44,11 +44,9 @@ PUBLISHED:
|
|||
INLINE_LINMATH static const FLOATNAME(LVecBase2) &unit_x();
|
||||
INLINE_LINMATH static const FLOATNAME(LVecBase2) &unit_y();
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE_LINMATH PyObject *__reduce__(PyObject *self) const);
|
||||
EXTENSION(INLINE_LINMATH PyObject *__getattr__(PyObject *self, const std::string &attr_name) const);
|
||||
EXTENSION(INLINE_LINMATH int __setattr__(PyObject *self, const std::string &attr_name, PyObject *assign));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__reduce__(PyObject *self) const);
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__getattr__(PyObject *self, const std::string &attr_name) const);
|
||||
PY_EXTENSION(INLINE_LINMATH int __setattr__(PyObject *self, const std::string &attr_name, PyObject *assign));
|
||||
|
||||
INLINE_LINMATH FLOATTYPE operator [](int i) const;
|
||||
INLINE_LINMATH FLOATTYPE &operator [](int i);
|
||||
|
|
@ -135,19 +133,17 @@ PUBLISHED:
|
|||
|
||||
INLINE_LINMATH void componentwise_mult(const FLOATNAME(LVecBase2) &other);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE_LINMATH PyObject *__rmul__(PyObject *self, FLOATTYPE scalar) const);
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__rmul__(PyObject *self, FLOATTYPE scalar) const);
|
||||
|
||||
EXTENSION(INLINE_LINMATH PyObject *__floordiv__(PyObject *self, FLOATTYPE scalar) const);
|
||||
EXTENSION(INLINE_LINMATH PyObject *__ifloordiv__(PyObject *self, FLOATTYPE scalar));
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__floordiv__(PyObject *self, FLOATTYPE scalar) const);
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__ifloordiv__(PyObject *self, FLOATTYPE scalar));
|
||||
|
||||
EXTENSION(INLINE_LINMATH PyObject *__pow__(PyObject *self, FLOATTYPE exponent) const);
|
||||
EXTENSION(INLINE_LINMATH PyObject *__ipow__(PyObject *self, FLOATTYPE exponent));
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__pow__(PyObject *self, FLOATTYPE exponent) const);
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__ipow__(PyObject *self, FLOATTYPE exponent));
|
||||
|
||||
EXTENSION(INLINE_LINMATH PyObject *__round__(PyObject *self));
|
||||
EXTENSION(INLINE_LINMATH PyObject *__floor__(PyObject *self));
|
||||
EXTENSION(INLINE_LINMATH PyObject *__ceil__(PyObject *self));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__round__(PyObject *self));
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__floor__(PyObject *self));
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__ceil__(PyObject *self));
|
||||
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) fmax(const FLOATNAME(LVecBase2) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) fmin(const FLOATNAME(LVecBase2) &other) const;
|
||||
|
|
@ -164,9 +160,7 @@ PUBLISHED:
|
|||
INLINE_LINMATH void write_datagram(Datagram &destination) const;
|
||||
INLINE_LINMATH void read_datagram(DatagramIterator &source);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE_LINMATH int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE_LINMATH int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const);
|
||||
|
||||
public:
|
||||
// The underlying implementation is via the Eigen library, if available.
|
||||
|
|
|
|||
|
|
@ -46,11 +46,9 @@ PUBLISHED:
|
|||
INLINE_LINMATH static const FLOATNAME(LVecBase3) &unit_y();
|
||||
INLINE_LINMATH static const FLOATNAME(LVecBase3) &unit_z();
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE_LINMATH PyObject *__reduce__(PyObject *self) const);
|
||||
EXTENSION(INLINE_LINMATH PyObject *__getattr__(PyObject *self, const std::string &attr_name) const);
|
||||
EXTENSION(INLINE_LINMATH int __setattr__(PyObject *self, const std::string &attr_name, PyObject *assign));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__reduce__(PyObject *self) const);
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__getattr__(PyObject *self, const std::string &attr_name) const);
|
||||
PY_EXTENSION(INLINE_LINMATH int __setattr__(PyObject *self, const std::string &attr_name, PyObject *assign));
|
||||
|
||||
INLINE_LINMATH FLOATTYPE operator [](int i) const;
|
||||
INLINE_LINMATH FLOATTYPE &operator [](int i);
|
||||
|
|
@ -154,19 +152,17 @@ PUBLISHED:
|
|||
|
||||
INLINE_LINMATH void componentwise_mult(const FLOATNAME(LVecBase3) &other);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE_LINMATH PyObject *__rmul__(PyObject *self, FLOATTYPE scalar) const);
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__rmul__(PyObject *self, FLOATTYPE scalar) const);
|
||||
|
||||
EXTENSION(INLINE_LINMATH PyObject *__floordiv__(PyObject *self, FLOATTYPE scalar) const);
|
||||
EXTENSION(INLINE_LINMATH PyObject *__ifloordiv__(PyObject *self, FLOATTYPE scalar));
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__floordiv__(PyObject *self, FLOATTYPE scalar) const);
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__ifloordiv__(PyObject *self, FLOATTYPE scalar));
|
||||
|
||||
EXTENSION(INLINE_LINMATH PyObject *__pow__(PyObject *self, FLOATTYPE exponent) const);
|
||||
EXTENSION(INLINE_LINMATH PyObject *__ipow__(PyObject *self, FLOATTYPE exponent));
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__pow__(PyObject *self, FLOATTYPE exponent) const);
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__ipow__(PyObject *self, FLOATTYPE exponent));
|
||||
|
||||
EXTENSION(INLINE_LINMATH PyObject *__round__(PyObject *self));
|
||||
EXTENSION(INLINE_LINMATH PyObject *__floor__(PyObject *self));
|
||||
EXTENSION(INLINE_LINMATH PyObject *__ceil__(PyObject *self));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__round__(PyObject *self));
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__floor__(PyObject *self));
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__ceil__(PyObject *self));
|
||||
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) fmax(const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) fmin(const FLOATNAME(LVecBase3) &other) const;
|
||||
|
|
@ -185,9 +181,7 @@ PUBLISHED:
|
|||
INLINE_LINMATH void write_datagram(Datagram &destination) const;
|
||||
INLINE_LINMATH void read_datagram(DatagramIterator &source);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE_LINMATH int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE_LINMATH int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const);
|
||||
|
||||
public:
|
||||
// The underlying implementation is via the Eigen library, if available.
|
||||
|
|
|
|||
|
|
@ -56,11 +56,9 @@ PUBLISHED:
|
|||
INLINE_LINMATH static const FLOATNAME(LVecBase4) &unit_z();
|
||||
INLINE_LINMATH static const FLOATNAME(LVecBase4) &unit_w();
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE_LINMATH PyObject *__reduce__(PyObject *self) const);
|
||||
EXTENSION(INLINE_LINMATH PyObject *__getattr__(PyObject *self, const std::string &attr_name) const);
|
||||
EXTENSION(INLINE_LINMATH int __setattr__(PyObject *self, const std::string &attr_name, PyObject *assign));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__reduce__(PyObject *self) const);
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__getattr__(PyObject *self, const std::string &attr_name) const);
|
||||
PY_EXTENSION(INLINE_LINMATH int __setattr__(PyObject *self, const std::string &attr_name, PyObject *assign));
|
||||
|
||||
INLINE_LINMATH FLOATTYPE operator [](int i) const;
|
||||
INLINE_LINMATH FLOATTYPE &operator [](int i);
|
||||
|
|
@ -162,19 +160,17 @@ PUBLISHED:
|
|||
|
||||
INLINE_LINMATH void componentwise_mult(const FLOATNAME(LVecBase4) &other);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE_LINMATH PyObject *__rmul__(PyObject *self, FLOATTYPE scalar) const);
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__rmul__(PyObject *self, FLOATTYPE scalar) const);
|
||||
|
||||
EXTENSION(INLINE_LINMATH PyObject *__floordiv__(PyObject *self, FLOATTYPE scalar) const);
|
||||
EXTENSION(INLINE_LINMATH PyObject *__ifloordiv__(PyObject *self, FLOATTYPE scalar));
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__floordiv__(PyObject *self, FLOATTYPE scalar) const);
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__ifloordiv__(PyObject *self, FLOATTYPE scalar));
|
||||
|
||||
EXTENSION(INLINE_LINMATH PyObject *__pow__(PyObject *self, FLOATTYPE exponent) const);
|
||||
EXTENSION(INLINE_LINMATH PyObject *__ipow__(PyObject *self, FLOATTYPE exponent));
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__pow__(PyObject *self, FLOATTYPE exponent) const);
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__ipow__(PyObject *self, FLOATTYPE exponent));
|
||||
|
||||
EXTENSION(INLINE_LINMATH PyObject *__round__(PyObject *self));
|
||||
EXTENSION(INLINE_LINMATH PyObject *__floor__(PyObject *self));
|
||||
EXTENSION(INLINE_LINMATH PyObject *__ceil__(PyObject *self));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__round__(PyObject *self));
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__floor__(PyObject *self));
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__ceil__(PyObject *self));
|
||||
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) fmax(const FLOATNAME(LVecBase4) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) fmin(const FLOATNAME(LVecBase4) &other) const;
|
||||
|
|
@ -191,9 +187,7 @@ PUBLISHED:
|
|||
INLINE_LINMATH void write_datagram(Datagram &destination) const;
|
||||
INLINE_LINMATH void read_datagram(DatagramIterator &source);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE_LINMATH int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE_LINMATH int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const);
|
||||
|
||||
public:
|
||||
// The underlying implementation is via the Eigen library, if available.
|
||||
|
|
|
|||
|
|
@ -22,10 +22,8 @@ PUBLISHED:
|
|||
INLINE_LINMATH FLOATNAME(LVector2)(FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LVector2)(FLOATTYPE x, FLOATTYPE y);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE_LINMATH PyObject *__getattr__(PyObject *self, const std::string &attr_name) const);
|
||||
EXTENSION(INLINE_LINMATH int __setattr__(PyObject *self, const std::string &attr_name, PyObject *assign));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__getattr__(PyObject *self, const std::string &attr_name) const);
|
||||
PY_EXTENSION(INLINE_LINMATH int __setattr__(PyObject *self, const std::string &attr_name, PyObject *assign));
|
||||
|
||||
INLINE_LINMATH static const FLOATNAME(LVector2) &zero();
|
||||
INLINE_LINMATH static const FLOATNAME(LVector2) &unit_x();
|
||||
|
|
|
|||
|
|
@ -26,10 +26,8 @@ PUBLISHED:
|
|||
INLINE_LINMATH FLOATNAME(LVector3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z);
|
||||
INLINE_LINMATH FLOATNAME(LVector3)(const FLOATNAME(LVecBase2) ©, FLOATTYPE z);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE_LINMATH PyObject *__getattr__(PyObject *self, const std::string &attr_name) const);
|
||||
EXTENSION(INLINE_LINMATH int __setattr__(PyObject *self, const std::string &attr_name, PyObject *assign));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__getattr__(PyObject *self, const std::string &attr_name) const);
|
||||
PY_EXTENSION(INLINE_LINMATH int __setattr__(PyObject *self, const std::string &attr_name, PyObject *assign));
|
||||
|
||||
INLINE_LINMATH static const FLOATNAME(LVector3) &zero();
|
||||
INLINE_LINMATH static const FLOATNAME(LVector3) &unit_x();
|
||||
|
|
|
|||
|
|
@ -22,10 +22,8 @@ PUBLISHED:
|
|||
INLINE_LINMATH FLOATNAME(LVector4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w);
|
||||
INLINE_LINMATH FLOATNAME(LVector4)(const FLOATNAME(LVecBase3) ©, FLOATTYPE w);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE_LINMATH PyObject *__getattr__(PyObject *self, const std::string &attr_name) const);
|
||||
EXTENSION(INLINE_LINMATH int __setattr__(PyObject *self, const std::string &attr_name, PyObject *assign));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(INLINE_LINMATH PyObject *__getattr__(PyObject *self, const std::string &attr_name) const);
|
||||
PY_EXTENSION(INLINE_LINMATH int __setattr__(PyObject *self, const std::string &attr_name, PyObject *assign));
|
||||
|
||||
INLINE_LINMATH static const FLOATNAME(LVector4) &zero();
|
||||
INLINE_LINMATH static const FLOATNAME(LVector4) &unit_x();
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ PUBLISHED:
|
|||
INLINE void set_auto_disable_flag(int do_auto_disable);
|
||||
INLINE void set_auto_disable_defaults();
|
||||
INLINE void set_data(void *data);
|
||||
EXTENSION(void set_data(PyObject *data));
|
||||
PY_EXTENSION(void set_data(PyObject *data));
|
||||
|
||||
INLINE void set_position(dReal x, dReal y, dReal z);
|
||||
INLINE void set_position(const LVecBase3f &pos);
|
||||
|
|
@ -71,8 +71,8 @@ PUBLISHED:
|
|||
INLINE int get_auto_disable_flag() const;
|
||||
#ifndef CPPPARSER
|
||||
INLINE void *get_data() const;
|
||||
#endif
|
||||
EXTENSION(PyObject *get_data() const);
|
||||
#endif // CPPPARSER
|
||||
PY_EXTENSION(PyObject *get_data() const);
|
||||
|
||||
INLINE LVecBase3f get_position() const;
|
||||
INLINE LMatrix3f get_rotation() const;
|
||||
|
|
@ -132,8 +132,8 @@ PUBLISHED:
|
|||
INLINE int get_num_joints() const;
|
||||
OdeJoint get_joint(int index) const;
|
||||
MAKE_SEQ(get_joints, get_num_joints, get_joint);
|
||||
EXTENSION(INLINE PyObject *get_converted_joint(int i) const);
|
||||
MAKE_SEQ_PROPERTY(joints, get_num_joints, get_converted_joint);
|
||||
PY_EXTENSION(INLINE PyObject *get_converted_joint(int i) const);
|
||||
PY_MAKE_SEQ_PROPERTY(joints, get_num_joints, get_converted_joint);
|
||||
|
||||
INLINE void enable();
|
||||
INLINE void disable();
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ PUBLISHED:
|
|||
INLINE LMatrix3f get_rotation() const;
|
||||
INLINE LQuaternionf get_quaternion() const;
|
||||
INLINE void get_AABB(LVecBase3f &min, LVecBase3f &max) const;
|
||||
EXTENSION(INLINE PyObject *get_AA_bounds() const);
|
||||
PY_EXTENSION(INLINE PyObject *get_AA_bounds() const);
|
||||
INLINE int is_space();
|
||||
INLINE int get_class() const;
|
||||
INLINE void set_category_bits(const BitMask32 &bits);
|
||||
|
|
@ -114,13 +114,13 @@ PUBLISHED:
|
|||
// int test_collide_id( int collide_id);
|
||||
|
||||
OdeSpace get_space() const;
|
||||
EXTENSION(INLINE PyObject *get_converted_space() const);
|
||||
PY_EXTENSION(INLINE PyObject *get_converted_space() const);
|
||||
|
||||
virtual void write(std::ostream &out = std::cout, unsigned int indent=0) const;
|
||||
operator bool () const;
|
||||
INLINE int compare_to(const OdeGeom &other) const;
|
||||
|
||||
EXTENSION(PyObject *convert() const);
|
||||
PY_EXTENSION(PyObject *convert() const);
|
||||
OdeBoxGeom convert_to_box() const;
|
||||
OdeCappedCylinderGeom convert_to_capped_cylinder() const;
|
||||
// OdeConvexGeom convert_to_convex() const;
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ PUBLISHED:
|
|||
INLINE void set_feedback(bool flag = true);
|
||||
INLINE OdeJointFeedback *get_feedback();
|
||||
|
||||
EXTENSION(void attach(PyObject *body1, PyObject *body2));
|
||||
PY_EXTENSION(void attach(PyObject *body1, PyObject *body2));
|
||||
void attach_bodies(const OdeBody &body1, const OdeBody &body2);
|
||||
void attach_body(const OdeBody &body, int index);
|
||||
void detach();
|
||||
|
|
@ -93,7 +93,7 @@ PUBLISHED:
|
|||
INLINE bool operator == (const OdeJoint &other) const;
|
||||
operator bool () const;
|
||||
|
||||
EXTENSION(PyObject *convert() const);
|
||||
PY_EXTENSION(PyObject *convert() const);
|
||||
OdeBallJoint convert_to_ball() const;
|
||||
OdeHingeJoint convert_to_hinge() const;
|
||||
OdeSliderJoint convert_to_slider() const;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ PUBLISHED:
|
|||
int query(const OdeSpace& space) const;
|
||||
INLINE int get_num_geoms() const;
|
||||
INLINE void get_AABB(LVecBase3f &min, LVecBase3f &max) const;
|
||||
EXTENSION(INLINE PyObject *get_AA_bounds() const);
|
||||
PY_EXTENSION(INLINE PyObject *get_AA_bounds() const);
|
||||
INLINE int is_space();
|
||||
INLINE int get_class() const;
|
||||
INLINE void set_category_bits(const BitMask32 &bits);
|
||||
|
|
@ -82,12 +82,12 @@ PUBLISHED:
|
|||
OdeHashSpace convert_to_hash_space() const;
|
||||
OdeQuadTreeSpace convert_to_quad_tree_space() const;
|
||||
|
||||
EXTENSION(PyObject *convert() const);
|
||||
EXTENSION(INLINE PyObject *get_converted_geom(int i) const);
|
||||
EXTENSION(INLINE PyObject *get_converted_space() const);
|
||||
PY_EXTENSION(PyObject *convert() const);
|
||||
PY_EXTENSION(INLINE PyObject *get_converted_geom(int i) const);
|
||||
PY_EXTENSION(INLINE PyObject *get_converted_space() const);
|
||||
|
||||
void auto_collide();
|
||||
EXTENSION(int collide(PyObject* arg, PyObject* near_callback));
|
||||
PY_EXTENSION(int collide(PyObject* arg, PyObject* near_callback));
|
||||
int set_collide_id(int collide_id, dGeomID id);
|
||||
int set_collide_id(OdeGeom& geom, int collide_id);
|
||||
void set_surface_type( int surface_type, dGeomID id);
|
||||
|
|
|
|||
|
|
@ -41,10 +41,10 @@ PUBLISHED:
|
|||
const OdeBody &body2,
|
||||
const int joint_type);
|
||||
static PT(OdeCollisionEntry) collide(const OdeGeom &geom1, const OdeGeom &geom2,
|
||||
const short int max_contacts = 150);
|
||||
const short int max_contacts = 150);
|
||||
|
||||
EXTENSION(static int collide2(const OdeGeom &geom1, const OdeGeom &geom2,
|
||||
PyObject* arg, PyObject* callback));
|
||||
PY_EXTENSION(static int collide2(const OdeGeom &geom1, const OdeGeom &geom2,
|
||||
PyObject* arg, PyObject* callback));
|
||||
|
||||
static OdeGeom space_to_geom(const OdeSpace &space);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,12 +38,10 @@ public:
|
|||
void unregister_type(LoaderFileType *type);
|
||||
|
||||
PUBLISHED:
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(void register_type(PyObject *type));
|
||||
EXTENSION(void register_deferred_type(PyObject *entry_point));
|
||||
PY_EXTENSION(void register_type(PyObject *type));
|
||||
PY_EXTENSION(void register_deferred_type(PyObject *entry_point));
|
||||
|
||||
EXTENSION(void unregister_type(PyObject *type));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(void unregister_type(PyObject *type));
|
||||
|
||||
int get_num_types() const;
|
||||
LoaderFileType *get_type(int n) const;
|
||||
|
|
@ -55,9 +53,7 @@ PUBLISHED:
|
|||
|
||||
static LoaderFileTypeRegistry *get_global_ptr();
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *__reduce__() const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *__reduce__() const);
|
||||
|
||||
private:
|
||||
void record_extension(const std::string &extension, LoaderFileType *type);
|
||||
|
|
|
|||
|
|
@ -183,11 +183,9 @@ PUBLISHED:
|
|||
INLINE void clear();
|
||||
|
||||
EXTENSION(NodePath __copy__() const);
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *__deepcopy__(PyObject *self, PyObject *memo) const);
|
||||
EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
EXTENSION(PyObject *__reduce_persist__(PyObject *self, PyObject *pickler) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *__deepcopy__(PyObject *self, PyObject *memo) const);
|
||||
PY_EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
PY_EXTENSION(PyObject *__reduce_persist__(PyObject *self, PyObject *pickler) const);
|
||||
|
||||
INLINE static NodePath not_found();
|
||||
INLINE static NodePath removed();
|
||||
|
|
@ -668,10 +666,8 @@ PUBLISHED:
|
|||
INLINE void set_shader_input(CPT_InternalName id, PN_stdfloat n1, PN_stdfloat n2,
|
||||
PN_stdfloat n3=0, PN_stdfloat n4=0, int priority=0);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(void set_shader_input(CPT_InternalName, PyObject *, int priority=0));
|
||||
EXTENSION(void set_shader_inputs(PyObject *args, PyObject *kwargs));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(void set_shader_input(CPT_InternalName, PyObject *, int priority=0));
|
||||
PY_EXTENSION(void set_shader_inputs(PyObject *args, PyObject *kwargs));
|
||||
|
||||
void clear_shader_input(CPT_InternalName id);
|
||||
void set_instance_count(int instance_count);
|
||||
|
|
@ -915,9 +911,7 @@ PUBLISHED:
|
|||
const NodePath &other = NodePath(),
|
||||
Thread *current_thread = Thread::get_current_thread()) const;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *get_tight_bounds(const NodePath &other = NodePath()) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *get_tight_bounds(const NodePath &other = NodePath()) const);
|
||||
|
||||
// void analyze() const;
|
||||
|
||||
|
|
@ -938,24 +932,22 @@ PUBLISHED:
|
|||
|
||||
MAKE_MAP_PROPERTY(net_tags, has_net_tag, get_net_tag);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(INLINE PyObject *get_tags() const);
|
||||
EXTENSION(INLINE PyObject *get_tag_keys() const);
|
||||
MAKE_PROPERTY(tags, get_tags);
|
||||
PY_EXTENSION(INLINE PyObject *get_tags() const);
|
||||
PY_EXTENSION(INLINE PyObject *get_tag_keys() const);
|
||||
PY_MAKE_PROPERTY(tags, get_tags);
|
||||
|
||||
EXTENSION(PyObject *get_python_tags());
|
||||
EXTENSION(INLINE void set_python_tag(PyObject *keys, PyObject *value));
|
||||
EXTENSION(INLINE PyObject *get_python_tag(PyObject *keys) const);
|
||||
EXTENSION(INLINE PyObject *get_python_tag_keys() const);
|
||||
EXTENSION(INLINE bool has_python_tag(PyObject *keys) const);
|
||||
EXTENSION(INLINE void clear_python_tag(PyObject *keys));
|
||||
EXTENSION(INLINE PyObject *get_net_python_tag(PyObject *keys) const);
|
||||
EXTENSION(INLINE bool has_net_python_tag(PyObject *keys) const);
|
||||
EXTENSION(NodePath find_net_python_tag(PyObject *keys) const);
|
||||
MAKE_PROPERTY(python_tags, get_python_tags);
|
||||
PY_EXTENSION(PyObject *get_python_tags());
|
||||
PY_EXTENSION(INLINE void set_python_tag(PyObject *keys, PyObject *value));
|
||||
PY_EXTENSION(INLINE PyObject *get_python_tag(PyObject *keys) const);
|
||||
PY_EXTENSION(INLINE PyObject *get_python_tag_keys() const);
|
||||
PY_EXTENSION(INLINE bool has_python_tag(PyObject *keys) const);
|
||||
PY_EXTENSION(INLINE void clear_python_tag(PyObject *keys));
|
||||
PY_EXTENSION(INLINE PyObject *get_net_python_tag(PyObject *keys) const);
|
||||
PY_EXTENSION(INLINE bool has_net_python_tag(PyObject *keys) const);
|
||||
PY_EXTENSION(NodePath find_net_python_tag(PyObject *keys) const);
|
||||
PY_MAKE_PROPERTY(python_tags, get_python_tags);
|
||||
|
||||
EXTENSION(int __traverse__(visitproc visit, void *arg));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(int __traverse__(visitproc visit, void *arg));
|
||||
|
||||
INLINE void list_tags() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,10 +27,8 @@ class EXPCL_PANDA_PGRAPH NodePathCollection {
|
|||
PUBLISHED:
|
||||
NodePathCollection() = default;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(NodePathCollection(PyObject *self, PyObject *sequence));
|
||||
EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(NodePathCollection(PyObject *self, PyObject *sequence));
|
||||
PY_EXTENSION(PyObject *__reduce__(PyObject *self) const);
|
||||
|
||||
void add_path(const NodePath &node_path);
|
||||
bool remove_path(const NodePath &node_path);
|
||||
|
|
@ -74,9 +72,7 @@ PUBLISHED:
|
|||
|
||||
bool calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point) const;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *get_tight_bounds() const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *get_tight_bounds() const);
|
||||
|
||||
void set_texture(Texture *tex, int priority = 0);
|
||||
void set_texture(TextureStage *stage, Texture *tex, int priority = 0);
|
||||
|
|
|
|||
|
|
@ -106,10 +106,8 @@ PUBLISHED:
|
|||
virtual PandaNode *make_copy() const;
|
||||
PT(PandaNode) copy_subgraph(Thread *current_thread = Thread::get_current_thread()) const;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PT(PandaNode) __copy__() const);
|
||||
EXTENSION(PyObject *__deepcopy__(PyObject *self, PyObject *memo) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *__deepcopy__(PyObject *self, PyObject *memo) const);
|
||||
|
||||
INLINE int get_num_parents(Thread *current_thread = Thread::get_current_thread()) const;
|
||||
INLINE PandaNode *get_parent(int n, Thread *current_thread = Thread::get_current_thread()) const;
|
||||
|
|
@ -206,19 +204,17 @@ PUBLISHED:
|
|||
MAKE_MAP_PROPERTY(tags, has_tag, get_tag, set_tag, clear_tag);
|
||||
MAKE_MAP_KEYS_SEQ(tags, get_num_tags, get_tag_key);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *get_tag_keys() const);
|
||||
PY_EXTENSION(PyObject *get_tag_keys() const);
|
||||
|
||||
EXTENSION(PyObject *get_python_tags());
|
||||
EXTENSION(void set_python_tag(PyObject *key, PyObject *value));
|
||||
EXTENSION(PyObject *get_python_tag(PyObject *key) const);
|
||||
EXTENSION(bool has_python_tag(PyObject *key) const);
|
||||
EXTENSION(void clear_python_tag(PyObject *key));
|
||||
EXTENSION(PyObject *get_python_tag_keys() const);
|
||||
MAKE_PROPERTY(python_tags, get_python_tags);
|
||||
PY_EXTENSION(PyObject *get_python_tags());
|
||||
PY_EXTENSION(void set_python_tag(PyObject *key, PyObject *value));
|
||||
PY_EXTENSION(PyObject *get_python_tag(PyObject *key) const);
|
||||
PY_EXTENSION(bool has_python_tag(PyObject *key) const);
|
||||
PY_EXTENSION(void clear_python_tag(PyObject *key));
|
||||
PY_EXTENSION(PyObject *get_python_tag_keys() const);
|
||||
PY_MAKE_PROPERTY(python_tags, get_python_tags);
|
||||
|
||||
EXTENSION(int __traverse__(visitproc visit, void *arg));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(int __traverse__(visitproc visit, void *arg));
|
||||
|
||||
INLINE bool has_tags() const;
|
||||
void copy_tags(PandaNode *other);
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ PUBLISHED:
|
|||
bool cull_callback(CullTraverser *trav, const CullTraverserData &data) const;
|
||||
|
||||
INLINE static CPT(RenderState) make_empty();
|
||||
EXTENSION(static explicit CPT(RenderState) make(PyObject *args, PyObject *kwargs));
|
||||
PY_EXTENSION(static explicit CPT(RenderState) make(PyObject *args, PyObject *kwargs));
|
||||
|
||||
public:
|
||||
static CPT(RenderState) make(const RenderAttrib *attrib, int override = 0);
|
||||
|
|
@ -132,10 +132,8 @@ PUBLISHED:
|
|||
INLINE size_t get_invert_composition_cache_size() const;
|
||||
INLINE const RenderState *get_invert_composition_cache_source(size_t n) const;
|
||||
INLINE const RenderState *get_invert_composition_cache_result(size_t n) const;
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *get_composition_cache() const);
|
||||
EXTENSION(PyObject *get_invert_composition_cache() const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *get_composition_cache() const);
|
||||
PY_EXTENSION(PyObject *get_invert_composition_cache() const);
|
||||
|
||||
void output(std::ostream &out) const;
|
||||
void write(std::ostream &out, int indent_level) const;
|
||||
|
|
@ -150,10 +148,8 @@ PUBLISHED:
|
|||
static void list_cycles(std::ostream &out);
|
||||
static void list_states(std::ostream &out);
|
||||
static bool validate_states();
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(static PyObject *get_states());
|
||||
EXTENSION(static PyObject *get_unused_states());
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(static PyObject *get_states());
|
||||
PY_EXTENSION(static PyObject *get_unused_states());
|
||||
|
||||
PUBLISHED:
|
||||
// These methods are intended for use by low-level code, but they're also
|
||||
|
|
|
|||
|
|
@ -96,10 +96,8 @@ public:
|
|||
CPT(RenderAttrib) set_shader_inputs(const pvector<ShaderInput> &inputs) const;
|
||||
|
||||
PUBLISHED:
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(CPT(RenderAttrib) set_shader_input(CPT_InternalName, PyObject *, int priority=0) const);
|
||||
EXTENSION(CPT(RenderAttrib) set_shader_inputs(PyObject *args, PyObject *kwargs) const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(CPT(RenderAttrib) set_shader_input(CPT_InternalName, PyObject *, int priority=0) const);
|
||||
PY_EXTENSION(CPT(RenderAttrib) set_shader_inputs(PyObject *args, PyObject *kwargs) const);
|
||||
|
||||
CPT(RenderAttrib) set_instance_count(int instance_count) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,9 +49,7 @@ PUBLISHED:
|
|||
static const ShaderInput &get_blank();
|
||||
INLINE explicit ShaderInput(CPT_InternalName name, int priority=0);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(explicit ShaderInput(CPT_InternalName name, PyObject *value, int priority=0));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(explicit ShaderInput(CPT_InternalName name, PyObject *value, int priority=0));
|
||||
|
||||
public:
|
||||
INLINE ShaderInput(CPT_InternalName name, Texture *tex, int priority=0);
|
||||
|
|
|
|||
|
|
@ -194,10 +194,8 @@ PUBLISHED:
|
|||
INLINE const TransformState *get_invert_composition_cache_source(size_t n) const;
|
||||
INLINE const TransformState *get_invert_composition_cache_result(size_t n) const;
|
||||
bool validate_composition_cache() const;
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *get_composition_cache() const);
|
||||
EXTENSION(PyObject *get_invert_composition_cache() const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *get_composition_cache() const);
|
||||
PY_EXTENSION(PyObject *get_invert_composition_cache() const);
|
||||
|
||||
void output(std::ostream &out) const;
|
||||
void write(std::ostream &out, int indent_level) const;
|
||||
|
|
@ -210,10 +208,8 @@ PUBLISHED:
|
|||
static void list_cycles(std::ostream &out);
|
||||
static void list_states(std::ostream &out);
|
||||
static bool validate_states();
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(static PyObject *get_states());
|
||||
EXTENSION(static PyObject *get_unused_states());
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(static PyObject *get_states());
|
||||
PY_EXTENSION(static PyObject *get_unused_states());
|
||||
|
||||
public:
|
||||
static void init_states();
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include "texture.h"
|
||||
#include "ambientLight.h"
|
||||
#include "directionalLight.h"
|
||||
#include "renderModeAttrib.h"
|
||||
#include "rescaleNormalAttrib.h"
|
||||
#include "pointLight.h"
|
||||
#include "sphereLight.h"
|
||||
|
|
@ -567,6 +568,12 @@ analyze_renderstate(ShaderKey &key, const RenderState *rs) {
|
|||
if (rs->get_attrib(fog) && !fog->is_off()) {
|
||||
key._fog_mode = (int)fog->get_fog()->get_mode() + 1;
|
||||
}
|
||||
|
||||
// Hijack this field for the perspective render-mode flag.
|
||||
const RenderModeAttrib *render_mode;
|
||||
if (rs->get_attrib(render_mode) && render_mode->get_perspective()) {
|
||||
key._fog_mode |= 0x10000;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -754,6 +761,7 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
bool need_eye_position = key._lighting;
|
||||
bool need_eye_normal = !key._lights.empty() || ((key._outputs & AuxBitplaneAttrib::ABO_aux_normal) != 0);
|
||||
bool need_tangents = ((key._texture_flags & ShaderKey::TF_map_normal) != 0);
|
||||
bool need_point_size = (key._fog_mode & 0x10000) != 0;
|
||||
|
||||
// If we have binormal/tangent and eye position, we can pack eye normal in
|
||||
// the w channels of the others.
|
||||
|
|
@ -781,23 +789,34 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
}
|
||||
}
|
||||
|
||||
bool need_eye_reflection = false;
|
||||
bool need_fragment_view_to_world = false;
|
||||
|
||||
text << "void vshader(\n";
|
||||
for (size_t i = 0; i < key._textures.size(); ++i) {
|
||||
const ShaderKey::TextureInfo &tex = key._textures[i];
|
||||
|
||||
switch (tex._gen_mode) {
|
||||
case TexGenAttrib::M_world_position:
|
||||
need_world_position = true;
|
||||
case TexGenAttrib::M_world_cube_map:
|
||||
need_fragment_view_to_world = true;
|
||||
case TexGenAttrib::M_eye_sphere_map:
|
||||
case TexGenAttrib::M_eye_cube_map:
|
||||
need_eye_position = true;
|
||||
need_eye_normal = true;
|
||||
need_eye_reflection = true;
|
||||
break;
|
||||
case TexGenAttrib::M_world_normal:
|
||||
need_world_normal = true;
|
||||
break;
|
||||
case TexGenAttrib::M_eye_position:
|
||||
need_eye_position = true;
|
||||
break;
|
||||
case TexGenAttrib::M_eye_normal:
|
||||
need_eye_normal = true;
|
||||
break;
|
||||
case TexGenAttrib::M_world_position:
|
||||
need_world_position = true;
|
||||
break;
|
||||
case TexGenAttrib::M_eye_position:
|
||||
need_eye_position = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -866,7 +885,8 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
text << "\t uniform float4x4 trans_model_to_view,\n";
|
||||
eye_position_freg = alloc_freg();
|
||||
text << "\t out float4 l_eye_position : " << eye_position_freg << ",\n";
|
||||
} else if (need_tangents) {
|
||||
}
|
||||
else if (need_tangents || need_point_size) {
|
||||
text << "\t uniform float4x4 trans_model_to_view,\n";
|
||||
}
|
||||
if (need_eye_normal) {
|
||||
|
|
@ -883,7 +903,7 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
text << "\t uniform float4 mspos_view,\n";
|
||||
text << "\t out float3 l_eyevec,\n";
|
||||
}
|
||||
if (key._fog_mode != 0) {
|
||||
if ((key._fog_mode & 0xffff) != 0) {
|
||||
hpos_freg = alloc_freg();
|
||||
text << "\t out float4 l_hpos : " << hpos_freg << ",\n";
|
||||
}
|
||||
|
|
@ -923,6 +943,10 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
text << "\t in uint4 vtx_transform_index : " << transform_index_vreg << ",\n";
|
||||
}
|
||||
}
|
||||
if (need_point_size) {
|
||||
text << "\t uniform float3 attr_pointparams,\n";
|
||||
text << "\t out float l_point_size : PSIZE,\n";
|
||||
}
|
||||
text << "\t in float4 vtx_position : " << position_vreg << ",\n";
|
||||
text << "\t out float4 l_position : POSITION,\n";
|
||||
text << "\t uniform float4x4 mat_modelproj\n";
|
||||
|
|
@ -954,7 +978,7 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
}
|
||||
|
||||
text << "\t l_position = mul(mat_modelproj, vtx_position);\n";
|
||||
if (key._fog_mode != 0) {
|
||||
if ((key._fog_mode & 0xffff) != 0) {
|
||||
text << "\t l_hpos = l_position;\n";
|
||||
}
|
||||
if (need_world_position) {
|
||||
|
|
@ -966,6 +990,13 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
if (need_eye_position) {
|
||||
text << "\t l_eye_position = mul(trans_model_to_view, vtx_position);\n";
|
||||
}
|
||||
else if (need_point_size) {
|
||||
text << "\t float4 l_eye_position = mul(trans_model_to_view, vtx_position);\n";
|
||||
}
|
||||
if (need_point_size) {
|
||||
text << "\t l_point_size = attr_pointparams.y + attr_pointparams.z / length(l_eye_position.xyz);\n";
|
||||
}
|
||||
|
||||
pmap<const InternalName *, const char *>::const_iterator it;
|
||||
for (it = texcoord_fregs.begin(); it != texcoord_fregs.end(); ++it) {
|
||||
// Pass through all texcoord inputs as-is.
|
||||
|
|
@ -1011,7 +1042,7 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
// Fragment shader
|
||||
|
||||
text << "void fshader(\n";
|
||||
if (key._fog_mode != 0) {
|
||||
if ((key._fog_mode & 0xffff) != 0) {
|
||||
text << "\t in float4 l_hpos : " << hpos_freg << ",\n";
|
||||
text << "\t in uniform float4 attr_fog,\n";
|
||||
text << "\t in uniform float4 attr_fogcolor,\n";
|
||||
|
|
@ -1049,6 +1080,13 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
if (tex._flags & ShaderKey::TF_uses_color) {
|
||||
text << "\t uniform float4 texcolor_" << i << ",\n";
|
||||
}
|
||||
|
||||
if (tex._gen_mode == TexGenAttrib::M_constant) {
|
||||
text << "\t uniform float4 texconst_" << i << ",\n";
|
||||
}
|
||||
}
|
||||
if (need_fragment_view_to_world) {
|
||||
text << "\t uniform float3x3 trans_view_to_world,\n";
|
||||
}
|
||||
if (need_tangents) {
|
||||
text << "\t in float4 l_tangent : " << tangent_freg << ",\n";
|
||||
|
|
@ -1119,6 +1157,17 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
if (need_eye_normal && pack_eye_normal) {
|
||||
text << "\t float3 l_eye_normal = float3(l_tangent.w, l_binormal.w, l_eye_position.w);\n";
|
||||
}
|
||||
if (need_eye_normal) {
|
||||
text << "\t // Correct the surface normal for interpolation effects\n";
|
||||
text << "\t l_eye_normal = normalize(l_eye_normal);\n";
|
||||
}
|
||||
if (need_eye_reflection ||
|
||||
(need_eye_position && have_specular && (key._material_flags & Material::F_local) != 0 && !key._lights.empty())) {
|
||||
text << "\t float3 norm_eye_position = normalize(l_eye_position.xyz);\n";
|
||||
}
|
||||
if (need_eye_reflection) {
|
||||
text << "\t float3 eye_reflection = norm_eye_position - l_eye_normal * 2 * dot(l_eye_normal, norm_eye_position);\n";
|
||||
}
|
||||
|
||||
text << "\t float4 result;\n";
|
||||
if (key._outputs & (AuxBitplaneAttrib::ABO_aux_normal | AuxBitplaneAttrib::ABO_aux_glow)) {
|
||||
|
|
@ -1137,17 +1186,29 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
// Cg seems to be able to optimize this temporary away when appropriate.
|
||||
text << "\t float4 texcoord" << i << " = l_" << tex._texcoord_name->join("_") << ";\n";
|
||||
break;
|
||||
case TexGenAttrib::M_world_position:
|
||||
text << "\t float4 texcoord" << i << " = l_world_position;\n";
|
||||
case TexGenAttrib::M_eye_sphere_map:
|
||||
text << "\t float4 texcoord" << i << " = float4(eye_reflection.xz * (1.0f / (2.0f * length(eye_reflection + float3(0, -1, 0)))) + float2(0.5f, 0.5f), 0.0f, 1.0f);\n";
|
||||
break;
|
||||
case TexGenAttrib::M_world_cube_map:
|
||||
text << "\t float4 texcoord" << i << " = float4(mul(trans_view_to_world, eye_reflection), 1.0f);\n";
|
||||
break;
|
||||
case TexGenAttrib::M_eye_cube_map:
|
||||
text << "\t float4 texcoord" << i << " = float4(eye_reflection, 1.0f);\n";
|
||||
break;
|
||||
case TexGenAttrib::M_world_normal:
|
||||
text << "\t float4 texcoord" << i << " = l_world_normal;\n";
|
||||
break;
|
||||
case TexGenAttrib::M_eye_normal:
|
||||
text << "\t float4 texcoord" << i << " = float4(l_eye_normal, 1.0f);\n";
|
||||
break;
|
||||
case TexGenAttrib::M_world_position:
|
||||
text << "\t float4 texcoord" << i << " = l_world_position;\n";
|
||||
break;
|
||||
case TexGenAttrib::M_eye_position:
|
||||
text << "\t float4 texcoord" << i << " = float4(l_eye_position.xyz, 1.0f);\n";
|
||||
break;
|
||||
case TexGenAttrib::M_eye_normal:
|
||||
text << "\t float4 texcoord" << i << " = float4(l_eye_normal, 1.0f);\n";
|
||||
case TexGenAttrib::M_constant:
|
||||
text << "\t float4 texcoord" << i << " = texconst_" << i << ";\n";
|
||||
break;
|
||||
default:
|
||||
text << "\t float4 texcoord" << i << " = float4(0, 0, 0, 0);\n";
|
||||
|
|
@ -1218,6 +1279,9 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
text << "\t texcoord" << i << ".xyz -= parallax_offset;\n";
|
||||
}
|
||||
text << "\t float4 tex" << i << " = tex" << texture_type_as_string(tex._type);
|
||||
if (tex._type == Texture::TT_2d_texture) {
|
||||
text << "proj";
|
||||
}
|
||||
text << "(tex_" << i << ", texcoord" << i << ".";
|
||||
switch (tex._type) {
|
||||
case Texture::TT_cube_map:
|
||||
|
|
@ -1226,7 +1290,7 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
text << "xyz";
|
||||
break;
|
||||
case Texture::TT_2d_texture:
|
||||
text << "xy";
|
||||
text << "xyw";
|
||||
break;
|
||||
case Texture::TT_1d_texture:
|
||||
text << "x";
|
||||
|
|
@ -1237,10 +1301,6 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
text << ");\n";
|
||||
}
|
||||
}
|
||||
if (need_eye_normal) {
|
||||
text << "\t // Correct the surface normal for interpolation effects\n";
|
||||
text << "\t l_eye_normal = normalize(l_eye_normal);\n";
|
||||
}
|
||||
if (need_tangents) {
|
||||
text << "\t // Translate tangent-space normal in map to view-space.\n";
|
||||
|
||||
|
|
@ -1335,7 +1395,7 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
text << "\t tot_diffuse += lcolor;\n";
|
||||
if (have_specular) {
|
||||
if (key._material_flags & Material::F_local) {
|
||||
text << "\t lhalf = normalize(lvec - normalize(l_eye_position.xyz));\n";
|
||||
text << "\t lhalf = normalize(lvec - norm_eye_position);\n";
|
||||
} else {
|
||||
text << "\t lhalf = normalize(lvec - float3(0, 1, 0));\n";
|
||||
}
|
||||
|
|
@ -1370,7 +1430,7 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
text << "\t tot_diffuse += lcolor;\n";
|
||||
if (have_specular) {
|
||||
if (key._material_flags & Material::F_local) {
|
||||
text << "\t lhalf = normalize(lvec - normalize(l_eye_position.xyz));\n";
|
||||
text << "\t lhalf = normalize(lvec - norm_eye_position);\n";
|
||||
} else {
|
||||
text << "\t lhalf = normalize(lvec - float3(0, 1, 0));\n";
|
||||
}
|
||||
|
|
@ -1410,7 +1470,7 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
text << "\t tot_diffuse += lcolor;\n";
|
||||
if (have_specular) {
|
||||
if (key._material_flags & Material::F_local) {
|
||||
text << "\t lhalf = normalize(lvec - normalize(l_eye_position.xyz));\n";
|
||||
text << "\t lhalf = normalize(lvec - norm_eye_position);\n";
|
||||
} else {
|
||||
text << "\t lhalf = normalize(lvec - float3(0,1,0));\n";
|
||||
}
|
||||
|
|
@ -1680,8 +1740,8 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
}
|
||||
|
||||
// Apply fog.
|
||||
if (key._fog_mode != 0) {
|
||||
Fog::Mode fog_mode = (Fog::Mode)(key._fog_mode - 1);
|
||||
if ((key._fog_mode & 0xffff) != 0) {
|
||||
Fog::Mode fog_mode = (Fog::Mode)((key._fog_mode & 0xffff) - 1);
|
||||
switch (fog_mode) {
|
||||
case Fog::M_linear:
|
||||
text << "\t result.rgb = lerp(attr_fogcolor.rgb, result.rgb, saturate((attr_fog.z - l_hpos.z) * attr_fog.w));\n";
|
||||
|
|
@ -1726,6 +1786,9 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||
if (flags != 0) {
|
||||
shattr = DCAST(ShaderAttrib, shattr)->set_flag(flags, true);
|
||||
}
|
||||
if (need_point_size) {
|
||||
shattr = DCAST(ShaderAttrib, shattr)->set_flag(ShaderAttrib::F_shader_point_size, true);
|
||||
}
|
||||
|
||||
reset_register_allocator();
|
||||
|
||||
|
|
|
|||
|
|
@ -150,6 +150,7 @@ protected:
|
|||
bool _lighting;
|
||||
bool _have_separate_ambient;
|
||||
|
||||
// Also contains bit 0x10000 indicating perspective point mode
|
||||
int _fog_mode;
|
||||
|
||||
int _outputs;
|
||||
|
|
|
|||
|
|
@ -49,11 +49,9 @@ PUBLISHED:
|
|||
|
||||
void operator = (const Mutex ©) = delete;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(bool acquire(bool blocking=true) const);
|
||||
EXTENSION(bool __enter__());
|
||||
EXTENSION(void __exit__(PyObject *, PyObject *, PyObject *));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(bool __enter__());
|
||||
PY_EXTENSION(void __exit__(PyObject *, PyObject *, PyObject *));
|
||||
public:
|
||||
// This is a global mutex set aside for the purpose of protecting Notify
|
||||
// messages from being interleaved between threads.
|
||||
|
|
|
|||
|
|
@ -43,11 +43,9 @@ PUBLISHED:
|
|||
|
||||
void operator = (const ReMutex ©) = delete;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(bool acquire(bool blocking=true) const);
|
||||
EXTENSION(bool __enter__());
|
||||
EXTENSION(void __exit__(PyObject *, PyObject *, PyObject *));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(bool __enter__());
|
||||
PY_EXTENSION(void __exit__(PyObject *, PyObject *, PyObject *));
|
||||
};
|
||||
|
||||
#include "reMutex.I"
|
||||
|
|
|
|||
|
|
@ -66,6 +66,10 @@ Thread::
|
|||
nassertv(_blocked_on_mutex == nullptr &&
|
||||
_waiting_on_cvar == nullptr);
|
||||
#endif
|
||||
|
||||
if (_pstats_callback != nullptr) {
|
||||
_pstats_callback->delete_hook(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -251,3 +255,11 @@ deactivate_hook(Thread *) {
|
|||
void Thread::PStatsCallback::
|
||||
activate_hook(Thread *) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the thread is deleted. This provides a callback hook for PStats
|
||||
* to remove a thread's data when the thread is removed.
|
||||
*/
|
||||
void Thread::PStatsCallback::
|
||||
delete_hook(Thread *) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@ public:
|
|||
virtual ~PStatsCallback();
|
||||
virtual void deactivate_hook(Thread *thread);
|
||||
virtual void activate_hook(Thread *thread);
|
||||
virtual void delete_hook(Thread *thread);
|
||||
};
|
||||
|
||||
INLINE void set_pstats_index(int pstats_index);
|
||||
|
|
|
|||
|
|
@ -170,11 +170,9 @@ PUBLISHED:
|
|||
|
||||
void output(std::ostream &out) const;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *get_points() const);
|
||||
PY_EXTENSION(PyObject *get_points() const);
|
||||
|
||||
EXTENSION(int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const);
|
||||
#endif
|
||||
PY_EXTENSION(int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const);
|
||||
|
||||
public:
|
||||
INLINE const vector_float &get_table() const;
|
||||
|
|
|
|||
|
|
@ -19,11 +19,16 @@
|
|||
#include "config_pnmimage.h"
|
||||
#include "perlinNoise2.h"
|
||||
#include "stackedPerlinNoise2.h"
|
||||
#include "pStatCollector.h"
|
||||
#include "pStatTimer.h"
|
||||
#include <algorithm>
|
||||
|
||||
using std::max;
|
||||
using std::min;
|
||||
|
||||
static PStatCollector _image_read_pcollector("*:PNMImage:read");
|
||||
static PStatCollector _image_write_pcollector("*:PNMImage:write");
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
@ -319,6 +324,8 @@ read(std::istream &data, const std::string &filename, PNMFileType *type,
|
|||
*/
|
||||
bool PNMImage::
|
||||
read(PNMReader *reader) {
|
||||
PStatTimer timer(_image_read_pcollector);
|
||||
|
||||
bool has_read_size = _has_read_size;
|
||||
int read_x_size = _read_x_size;
|
||||
int read_y_size = _read_y_size;
|
||||
|
|
@ -437,6 +444,8 @@ write(PNMWriter *writer) const {
|
|||
return false;
|
||||
}
|
||||
|
||||
PStatTimer timer(_image_write_pcollector);
|
||||
|
||||
writer->copy_header_from(*this);
|
||||
|
||||
if (!writer->supports_integer()) {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
#include "clockObject.h"
|
||||
#include "neverFreeMemory.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using std::string;
|
||||
|
||||
PStatCollector PStatClient::_heap_total_size_pcollector("System memory:Heap");
|
||||
|
|
@ -415,6 +417,7 @@ client_main_tick() {
|
|||
vi != indices.end();
|
||||
++vi) {
|
||||
InternalThread *thread = get_thread_ptr(*vi);
|
||||
nassertd(thread != nullptr) continue;
|
||||
_impl->new_frame(*vi, thread->_frame_number);
|
||||
thread->_frame_number = clock->get_frame_count(get_thread_object(*vi));
|
||||
}
|
||||
|
|
@ -483,10 +486,12 @@ client_disconnect() {
|
|||
ThreadPointer *threads = _threads.load(std::memory_order_relaxed);
|
||||
for (int ti = 0; ti < get_num_threads(); ++ti) {
|
||||
InternalThread *thread = threads[ti];
|
||||
thread->_frame_number = 0;
|
||||
thread->_is_active = false;
|
||||
thread->_next_packet = 0.0;
|
||||
thread->_frame_data.clear();
|
||||
if (thread != nullptr) {
|
||||
thread->_frame_number = 0;
|
||||
thread->_is_active = false;
|
||||
thread->_next_packet = 0.0;
|
||||
thread->_frame_data.clear();
|
||||
}
|
||||
}
|
||||
|
||||
CollectorPointer *collectors = _collectors.load(std::memory_order_relaxed);
|
||||
|
|
@ -1233,6 +1238,54 @@ activate_hook(Thread *thread) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the thread is deleted. This provides a callback hook for PStats
|
||||
* to remove a thread's data when the thread is removed.
|
||||
*/
|
||||
void PStatClient::
|
||||
delete_hook(Thread *thread) {
|
||||
int thread_index = thread->get_pstats_index();
|
||||
if (thread_index < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
PStatClientImpl *impl;
|
||||
InternalThread *ithread;
|
||||
{
|
||||
ReMutexHolder holder(_lock);
|
||||
impl = _impl;
|
||||
if (impl == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!impl->client_is_connected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
MultiThingsByName::iterator ni;
|
||||
|
||||
ni = _threads_by_name.find(thread->get_name());
|
||||
if (ni != _threads_by_name.end()) {
|
||||
ni->second.erase(std::remove(ni->second.begin(), ni->second.end(), thread_index));
|
||||
}
|
||||
|
||||
ni = _threads_by_sync_name.find(thread->get_sync_name());
|
||||
if (ni != _threads_by_sync_name.end()) {
|
||||
ni->second.erase(std::remove(ni->second.begin(), ni->second.end(), thread_index));
|
||||
}
|
||||
|
||||
// This load can be relaxed because we hold the lock.
|
||||
ThreadPointer *threads = _threads.load(std::memory_order_relaxed);
|
||||
ithread = threads[thread_index];
|
||||
ithread->_is_active = false;
|
||||
ithread->_thread_active = false;
|
||||
threads[thread_index] = nullptr;
|
||||
}
|
||||
|
||||
impl->remove_thread(thread_index);
|
||||
delete ithread;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the new PStatCollectorDef for this collector.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ private:
|
|||
|
||||
virtual void deactivate_hook(Thread *thread);
|
||||
virtual void activate_hook(Thread *thread);
|
||||
virtual void delete_hook(Thread *thread);
|
||||
|
||||
private:
|
||||
// This mutex protects everything in this class.
|
||||
|
|
|
|||
|
|
@ -328,6 +328,7 @@ new_frame(int thread_index, int frame_number) {
|
|||
nassertv(thread_index >= 0 && thread_index < _client->_num_threads);
|
||||
|
||||
PStatClient::InternalThread *pthread = _client->get_thread_ptr(thread_index);
|
||||
nassertv(pthread != nullptr);
|
||||
|
||||
// If we're the main thread, we should exchange control packets with the
|
||||
// server.
|
||||
|
|
@ -428,6 +429,7 @@ add_frame(int thread_index, int frame_number, PStatFrameData &&frame_data) {
|
|||
nassertv(thread_index >= 0 && thread_index < _client->_num_threads);
|
||||
|
||||
PStatClient::InternalThread *pthread = _client->get_thread_ptr(thread_index);
|
||||
nassertv(pthread != nullptr);
|
||||
|
||||
// If we're the main thread, we should exchange control packets with the
|
||||
// server.
|
||||
|
|
@ -458,6 +460,22 @@ add_frame(int thread_index, int frame_number, PStatFrameData &&frame_data) {
|
|||
_client->stop(pstats_index, current_thread_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a thread from PStats.
|
||||
*/
|
||||
void PStatClientImpl::
|
||||
remove_thread(int thread_index) {
|
||||
nassertv(thread_index >= 0 && thread_index < _client->_num_threads);
|
||||
|
||||
PStatClientControlMessage message;
|
||||
message._type = PStatClientControlMessage::T_expire_thread;
|
||||
message._first_thread_index = thread_index;
|
||||
|
||||
Datagram datagram;
|
||||
message.encode(datagram);
|
||||
_writer.send(datagram, _tcp_connection, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Passes off the frame data to the writer thread. If threading is disabled,
|
||||
* transmits it right away.
|
||||
|
|
@ -541,6 +559,8 @@ transmit_frame_data(int thread_index, int frame_number,
|
|||
const PStatFrameData &frame_data) {
|
||||
nassertv(thread_index >= 0 && thread_index < _client->_num_threads);
|
||||
PStatClient::InternalThread *thread = _client->get_thread_ptr(thread_index);
|
||||
nassertv(thread != nullptr);
|
||||
|
||||
if (_is_connected && thread->_is_active) {
|
||||
|
||||
// We don't want to send too many packets in a hurry and flood the server.
|
||||
|
|
@ -680,12 +700,6 @@ send_hello() {
|
|||
message._major_version = get_current_pstat_major_version();
|
||||
message._minor_version = get_current_pstat_minor_version();
|
||||
|
||||
// The Python profiling feature may send nested start/stop pairs, so requires
|
||||
// a server version capable of dealing with this.
|
||||
if (pstats_python_profiler && message._major_version <= 3) {
|
||||
message._major_version = 3;
|
||||
message._minor_version = std::max(message._minor_version, 1);
|
||||
}
|
||||
|
||||
Datagram datagram;
|
||||
message.encode(datagram);
|
||||
|
|
@ -733,7 +747,11 @@ report_new_threads() {
|
|||
PStatClient::ThreadPointer *threads =
|
||||
(PStatClient::ThreadPointer *)_client->_threads;
|
||||
while (_threads_reported < _client->_num_threads) {
|
||||
message._names.push_back(threads[_threads_reported]->_name);
|
||||
if (threads[_threads_reported] != nullptr) {
|
||||
message._names.push_back(threads[_threads_reported]->_name);
|
||||
} else {
|
||||
message._names.push_back(std::string());
|
||||
}
|
||||
_threads_reported++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ public:
|
|||
void new_frame(int thread_index, int frame_number = -1);
|
||||
void add_frame(int thread_index, int frame_number, PStatFrameData &&frame_data);
|
||||
|
||||
void remove_thread(int thread_index);
|
||||
|
||||
private:
|
||||
void enqueue_frame_data(int thread_index, int frame_number,
|
||||
PStatFrameData &&frame_data);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ write_datagram(Datagram &destination, PStatClient *client) const {
|
|||
|
||||
#if !defined(WORDS_BIGENDIAN) || defined(__GNUC__)
|
||||
// Hand-roll this, significantly more efficient for many data points
|
||||
size_t size = (_time_data.size() + _level_data.size()) * 6 + 4;
|
||||
size_t size = (_time_data.size() + _level_data.size()) * 6 + 8;
|
||||
PTA_uchar array = destination.modify_array();
|
||||
size_t offset = array.size();
|
||||
array.resize(offset + size);
|
||||
|
|
@ -53,7 +53,8 @@ write_datagram(Datagram &destination, PStatClient *client) const {
|
|||
uint16_t *ptr = (uint16_t *)data;
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
*ptr++ = __builtin_bswap16(_time_data.size());
|
||||
*(uint32_t *)ptr = __builtin_bswap32(_time_data.size());
|
||||
ptr += 2;
|
||||
|
||||
for (const DataPoint &dp : _time_data) {
|
||||
*ptr++ = __builtin_bswap16(dp._index);
|
||||
|
|
@ -62,7 +63,9 @@ write_datagram(Datagram &destination, PStatClient *client) const {
|
|||
ptr += 2;
|
||||
}
|
||||
|
||||
*ptr++ = __builtin_bswap16(_level_data.size());
|
||||
*(uint32_t *)ptr = __builtin_bswap16(_level_data.size());
|
||||
ptr += 2;
|
||||
|
||||
for (const DataPoint &dp : _level_data) {
|
||||
*ptr++ = __builtin_bswap16(dp._index);
|
||||
PN_float32 v = (PN_float32)dp._value;
|
||||
|
|
@ -70,7 +73,8 @@ write_datagram(Datagram &destination, PStatClient *client) const {
|
|||
ptr += 2;
|
||||
}
|
||||
#else
|
||||
*ptr++ = _time_data.size();
|
||||
*(uint32_t *)ptr = _time_data.size();
|
||||
ptr += 2;
|
||||
|
||||
for (const DataPoint &dp : _time_data) {
|
||||
*ptr++ = dp._index;
|
||||
|
|
@ -78,7 +82,9 @@ write_datagram(Datagram &destination, PStatClient *client) const {
|
|||
ptr += 2;
|
||||
}
|
||||
|
||||
*ptr++ = _level_data.size();
|
||||
*(uint32_t *)ptr = _level_data.size();
|
||||
ptr += 2;
|
||||
|
||||
for (const DataPoint &dp : _level_data) {
|
||||
*ptr++ = dp._index;
|
||||
*(PN_float32 *)ptr = dp._value;
|
||||
|
|
@ -87,12 +93,12 @@ write_datagram(Datagram &destination, PStatClient *client) const {
|
|||
#endif
|
||||
|
||||
#else
|
||||
destination.add_uint16(_time_data.size());
|
||||
destination.add_uint32(_time_data.size());
|
||||
for (const DataPoint &dp : _time_data) {
|
||||
destination.add_uint16(dp._index);
|
||||
destination.add_float32(dp._value);
|
||||
}
|
||||
destination.add_uint16(_level_data.size());
|
||||
destination.add_uint32(_level_data.size());
|
||||
for (const DataPoint &dp : _level_data) {
|
||||
destination.add_uint16(dp._index);
|
||||
destination.add_float32(dp._value);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
using std::string;
|
||||
|
||||
static const int current_pstat_major_version = 3;
|
||||
static const int current_pstat_minor_version = 0;
|
||||
static const int current_pstat_minor_version = 2;
|
||||
// Initialized at 2.0 on 5/18/01, when version numbers were first added.
|
||||
// Incremented to 2.1 on 5/21/01 to add support for TCP frame data.
|
||||
// Incremented to 3.0 on 4/28/05 to bump TCP headers to 32 bits.
|
||||
|
|
|
|||
|
|
@ -148,18 +148,14 @@ PUBLISHED:
|
|||
INLINE int get_current_major_ver() const;
|
||||
INLINE int get_current_minor_ver() const;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
EXTENSION(PyObject *get_file_version() const);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(PyObject *get_file_version() const);
|
||||
|
||||
PUBLISHED:
|
||||
MAKE_PROPERTY(source, get_source, set_source);
|
||||
MAKE_PROPERTY(filename, get_filename);
|
||||
MAKE_PROPERTY(loader_options, get_loader_options, set_loader_options);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
MAKE_PROPERTY(file_version, get_file_version);
|
||||
#endif // HAVE_PYTHON
|
||||
PY_MAKE_PROPERTY(file_version, get_file_version);
|
||||
MAKE_PROPERTY(file_endian, get_file_endian);
|
||||
MAKE_PROPERTY(file_stdfloat_double, get_file_stdfloat_double);
|
||||
|
||||
|
|
@ -205,10 +201,8 @@ public:
|
|||
void *user_data = nullptr);
|
||||
INLINE static WritableFactory *get_factory();
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
PUBLISHED:
|
||||
EXTENSION(static void register_factory(TypeHandle handle, PyObject *func));
|
||||
#endif // HAVE_PYTHON
|
||||
PY_EXTENSION(static void register_factory(TypeHandle handle, PyObject *func));
|
||||
|
||||
private:
|
||||
INLINE static void create_factory();
|
||||
|
|
|
|||
|
|
@ -177,15 +177,15 @@ extract(int low_bit, int size) const {
|
|||
|
||||
if (b + size < num_bits_per_word) {
|
||||
// The whole thing fits within one word of the array.
|
||||
return get_word(w).extract(b, size);
|
||||
return get_word_internal(w).extract(b, size);
|
||||
|
||||
} else {
|
||||
// We have to split it across two words.
|
||||
int num_lower_bits = num_bits_per_word - b;
|
||||
int num_higher_bits = size - num_lower_bits;
|
||||
|
||||
return get_word(w).extract(b, num_lower_bits) |
|
||||
(get_word(w + 1).extract(0, num_higher_bits) << num_lower_bits);
|
||||
return get_word_internal(w).extract(b, num_lower_bits) |
|
||||
(get_word_internal(w + 1).extract(0, num_higher_bits) << num_lower_bits);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -241,17 +241,24 @@ get_num_words() const {
|
|||
* get_num_words(), but the return value beyond get_num_words() will always be
|
||||
* the same.
|
||||
*/
|
||||
INLINE BitArray::MaskType BitArray::
|
||||
INLINE BitArray::WordType BitArray::
|
||||
get_word(size_t n) const {
|
||||
return get_word_internal(n).get_word();
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal implementation of get_word that returns MaskType.
|
||||
*/
|
||||
INLINE BitArray::MaskType BitArray::
|
||||
get_word_internal(size_t n) const {
|
||||
nassertr(n >= 0, MaskType::all_off());
|
||||
if (n < get_num_words()) {
|
||||
return _array[n];
|
||||
}
|
||||
if (_highest_bits) {
|
||||
return MaskType::all_on();
|
||||
} else {
|
||||
return MaskType::all_off();
|
||||
}
|
||||
return MaskType::all_off();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue