mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
add set_texcoord_3d
This commit is contained in:
parent
9ae0dd8cca
commit
38e4d64f22
@ -86,6 +86,33 @@ get_invert_uvs() const {
|
||||
return _invert_uvs;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ProjectionScreen::set_texcoord_3d
|
||||
// Access: Published
|
||||
// Description: Set this true to force 3-D texture coordinates to be
|
||||
// created for the geometry. When this is true and the
|
||||
// geometry has only 2-D texture coordinates, those
|
||||
// texture coordinates are dumped in favor of 3-D
|
||||
// coordinates. When this is false, whatever texture
|
||||
// coordinates already exist are preserved as-is.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void ProjectionScreen::
|
||||
set_texcoord_3d(bool texcoord_3d) {
|
||||
_texcoord_3d = texcoord_3d;
|
||||
_stale = true;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ProjectionScreen::get_texcoord_3d
|
||||
// Access: Published
|
||||
// Description: See set_texcoord_3d().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool ProjectionScreen::
|
||||
get_texcoord_3d() const {
|
||||
return _texcoord_3d;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ProjectionScreen::set_vignette_on
|
||||
// Access: Published
|
||||
|
@ -40,6 +40,7 @@ ProjectionScreen(const string &name) : PandaNode(name)
|
||||
_texcoord_name = InternalName::get_texcoord();
|
||||
|
||||
_invert_uvs = project_invert_uvs;
|
||||
_texcoord_3d = false;
|
||||
_vignette_on = false;
|
||||
_vignette_color.set(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
_frame_color.set(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
@ -547,7 +548,8 @@ recompute_geom(Geom *geom, const LMatrix4 &rel_mat) {
|
||||
// Iterate through all the vertices in the Geom.
|
||||
|
||||
CPT(GeomVertexData) vdata = geom->get_vertex_data();
|
||||
if (!vdata->has_column(_texcoord_name)) {
|
||||
CPT(GeomVertexFormat) vformat = vdata->get_format();
|
||||
if (!vformat->has_column(_texcoord_name) || (_texcoord_3d && vformat->get_column(_texcoord_name)->get_num_components() < 3)) {
|
||||
// We need to add a new column for the new texcoords.
|
||||
vdata = vdata->replace_column
|
||||
(_texcoord_name, 3, Geom::NT_stdfloat, Geom::C_texcoord);
|
||||
|
@ -82,6 +82,9 @@ PUBLISHED:
|
||||
INLINE void set_invert_uvs(bool invert_uvs);
|
||||
INLINE bool get_invert_uvs() const;
|
||||
|
||||
INLINE void set_texcoord_3d(bool texcoord_3d);
|
||||
INLINE bool get_texcoord_3d() const;
|
||||
|
||||
INLINE void set_vignette_on(bool vignette_on);
|
||||
INLINE bool get_vignette_on() const;
|
||||
|
||||
@ -123,6 +126,7 @@ private:
|
||||
PT(LensNode) _projector_node;
|
||||
PT(InternalName) _texcoord_name;
|
||||
bool _invert_uvs;
|
||||
bool _texcoord_3d;
|
||||
bool _vignette_on;
|
||||
LColor _vignette_color;
|
||||
LColor _frame_color;
|
||||
|
Loading…
x
Reference in New Issue
Block a user