mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
Add setDepthOffset etc.
This commit is contained in:
parent
2b7462be95
commit
f33032dd6b
@ -35,6 +35,7 @@
|
|||||||
#include "alphaTestAttrib.h"
|
#include "alphaTestAttrib.h"
|
||||||
#include "depthTestAttrib.h"
|
#include "depthTestAttrib.h"
|
||||||
#include "depthWriteAttrib.h"
|
#include "depthWriteAttrib.h"
|
||||||
|
#include "depthOffsetAttrib.h"
|
||||||
#include "shaderAttrib.h"
|
#include "shaderAttrib.h"
|
||||||
#include "billboardEffect.h"
|
#include "billboardEffect.h"
|
||||||
#include "compassEffect.h"
|
#include "compassEffect.h"
|
||||||
@ -5251,6 +5252,74 @@ get_depth_write() const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: NodePath::set_depth_offset
|
||||||
|
// Access: Published
|
||||||
|
// Description: This instructs the graphics driver to apply an
|
||||||
|
// offset or bias to the generated depth values for
|
||||||
|
// rendered polygons, before they are written to the
|
||||||
|
// depth buffer. This can be used to shift polygons
|
||||||
|
// forward slightly, to resolve depth conflicts, or
|
||||||
|
// self-shadowing artifacts on thin objects.
|
||||||
|
// The bias is always an integer number, and each
|
||||||
|
// integer increment represents the smallest possible
|
||||||
|
// increment in Z that is sufficient to completely
|
||||||
|
// resolve two coplanar polygons. Positive numbers
|
||||||
|
// are closer towards the camera.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void NodePath::
|
||||||
|
set_depth_offset(int bias, int priority) {
|
||||||
|
nassertv_always(!is_empty());
|
||||||
|
|
||||||
|
node()->set_attrib(DepthOffsetAttrib::make(bias), priority);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: NodePath::clear_depth_offset
|
||||||
|
// Access: Published
|
||||||
|
// Description: Completely removes any depth-offset adjustment that
|
||||||
|
// may have been set on this node via set_depth_offset().
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void NodePath::
|
||||||
|
clear_depth_offset() {
|
||||||
|
nassertv_always(!is_empty());
|
||||||
|
node()->clear_attrib(DepthOffsetAttrib::get_class_slot());
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: NodePath::has_depth_offset
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if a depth-offset adjustment has been
|
||||||
|
// explicitly set on this particular node via
|
||||||
|
// set_depth_offset(). If this returns true, then
|
||||||
|
// get_depth_offset() may be called to determine which has
|
||||||
|
// been set.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool NodePath::
|
||||||
|
has_depth_offset() const {
|
||||||
|
nassertr_always(!is_empty(), false);
|
||||||
|
return node()->has_attrib(DepthOffsetAttrib::get_class_slot());
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: NodePath::get_depth_offset
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns the depth offset value if it has been
|
||||||
|
// specified using set_depth_offset, or 0 if not.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
int NodePath::
|
||||||
|
get_depth_offset() const {
|
||||||
|
nassertr_always(!is_empty(), 0);
|
||||||
|
const RenderAttrib *attrib =
|
||||||
|
node()->get_attrib(DepthOffsetAttrib::get_class_slot());
|
||||||
|
if (attrib != (const RenderAttrib *)NULL) {
|
||||||
|
const DepthOffsetAttrib *doa = DCAST(DepthOffsetAttrib, attrib);
|
||||||
|
return doa->get_offset();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: NodePath::do_billboard_axis
|
// Function: NodePath::do_billboard_axis
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -743,6 +743,11 @@ PUBLISHED:
|
|||||||
bool has_depth_write() const;
|
bool has_depth_write() const;
|
||||||
bool get_depth_write() const;
|
bool get_depth_write() const;
|
||||||
|
|
||||||
|
void set_depth_offset(int bias, int priority = 0);
|
||||||
|
void clear_depth_offset();
|
||||||
|
bool has_depth_offset() const;
|
||||||
|
int get_depth_offset() const;
|
||||||
|
|
||||||
void do_billboard_axis(const NodePath &camera, float offset);
|
void do_billboard_axis(const NodePath &camera, float offset);
|
||||||
void do_billboard_point_eye(const NodePath &camera, float offset);
|
void do_billboard_point_eye(const NodePath &camera, float offset);
|
||||||
void do_billboard_point_world(const NodePath &camera, float offset);
|
void do_billboard_point_world(const NodePath &camera, float offset);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user