Coin Logo http://www.sim.no/
http://www.coin3d.org/

SoNormalGenerator.h
1#ifndef COIN_SONORMALGENERATOR_H
2#define COIN_SONORMALGENERATOR_H
3
4/**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25\**************************************************************************/
26
27#include <Inventor/SbVec3f.h>
28#include <Inventor/SbBSPTree.h>
29#include <Inventor/lists/SbList.h>
30#include <Inventor/system/inttypes.h>
31
32class COIN_DLL_API SoNormalGenerator {
33public:
34 SoNormalGenerator(const SbBool ccw, const int approxVertices = 64);
36
37 void reset(const SbBool ccw);
38
39 void beginPolygon();
40 void polygonVertex(const SbVec3f &v);
41 void endPolygon();
42
43 void triangle(const SbVec3f &v0,
44 const SbVec3f &v1,
45 const SbVec3f &v2);
46 void quad(const SbVec3f &v0,
47 const SbVec3f &v1,
48 const SbVec3f &v2,
49 const SbVec3f &v3);
50
51 void generate(const float creaseAngle,
52 const int32_t * striplens = NULL,
53 const int numstrips = 0);
54
55 void generatePerStrip(const int32_t * striplens,
56 const int numstrips);
57 void generatePerFace(void);
58 void generateOverall(void);
59
60 // call these only after generate
61 int getNumNormals() const;
62 void setNumNormals(const int num);
63 const SbVec3f *getNormals() const;
64 const SbVec3f & getNormal(const int32_t i) const;
65 void setNormal(const int32_t index, const SbVec3f &normal);
66
67private:
68 SbBSPTree bsp;
69 SbList <int> vertexList;
70 SbList <int> vertexFace;
71 SbList <SbVec3f> faceNormals;
72 SbList <SbVec3f> vertexNormals;
73
74 SbBool ccw;
75 SbBool perVertex;
76 int currFaceStart;
77
78 SbVec3f calcFaceNormal();
79};
80
81#endif // !COIN_SONORMALGENERATOR_H
The SbBSPTree class provides a binary space partitioning container.
Definition SbBSPTree.h:45
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:40
The SoNormalGenerator class is used to generate normals.
Definition SoNormalGenerator.h:32

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Wed Jul 17 2024 for Coin by Doxygen 1.12.0.