KrisLibrary  1.0.0
GeometryAppearance.h
1 #ifndef GLDRAW_GEOMETRY_APPEARANCE_H
2 #define GLDRAW_GEOMETRY_APPEARANCE_H
3 
5 #include <KrisLibrary/meshing/TriMesh.h>
6 #include "GLColor.h"
7 #include "GLTextureObject.h"
8 #include "GLDisplayList.h"
9 #include <KrisLibrary/image/image.h>
10 #include <memory>
11 
12 namespace Geometry {
13  //forward declaration
14  class AnyGeometry3D;
15  class AnyCollisionGeometry3D;
16 }// namespace Geometry
17 //forward declaration
18 class Image;
19 
20 namespace GLDraw {
21 
22 void draw(const Geometry::AnyGeometry3D& geom);
23 void drawPoints(const Geometry::AnyGeometry3D& geom);
24 void drawFaces(const Geometry::AnyGeometry3D& geom);
25 
32 
34 void drawExpanded(Geometry::AnyCollisionGeometry3D& geom,Math::Real p=-1);
35 
43 {
44  public:
47  void CopyMaterial(const GeometryAppearance& rhs);
48  void Set(const Geometry::AnyGeometry3D& geom);
49  void Set(const Geometry::AnyCollisionGeometry3D& geom);
52  void Refresh();
54  void DrawGL();
57  void SetColor(float r,float g, float b, float a);
58  void SetColor(const GLColor& color);
61  void ModulateColor(const GLColor& color,float fraction);
62 
66  std::vector<GeometryAppearance> subAppearances;
67 
68  bool drawVertices,drawEdges,drawFaces;
69  float vertexSize,edgeSize;
71  bool lightFaces;
73  GLColor vertexColor,edgeColor,faceColor;
75  std::vector<GLColor> vertexColors,faceColors;
77  std::shared_ptr<Image> tex1D,tex2D;
79  bool texWrap;
81  std::vector<Math3D::Vector2> texcoords;
85  std::vector<Math3D::Vector4> texgen;
86 
88  std::shared_ptr<Meshing::TriMesh> implicitSurfaceMesh;
91  GLTextureObject textureObject;
92 };
93 
94 } //namespace GLDraw
95 
96 #endif
void drawWorld(const Geometry::AnyCollisionGeometry3D &geom)
draw the collision geometry in its world coordinates
Definition: GeometryAppearance.cpp:153
Definition: GLDisplayList.h:8
std::vector< GLColor > vertexColors
Optional: per-element colors.
Definition: GeometryAppearance.h:75
std::vector< Math3D::Vector2 > texcoords
Optional: per-element texture mapping coordinates (up to 2D)
Definition: GeometryAppearance.h:81
A class for coloring, texturing, and drawing meshes in OpenGL.
Definition: GeometryAppearance.h:42
std::vector< Math3D::Vector4 > texgen
Definition: GeometryAppearance.h:85
bool lightFaces
Use lighting or not (with lighting, will always do ambient and diffuse)
Definition: GeometryAppearance.h:71
GLDisplayList vertexDisplayList
Temporary: The display lists and texture lists for vertices and faces.
Definition: GeometryAppearance.h:90
std::vector< GeometryAppearance > subAppearances
For group geometries.
Definition: GeometryAppearance.h:66
Class declarations for useful 3D math types.
An AnyGeometry with collision detection information.
Definition: AnyGeometry.h:98
GLColor vertexColor
Global color.
Definition: GeometryAppearance.h:73
void drawFacesWorld(const Geometry::AnyCollisionGeometry3D &geom)
draw the collision geometry&#39;s faces in its world coordinates
Definition: GeometryAppearance.cpp:169
bool texWrap
If true, the texture will wrap. Default false.
Definition: GeometryAppearance.h:79
std::shared_ptr< Meshing::TriMesh > implicitSurfaceMesh
Temporary: Mesh computed for implicit surfaces.
Definition: GeometryAppearance.h:88
void drawExpanded(Geometry::AnyCollisionGeometry3D &geom, Real p)
draw the expansion of the collision geometry, in its local coordinates
Definition: GeometryAppearance.cpp:177
Contains all definitions in the GLDraw package.
Definition: AnyGeometry.h:13
A class that stores any kind of geometry we&#39;ve defined.
Definition: AnyGeometry.h:34
void drawPointsWorld(const Geometry::AnyCollisionGeometry3D &geom)
draw the collision geometry&#39;s points in its world coordinates
Definition: GeometryAppearance.cpp:161
const Geometry::AnyGeometry3D * geom
Geometry pointer.
Definition: GeometryAppearance.h:64
An rgba color.
Definition: GLColor.h:9
Definition: image.h:6
std::shared_ptr< Image > tex1D
Optional: set to non-null if you want to texture the object.
Definition: GeometryAppearance.h:77
Contains all definitions in the Geometry package.
Definition: AnyGeometry.h:11
A GL texture object class. Simplifies allocating and cleaning up texture objects. Usually you only ne...
Definition: GLTextureObject.h:13