| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- // Filename: builderVertex.I
- // Created by: drose (18Sep97)
- //
- ////////////////////////////////////////////////////////////////////
- #include <notify.h>
- ////////////////////////////////////////////////////////////////////
- // Function: BuilderVertex::set_coord_value
- // Access: Public
- // Description: Reassigns the vertex coordinate, without knowing
- // whether the vertex is indexed or nonindexed. A
- // nonindexed vertex will look up the index in the array
- // and store the resulting value, while an indexed
- // vertex will just store the index number (which
- // assumes the array is the same one it's indexing on).
- ////////////////////////////////////////////////////////////////////
- INLINE void BuilderVertex::
- set_coord_value(const BuilderV *array, ushort index) {
- set_coord(array[index]);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: BuilderVertex::set_normal_value
- // Access: Public
- // Description: Reassigns the vertex normal, without knowing whether
- // the vertex is indexed or nonindexed. A nonindexed
- // vertex will look up the index in the array and store
- // the resulting value, while an indexed vertex will
- // just store the index number (which assumes the array
- // is the same one it's indexing on).
- ////////////////////////////////////////////////////////////////////
- INLINE void BuilderVertex::
- set_normal_value(const BuilderN *array, ushort index) {
- set_normal(array[index]);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: BuilderVertex::set_texcoord_value
- // Access: Public
- // Description: Reassigns the vertex texture coordinate, without
- // knowing whether the vertex is indexed or nonindexed.
- // A nonindexed vertex will look up the index in the
- // array and store the resulting value, while an indexed
- // vertex will just store the index number (which
- // assumes the array is the same one it's indexing on).
- ////////////////////////////////////////////////////////////////////
- INLINE void BuilderVertex::
- set_texcoord_value(const BuilderTC *array, ushort index) {
- set_texcoord(array[index]);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: BuilderVertex::set_color_value
- // Access: Public
- // Description: Reassigns the vertex color, without knowing whether
- // the vertex is indexed or nonindexed. A nonindexed
- // vertex will look up the index in the array and store
- // the resulting value, while an indexed vertex will
- // just store the index number (which assumes the array
- // is the same one it's indexing on).
- ////////////////////////////////////////////////////////////////////
- INLINE void BuilderVertex::
- set_color_value(const BuilderC *array, ushort index) {
- set_color(array[index]);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: BuilderVertex::get_coord_value
- // Access: Public
- // Description: Returns the actual coordinate value of the vertex,
- // whether it is indexed or nonindexed. Normally, the
- // value returned by get_coord(), which will be either a
- // BuilderV or a ushort, is sufficient, but there are
- // occasional times when it is necessary to get the
- // actual location in space of the vertex position (for
- // instance, to subdivide a concave polygon).
- //
- // This function returns the actual coordinate value.
- // For a nonindexed vertex, its return value is the same
- // as get_coord(); for an indexed vertex, it looks up
- // the vertex's index in the bucket's coord array, and
- // returns that value.
- //
- // Note that this makes some perhaps unwarranted
- // assumptions about indexed geometry; specifically,
- // that its value is valid at creation time, and that it
- // won't change too drastically during runtime.
- ////////////////////////////////////////////////////////////////////
- INLINE BuilderV BuilderVertex::
- get_coord_value(const BuilderBucket &) const {
- return get_coord();
- }
- ////////////////////////////////////////////////////////////////////
- // Function: BuilderVertex::get_normal_value
- // Access: Public
- // Description: Returns the actual normal value of the vertex,
- // whether it is indexed or nonindexed. See
- // get_coord_value().
- ////////////////////////////////////////////////////////////////////
- INLINE BuilderN BuilderVertex::
- get_normal_value(const BuilderBucket &) const {
- return get_normal();
- }
- ////////////////////////////////////////////////////////////////////
- // Function: BuilderVertex::get_texcoord_value
- // Access: Public
- // Description: Returns the actual texture coordinate value of the
- // vertex, whether it is indexed or nonindexed. See
- // get_coord_value().
- ////////////////////////////////////////////////////////////////////
- INLINE BuilderTC BuilderVertex::
- get_texcoord_value(const BuilderBucket &) const {
- return get_texcoord();
- }
- ////////////////////////////////////////////////////////////////////
- // Function: BuilderVertex::get_color_value
- // Access: Public
- // Description: Returns the actual color value of the vertex,
- // whether it is indexed or nonindexed. See
- // get_coord_value().
- ////////////////////////////////////////////////////////////////////
- INLINE BuilderC BuilderVertex::
- get_color_value(const BuilderBucket &) const {
- return get_color();
- }
- ////////////////////////////////////////////////////////////////////
- // Function: BuilderVertex::set_coord_value
- // Access: Public
- // Description: Reassigns the vertex coordinate, without knowing
- // whether the vertex is indexed or nonindexed. A
- // nonindexed vertex will look up the index in the array
- // and store the resulting value, while an indexed
- // vertex will just store the index number (which
- // assumes the array is the same one it's indexing on).
- ////////////////////////////////////////////////////////////////////
- INLINE void BuilderVertexI::
- set_coord_value(const BuilderV *, ushort index) {
- set_coord(index);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: BuilderVertex::set_normal_value
- // Access: Public
- // Description: Reassigns the vertex normal, without knowing whether
- // the vertex is indexed or nonindexed. A nonindexed
- // vertex will look up the index in the array and store
- // the resulting value, while an indexed vertex will
- // just store the index number (which assumes the array
- // is the same one it's indexing on).
- ////////////////////////////////////////////////////////////////////
- INLINE void BuilderVertexI::
- set_normal_value(const BuilderN *, ushort index) {
- set_normal(index);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: BuilderVertex::set_texcoord_value
- // Access: Public
- // Description: Reassigns the vertex texture coordinate, without
- // knowing whether the vertex is indexed or nonindexed.
- // A nonindexed vertex will look up the index in the
- // array and store the resulting value, while an indexed
- // vertex will just store the index number (which
- // assumes the array is the same one it's indexing on).
- ////////////////////////////////////////////////////////////////////
- INLINE void BuilderVertexI::
- set_texcoord_value(const BuilderTC *, ushort index) {
- set_texcoord(index);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: BuilderVertex::set_color_value
- // Access: Public
- // Description: Reassigns the vertex color, without knowing whether
- // the vertex is indexed or nonindexed. A nonindexed
- // vertex will look up the index in the array and store
- // the resulting value, while an indexed vertex will
- // just store the index number (which assumes the array
- // is the same one it's indexing on).
- ////////////////////////////////////////////////////////////////////
- INLINE void BuilderVertexI::
- set_color_value(const BuilderC *, ushort index) {
- set_color(index);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: BuilderVertex::get_coord_value
- // Access: Public
- // Description: Returns the actual coordinate value of the vertex,
- // whether it is indexed or nonindexed. Normally, the
- // value returned by get_coord(), which will be either a
- // BuilderV or a ushort, is sufficient, but there are
- // occasional times when it is necessary to get the
- // actual location in space of the vertex position (for
- // instance, to subdivide a concave polygon).
- //
- // This function returns the actual coordinate value.
- // For a nonindexed vertex, its return value is the same
- // as get_coord(); for an indexed vertex, it looks up
- // the vertex's index in the bucket's coord array, and
- // returns that value.
- //
- // Note that this makes some perhaps unwarranted
- // assumptions about indexed geometry; specifically,
- // that its value is valid at creation time, and that it
- // won't change too drastically during runtime.
- ////////////////////////////////////////////////////////////////////
- INLINE BuilderV BuilderVertexI::
- get_coord_value(const BuilderBucket &bucket) const {
- nassertr(bucket.get_coords() != (Vertexf *)NULL, BuilderV());
- return bucket.get_coords()[get_coord()];
- }
- ////////////////////////////////////////////////////////////////////
- // Function: BuilderVertex::get_normal_value
- // Access: Public
- // Description: Returns the actual normal value of the vertex,
- // whether it is indexed or nonindexed. See
- // get_coord_value().
- ////////////////////////////////////////////////////////////////////
- INLINE BuilderN BuilderVertexI::
- get_normal_value(const BuilderBucket &bucket) const {
- nassertr(bucket.get_normals() != (Normalf *)NULL, BuilderN());
- return bucket.get_normals()[get_normal()];
- }
- ////////////////////////////////////////////////////////////////////
- // Function: BuilderVertex::get_texcoord_value
- // Access: Public
- // Description: Returns the actual texture coordinate value of the
- // vertex, whether it is indexed or nonindexed. See
- // get_coord_value().
- ////////////////////////////////////////////////////////////////////
- INLINE BuilderTC BuilderVertexI::
- get_texcoord_value(const BuilderBucket &bucket) const {
- nassertr(bucket.get_texcoords() != (TexCoordf *)NULL, BuilderTC());
- return bucket.get_texcoords()[get_texcoord()];
- }
- ////////////////////////////////////////////////////////////////////
- // Function: BuilderVertex::get_color_value
- // Access: Public
- // Description: Returns the actual color value of the vertex,
- // whether it is indexed or nonindexed. See
- // get_coord_value().
- ////////////////////////////////////////////////////////////////////
- INLINE BuilderC BuilderVertexI::
- get_color_value(const BuilderBucket &bucket) const {
- nassertr(bucket.get_colors() != (Colorf *)NULL, BuilderC());
- return bucket.get_colors()[get_color()];
- }
|