mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
add << for proj node
This commit is contained in:
parent
355b3144c8
commit
fa35929f1d
@ -49,3 +49,10 @@ operator = (const ProjectionNode ©) {
|
||||
NamedNode::operator = (copy);
|
||||
_projection = copy._projection;
|
||||
}
|
||||
|
||||
INLINE ostream &operator << (ostream &out, const ProjectionNode &projnode) {
|
||||
projnode.output(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
|
@ -184,8 +184,9 @@ void ProjectionNode::
|
||||
get_near_far(float &cnear, float &cfar) const {
|
||||
if (_projection->get_type() == PerspectiveProjection::get_class_type()) {
|
||||
PerspectiveProjection *proj = DCAST(PerspectiveProjection, _projection);
|
||||
cnear = proj->get_frustum()._fnear;
|
||||
cfar = proj->get_frustum()._ffar;
|
||||
Frustumf frust = proj->get_frustum();
|
||||
cnear = frust._fnear;
|
||||
cfar = frust._ffar;
|
||||
}
|
||||
}
|
||||
|
||||
@ -349,3 +350,18 @@ set_far(float cfar) {
|
||||
float cnear = get_near();
|
||||
set_near_far(cnear, cfar);
|
||||
}
|
||||
|
||||
void ProjectionNode::
|
||||
output(ostream &out) const {
|
||||
if (_projection->get_type() == PerspectiveProjection::get_class_type()) {
|
||||
PerspectiveProjection *proj = DCAST(PerspectiveProjection, _projection);
|
||||
float xfov,yfov,aspect_ratio,cnear,cfar;
|
||||
proj->get_frustum().get_perspective_params(xfov, yfov, aspect_ratio, cnear, cfar);
|
||||
|
||||
out << "X-FOV: " << xfov << " deg, Y-FOV: " << yfov << " deg"
|
||||
<< "Aspect ratio: " << aspect_ratio << ", Near plane: " << cnear << ", Far plane: " << cfar << endl;
|
||||
}
|
||||
|
||||
out << "Projection Matrix: " << _projection->get_projection_mat(CS_default) << endl;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ PUBLISHED:
|
||||
public:
|
||||
INLINE ProjectionNode(const ProjectionNode ©);
|
||||
INLINE void operator = (const ProjectionNode ©);
|
||||
|
||||
void output(ostream &out) const;
|
||||
virtual Node *make_copy() const;
|
||||
|
||||
PUBLISHED:
|
||||
@ -74,7 +74,6 @@ protected:
|
||||
PT(Projection) _projection;
|
||||
|
||||
public:
|
||||
|
||||
static TypeHandle get_class_type( void ) {
|
||||
return _type_handle;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user