*** empty log message ***

This commit is contained in:
David Rose 2001-02-17 04:53:24 +00:00
parent dfddc7cf2a
commit 1ae36cf9e9
6 changed files with 174 additions and 7 deletions

View File

@ -4,6 +4,13 @@
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// Function: EggVertexPool::get_vertex
// Access: Public
// Description: Returns the vertex in the pool with the indicated
// index number, or NULL if no vertices have that index
// number.
////////////////////////////////////////////////////////////////////
INLINE EggVertex *EggVertexPool::
get_vertex(int index) const {
IndexVertices::const_iterator ivi = _index_vertices.find(index);
@ -15,11 +22,24 @@ get_vertex(int index) const {
}
}
////////////////////////////////////////////////////////////////////
// Function: EggVertexPool::indexing operator
// Access: Public
// Description: Returns the vertex in the pool with the indicated
// index number, or NULL if no vertices have that index
// number.
////////////////////////////////////////////////////////////////////
INLINE EggVertex *EggVertexPool::
operator [](int index) const {
return get_vertex(index);
}
////////////////////////////////////////////////////////////////////
// Function: EggVertexPool::get_highest_index
// Access: Public
// Description: Returns the highest index number used by any vertex
// in the pool.
////////////////////////////////////////////////////////////////////
INLINE int EggVertexPool::
get_highest_index() const {
if (_index_vertices.empty()) {
@ -30,6 +50,12 @@ get_highest_index() const {
return (*ivi).first;
}
////////////////////////////////////////////////////////////////////
// Function: EggVertexPool::begin()
// Access: Public
// Description: Returns an iterator that can be used to traverse
// through all the vertices in the pool.
////////////////////////////////////////////////////////////////////
INLINE EggVertexPool::iterator EggVertexPool::
begin() const {
nassertr(_index_vertices.size() == _unique_vertices.size(),
@ -37,18 +63,120 @@ begin() const {
return iterator(_index_vertices.begin());
}
////////////////////////////////////////////////////////////////////
// Function: EggVertexPool::end()
// Access: Public
// Description: Returns an iterator that can be used to traverse
// through all the vertices in the pool.
////////////////////////////////////////////////////////////////////
INLINE EggVertexPool::iterator EggVertexPool::
end() const {
return iterator(_index_vertices.end());
}
////////////////////////////////////////////////////////////////////
// Function: EggVertexPool::empty()
// Access: Public
// Description: Returns true if the pool is empty.
////////////////////////////////////////////////////////////////////
INLINE bool EggVertexPool::
empty() const {
return _index_vertices.empty();
}
////////////////////////////////////////////////////////////////////
// Function: EggVertexPool::size()
// Access: Public
// Description: Returns the number of vertices in the pool.
////////////////////////////////////////////////////////////////////
INLINE EggVertexPool::size_type EggVertexPool::
size() const {
nassertr(_index_vertices.size() == _unique_vertices.size(), 0);
return _index_vertices.size();
}
////////////////////////////////////////////////////////////////////
// Function: EggVertexPool::make_new_vertex()
// Access: Public
// Description: Allocates and returns a new vertex from the pool.
// This is one of three ways to add new vertices to a
// vertex pool.
////////////////////////////////////////////////////////////////////
INLINE EggVertex *EggVertexPool::
make_new_vertex() {
PT(EggVertex) vertex = new EggVertex;
add_vertex(vertex);
return vertex;
}
////////////////////////////////////////////////////////////////////
// Function: EggVertexPool::make_new_vertex()
// Access: Public
// Description: Allocates and returns a new vertex from the pool.
// This is one of three ways to add new vertices to a
// vertex pool.
//
// This flavor of make_new_vertex() explicitly sets the
// vertex position as it is allocated. It does not
// attempt to share vertices.
////////////////////////////////////////////////////////////////////
INLINE EggVertex *EggVertexPool::
make_new_vertex(double pos) {
EggVertex *vertex = make_new_vertex();
vertex->set_pos(pos);
return vertex;
}
////////////////////////////////////////////////////////////////////
// Function: EggVertexPool::make_new_vertex()
// Access: Public
// Description: Allocates and returns a new vertex from the pool.
// This is one of three ways to add new vertices to a
// vertex pool.
//
// This flavor of make_new_vertex() explicitly sets the
// vertex position as it is allocated. It does not
// attempt to share vertices.
////////////////////////////////////////////////////////////////////
INLINE EggVertex *EggVertexPool::
make_new_vertex(const LPoint2d &pos) {
EggVertex *vertex = make_new_vertex();
vertex->set_pos(pos);
return vertex;
}
////////////////////////////////////////////////////////////////////
// Function: EggVertexPool::make_new_vertex()
// Access: Public
// Description: Allocates and returns a new vertex from the pool.
// This is one of three ways to add new vertices to a
// vertex pool.
//
// This flavor of make_new_vertex() explicitly sets the
// vertex position as it is allocated. It does not
// attempt to share vertices.
////////////////////////////////////////////////////////////////////
INLINE EggVertex *EggVertexPool::
make_new_vertex(const LPoint3d &pos) {
EggVertex *vertex = make_new_vertex();
vertex->set_pos(pos);
return vertex;
}
////////////////////////////////////////////////////////////////////
// Function: EggVertexPool::make_new_vertex()
// Access: Public
// Description: Allocates and returns a new vertex from the pool.
// This is one of three ways to add new vertices to a
// vertex pool.
//
// This flavor of make_new_vertex() explicitly sets the
// vertex position as it is allocated. It does not
// attempt to share vertices.
////////////////////////////////////////////////////////////////////
INLINE EggVertex *EggVertexPool::
make_new_vertex(const LPoint4d &pos) {
EggVertex *vertex = make_new_vertex();
vertex->set_pos(pos);
return vertex;
}

View File

@ -80,6 +80,14 @@ public:
// user to allocate the vertex.
void add_vertex(PT(EggVertex) vertex, int index = -1);
// make_new_vertex() allocates and returns a new vertex from the
// pool.
INLINE EggVertex *make_new_vertex();
INLINE EggVertex *make_new_vertex(double pos);
INLINE EggVertex *make_new_vertex(const LPoint2d &pos);
INLINE EggVertex *make_new_vertex(const LPoint3d &pos);
INLINE EggVertex *make_new_vertex(const LPoint4d &pos);
// create_unique_vertex() creates a new vertex if there is not
// already one identical to the indicated vertex, or returns the
// existing one if there is.

View File

@ -395,11 +395,11 @@ filter_image(PNMImage &dest, const PNMImage &source,
filter_red_xy(dest, source, width, make_filter);
filter_green_xy(dest, source, width, make_filter);
filter_blue_xy(dest, source, width, make_filter);
}
if (dest.has_alpha() && source.has_alpha()) {
filter_alpha_xy(dest, source, width, make_filter);
}
}
} else {
if (dest.is_grayscale() || source.is_grayscale()) {
@ -408,12 +408,12 @@ filter_image(PNMImage &dest, const PNMImage &source,
filter_red_yx(dest, source, width, make_filter);
filter_green_yx(dest, source, width, make_filter);
filter_blue_yx(dest, source, width, make_filter);
}
if (dest.has_alpha() && source.has_alpha()) {
filter_alpha_yx(dest, source, width, make_filter);
}
}
}
}

View File

@ -96,6 +96,33 @@ extract_words(const string &str, vector_string &words) {
return num_words;
}
////////////////////////////////////////////////////////////////////
// Function: tokenize
// Description: Chops the source string up into pieces delimited by
// any of the characters specified in delimiters.
// Repeated delimiter characters represent zero-length
// tokens.
//
// It is the user's responsibility to ensure the output
// vector is cleared before calling this function; the
// results will simply be appended to the end of the
// vector.
////////////////////////////////////////////////////////////////////
void
tokenize(const string &str, vector_string &words, const string &delimiters) {
size_t p = 0;
while (p < str.length()) {
size_t q = str.find_first_of(delimiters, p);
if (q == string::npos) {
words.push_back(str.substr(p));
return;
}
words.push_back(str.substr(p, q - p));
p = q + 1;
}
words.push_back(string());
}
////////////////////////////////////////////////////////////////////
// Function: trim_left
// Description: Returns a new string representing the contents of the

View File

@ -24,6 +24,10 @@ EXPCL_PANDA string downcase(const string &s);
// Separates the string into words according to whitespace.
EXPCL_PANDA int extract_words(const string &str, vector_string &words);
// Separates the string into words according to the indicated delimiters.
EXPCL_PANDA void tokenize(const string &str, vector_string &words,
const string &delimiters);
// Trims leading and/or trailing whitespace from the string.
EXPCL_PANDA string trim_left(const string &str);
EXPCL_PANDA string trim_right(const string &str);

View File

@ -158,7 +158,7 @@ handle_args(Args &args) {
return false;
}
_source_files = args;
_source_files.insert(_source_files.end(), args.begin(), args.end());
return true;
}