mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 03:15:07 -04:00
general: Add constness to some methods where it is missing
This commit is contained in:
parent
cee1de7338
commit
67fc72bdaf
@ -51,7 +51,7 @@ void GPUCommandList::add_command(const GPUCommand& cmd) {
|
|||||||
* list, and are waiting to get processed.
|
* list, and are waiting to get processed.
|
||||||
* @return Amount of commands
|
* @return Amount of commands
|
||||||
*/
|
*/
|
||||||
size_t GPUCommandList::get_num_commands() {
|
size_t GPUCommandList::get_num_commands() const {
|
||||||
return _commands.size();
|
return _commands.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ PUBLISHED:
|
|||||||
GPUCommandList();
|
GPUCommandList();
|
||||||
|
|
||||||
void add_command(const GPUCommand& cmd);
|
void add_command(const GPUCommand& cmd);
|
||||||
size_t get_num_commands();
|
size_t get_num_commands() const;
|
||||||
size_t write_commands_to(const PTA_uchar &dest, size_t limit = 32);
|
size_t write_commands_to(const PTA_uchar &dest, size_t limit = 32);
|
||||||
|
|
||||||
MAKE_PROPERTY(num_commands, get_num_commands);
|
MAKE_PROPERTY(num_commands, get_num_commands);
|
||||||
|
@ -175,7 +175,7 @@ inline void PSSMCameraRig::reset_film_size_cache() {
|
|||||||
* @param index Index of the camera.
|
* @param index Index of the camera.
|
||||||
* @return [description]
|
* @return [description]
|
||||||
*/
|
*/
|
||||||
inline NodePath PSSMCameraRig::get_camera(size_t index) {
|
inline NodePath PSSMCameraRig::get_camera(size_t index) const {
|
||||||
nassertr(index >= 0 && index < _cam_nodes.size(), NodePath());
|
nassertr(index >= 0 && index < _cam_nodes.size(), NodePath());
|
||||||
return _cam_nodes[index];
|
return _cam_nodes[index];
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ inline NodePath PSSMCameraRig::get_camera(size_t index) {
|
|||||||
* @param split_index The index of the split
|
* @param split_index The index of the split
|
||||||
* @return Distance of the split, ranging from 0 .. 1
|
* @return Distance of the split, ranging from 0 .. 1
|
||||||
*/
|
*/
|
||||||
inline float PSSMCameraRig::get_split_start(size_t split_index) {
|
inline float PSSMCameraRig::get_split_start(size_t split_index) const {
|
||||||
float x = (float)split_index / (float)_cam_nodes.size();
|
float x = (float)split_index / (float)_cam_nodes.size();
|
||||||
return (exp(_logarithmic_factor*x)-1) / (exp(_logarithmic_factor)-1);
|
return (exp(_logarithmic_factor*x)-1) / (exp(_logarithmic_factor)-1);
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ inline float PSSMCameraRig::get_split_start(size_t split_index) {
|
|||||||
*
|
*
|
||||||
* @return interpolated point in world space
|
* @return interpolated point in world space
|
||||||
*/
|
*/
|
||||||
inline LPoint3 PSSMCameraRig::get_interpolated_point(CoordinateOrigin origin, float depth) {
|
inline LPoint3 PSSMCameraRig::get_interpolated_point(CoordinateOrigin origin, float depth) const {
|
||||||
nassertr(depth >= 0.0 && depth <= 1.0, LPoint3());
|
nassertr(depth >= 0.0 && depth <= 1.0, LPoint3());
|
||||||
return _curr_near_points[origin] * (1.0 - depth) + _curr_far_points[origin] * depth;
|
return _curr_near_points[origin] * (1.0 - depth) + _curr_far_points[origin] * depth;
|
||||||
}
|
}
|
||||||
@ -222,7 +222,7 @@ inline LPoint3 PSSMCameraRig::get_interpolated_point(CoordinateOrigin origin, fl
|
|||||||
*
|
*
|
||||||
* @return view-projection matrix array
|
* @return view-projection matrix array
|
||||||
*/
|
*/
|
||||||
inline const PTA_LMatrix4 &PSSMCameraRig::get_mvp_array() {
|
inline const PTA_LMatrix4 &PSSMCameraRig::get_mvp_array() const {
|
||||||
return _camera_mvps;
|
return _camera_mvps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,6 +238,6 @@ inline const PTA_LMatrix4 &PSSMCameraRig::get_mvp_array() {
|
|||||||
*
|
*
|
||||||
* @return Array of near and far planes
|
* @return Array of near and far planes
|
||||||
*/
|
*/
|
||||||
inline const PTA_LVecBase2 &PSSMCameraRig::get_nearfar_array() {
|
inline const PTA_LVecBase2 &PSSMCameraRig::get_nearfar_array() const {
|
||||||
return _camera_nearfar;
|
return _camera_nearfar;
|
||||||
}
|
}
|
||||||
|
@ -72,11 +72,11 @@ PUBLISHED:
|
|||||||
void update(NodePath cam_node, const LVecBase3 &light_vector);
|
void update(NodePath cam_node, const LVecBase3 &light_vector);
|
||||||
inline void reset_film_size_cache();
|
inline void reset_film_size_cache();
|
||||||
|
|
||||||
inline NodePath get_camera(size_t index);
|
inline NodePath get_camera(size_t index) const;
|
||||||
|
|
||||||
void reparent_to(NodePath parent);
|
void reparent_to(NodePath parent);
|
||||||
inline const PTA_LMatrix4 &get_mvp_array();
|
inline const PTA_LMatrix4 &get_mvp_array() const;
|
||||||
inline const PTA_LVecBase2 &get_nearfar_array();
|
inline const PTA_LVecBase2 &get_nearfar_array() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Used to access the near and far points in the array
|
// Used to access the near and far points in the array
|
||||||
@ -91,9 +91,9 @@ protected:
|
|||||||
void init_cam_nodes();
|
void init_cam_nodes();
|
||||||
void compute_pssm_splits(const LMatrix4& transform, float max_distance,
|
void compute_pssm_splits(const LMatrix4& transform, float max_distance,
|
||||||
const LVecBase3 &light_vector);
|
const LVecBase3 &light_vector);
|
||||||
inline float get_split_start(size_t split_index);
|
inline float get_split_start(size_t split_index) const;
|
||||||
LMatrix4 compute_mvp(size_t cam_index);
|
LMatrix4 compute_mvp(size_t cam_index);
|
||||||
inline LPoint3 get_interpolated_point(CoordinateOrigin origin, float depth);
|
inline LPoint3 get_interpolated_point(CoordinateOrigin origin, float depth) const;
|
||||||
LVecBase3 get_snap_offset(const LMatrix4& mat, size_t resolution);
|
LVecBase3 get_snap_offset(const LMatrix4& mat, size_t resolution);
|
||||||
|
|
||||||
std::vector<NodePath> _cam_nodes;
|
std::vector<NodePath> _cam_nodes;
|
||||||
|
@ -83,11 +83,11 @@ apply_state(const std::string& state, NodePath np, Shader* shader,
|
|||||||
* @return Bit mask of the render pass
|
* @return Bit mask of the render pass
|
||||||
*/
|
*/
|
||||||
inline BitMask32 TagStateManager::
|
inline BitMask32 TagStateManager::
|
||||||
get_mask(const std::string &container_name) {
|
get_mask(const std::string &container_name) const {
|
||||||
if (container_name == "gbuffer") {
|
if (container_name == "gbuffer") {
|
||||||
return BitMask32::bit(1);
|
return BitMask32::bit(1);
|
||||||
}
|
}
|
||||||
ContainerList::iterator entry = _containers.find(container_name);
|
ContainerList::const_iterator entry = _containers.find(container_name);
|
||||||
nassertr(entry != _containers.end(), BitMask32());
|
nassertr(entry != _containers.end(), BitMask32());
|
||||||
return entry->second.mask;
|
return entry->second.mask;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ PUBLISHED:
|
|||||||
|
|
||||||
inline void register_camera(const std::string& state, Camera* source);
|
inline void register_camera(const std::string& state, Camera* source);
|
||||||
inline void unregister_camera(const std::string& state, Camera* source);
|
inline void unregister_camera(const std::string& state, Camera* source);
|
||||||
inline BitMask32 get_mask(const std::string &container_name);
|
inline BitMask32 get_mask(const std::string &container_name) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::vector<Camera*> CameraList;
|
typedef std::vector<Camera*> CameraList;
|
||||||
|
@ -77,7 +77,7 @@ PUBLISHED:
|
|||||||
|
|
||||||
#ifdef HAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
static int size() { return 3; }
|
static int size() { return 3; }
|
||||||
void output(std::ostream &out) {
|
void output(std::ostream &out) const {
|
||||||
out << "pixel(r=" << r << ", g=" << g << ", b=" << b << ")";
|
out << "pixel(r=" << r << ", g=" << g << ", b=" << b << ")";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -37,6 +37,6 @@ set_value(int n) {
|
|||||||
* Retreives a value that was previously stored.
|
* Retreives a value that was previously stored.
|
||||||
*/
|
*/
|
||||||
INLINE int BasicSkel::
|
INLINE int BasicSkel::
|
||||||
get_value() {
|
get_value() const {
|
||||||
return _value;
|
return _value;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,6 @@ set_value_alt(int n) {
|
|||||||
* get_value, except that this isn't an inline function.
|
* get_value, except that this isn't an inline function.
|
||||||
*/
|
*/
|
||||||
int BasicSkel::
|
int BasicSkel::
|
||||||
get_value_alt() {
|
get_value_alt() const {
|
||||||
return _value;
|
return _value;
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,11 @@ PUBLISHED:
|
|||||||
|
|
||||||
// These inline functions allow you to get and set _value.
|
// These inline functions allow you to get and set _value.
|
||||||
INLINE void set_value(int n);
|
INLINE void set_value(int n);
|
||||||
INLINE int get_value();
|
INLINE int get_value() const;
|
||||||
|
|
||||||
// These do the same thing as the functions above.
|
// These do the same thing as the functions above.
|
||||||
void set_value_alt(int n);
|
void set_value_alt(int n);
|
||||||
int get_value_alt();
|
int get_value_alt() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _value;
|
int _value;
|
||||||
|
@ -37,6 +37,6 @@ set_value(int n) {
|
|||||||
* Retreives a value that was previously stored.
|
* Retreives a value that was previously stored.
|
||||||
*/
|
*/
|
||||||
INLINE int TypedSkel::
|
INLINE int TypedSkel::
|
||||||
get_value() {
|
get_value() const {
|
||||||
return _value;
|
return _value;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,6 @@ set_value_alt(int n) {
|
|||||||
* get_value, except that this isn't an inline function.
|
* get_value, except that this isn't an inline function.
|
||||||
*/
|
*/
|
||||||
int TypedSkel::
|
int TypedSkel::
|
||||||
get_value_alt() {
|
get_value_alt() const {
|
||||||
return _value;
|
return _value;
|
||||||
}
|
}
|
||||||
|
@ -31,11 +31,11 @@ PUBLISHED:
|
|||||||
|
|
||||||
// These inline functions allow you to get and set _value.
|
// These inline functions allow you to get and set _value.
|
||||||
INLINE void set_value(int n);
|
INLINE void set_value(int n);
|
||||||
INLINE int get_value();
|
INLINE int get_value() const;
|
||||||
|
|
||||||
// These do the same thing as the functions above.
|
// These do the same thing as the functions above.
|
||||||
void set_value_alt(int n);
|
void set_value_alt(int n);
|
||||||
int get_value_alt();
|
int get_value_alt() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _value;
|
int _value;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user