source: trunk/vizservers/nanovis/ConvexPolygon.h @ 829

Last change on this file since 829 was 415, checked in by qiaow, 18 years ago

Now can load arbitary number of volumes (16 per application due to hardware limitation). The VolumeRenderer? render them with correct slice order!!

File size: 1.4 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 * ConvexPolygon.h: convex polygon class
4 *
5 * ======================================================================
6 *  AUTHOR:  Wei Qiao <qiaow@purdue.edu>
7 *           Purdue Rendering and Perceptualization Lab (PURPL)
8 *
9 *  Copyright (c) 2004-2006  Purdue Research Foundation
10 *
11 *  See the file "license.terms" for information on usage and
12 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 * ======================================================================
14 */
15#ifndef _CONVEX_POLYGON_H_
16#define _CONVEX_POLYGON_H_
17
18#include "Vector4.h"
19#include "Plane.h"
20#include <vector>
21
22typedef std::vector<Vector4> VertexVector;
23typedef std::vector<Vector4> TexVector;
24
25class ConvexPolygon {
26public:
27        VertexVector vertices;
28        TexVector texcoords;
29        int volume_id;  //which volume this polygon slice belongs to
30
31        ConvexPolygon();
32        ConvexPolygon(VertexVector vertices);
33       
34        void append_vertex(Vector4 vert);
35        void insert_vertex(unsigned int index, Vector4 vert);
36        void transform(Mat4x4 mat);
37        void translate(Vector4 shift);
38
39        // Clips the polygon, retaining the portion where ax + by + cz + d >= 0
40        void clip(Plane &clipPlane, bool copy_to_texcoords);
41        void Emit(bool use_texture);
42        void Emit(bool use_texture, Vector3& shift, Vector3& scale);
43        void copy_vertices_to_texcoords();
44        void set_id(int v_id);
45};
46
47#endif
Note: See TracBrowser for help on using the repository browser.