瀏覽代碼

Added a few convenience functions: add_vertices

Josh Yelon 20 年之前
父節點
當前提交
dfab4fb786
共有 2 個文件被更改,包括 39 次插入0 次删除
  1. 36 0
      panda/src/gobj/geomPrimitive.I
  2. 3 0
      panda/src/gobj/geomPrimitive.h

+ 36 - 0
panda/src/gobj/geomPrimitive.I

@@ -335,6 +335,42 @@ get_maxs() const {
   return cdata->_maxs;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: GeomPrimitive::add_vertices
+//       Access: Public
+//  Description: Adds several vertices in a row.
+////////////////////////////////////////////////////////////////////
+INLINE void GeomPrimitive::
+add_vertices(int v1, int v2) {
+  add_vertex(v1);
+  add_vertex(v2);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: GeomPrimitive::add_vertices
+//       Access: Public
+//  Description: Adds several vertices in a row.
+////////////////////////////////////////////////////////////////////
+INLINE void GeomPrimitive::
+add_vertices(int v1, int v2, int v3) {
+  add_vertex(v1);
+  add_vertex(v2);
+  add_vertex(v3);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: GeomPrimitive::add_vertices
+//       Access: Public
+//  Description: Adds several vertices in a row.
+////////////////////////////////////////////////////////////////////
+INLINE void GeomPrimitive::
+add_vertices(int v1, int v2, int v3, int v4) {
+  add_vertex(v1);
+  add_vertex(v2);
+  add_vertex(v3);
+  add_vertex(v4);
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: GeomPrimitive::get_index_format
 //       Access: Protected

+ 3 - 0
panda/src/gobj/geomPrimitive.h

@@ -97,6 +97,9 @@ PUBLISHED:
   INLINE int get_num_vertices() const;
   int get_vertex(int i) const;
   void add_vertex(int vertex);
+  INLINE void add_vertices(int v1, int v2);
+  INLINE void add_vertices(int v1, int v2, int v3);
+  INLINE void add_vertices(int v1, int v2, int v3, int v4);
   void add_consecutive_vertices(int start, int num_vertices);
   void add_next_vertices(int num_vertices);
   bool close_primitive();