![]() |
http://www.sim.no/ http://www.coin3d.org/ |
00001 #ifndef COIN_SONORMALGENERATOR_H 00002 #define COIN_SONORMALGENERATOR_H 00003 00004 /**************************************************************************\ 00005 * 00006 * This file is part of the Coin 3D visualization library. 00007 * Copyright (C) by Kongsberg Oil & Gas Technologies. 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License 00011 * ("GPL") version 2 as published by the Free Software Foundation. 00012 * See the file LICENSE.GPL at the root directory of this source 00013 * distribution for additional information about the GNU GPL. 00014 * 00015 * For using Coin with software that can not be combined with the GNU 00016 * GPL, and for taking advantage of the additional benefits of our 00017 * support services, please contact Kongsberg Oil & Gas Technologies 00018 * about acquiring a Coin Professional Edition License. 00019 * 00020 * See http://www.coin3d.org/ for more information. 00021 * 00022 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY. 00023 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org 00024 * 00025 \**************************************************************************/ 00026 00027 #include <Inventor/SbVec3f.h> 00028 #include <Inventor/SbBSPTree.h> 00029 #include <Inventor/lists/SbList.h> 00030 #include <Inventor/system/inttypes.h> 00031 00032 class COIN_DLL_API SoNormalGenerator { 00033 public: 00034 SoNormalGenerator(const SbBool ccw, const int approxVertices = 64); 00035 ~SoNormalGenerator(); 00036 00037 void reset(const SbBool ccw); 00038 00039 void beginPolygon(); 00040 void polygonVertex(const SbVec3f &v); 00041 void endPolygon(); 00042 00043 void triangle(const SbVec3f &v0, 00044 const SbVec3f &v1, 00045 const SbVec3f &v2); 00046 void quad(const SbVec3f &v0, 00047 const SbVec3f &v1, 00048 const SbVec3f &v2, 00049 const SbVec3f &v3); 00050 00051 void generate(const float creaseAngle, 00052 const int32_t * striplens = NULL, 00053 const int numstrips = 0); 00054 00055 void generatePerStrip(const int32_t * striplens, 00056 const int numstrips); 00057 void generatePerFace(void); 00058 void generateOverall(void); 00059 00060 // call these only after generate 00061 int getNumNormals() const; 00062 void setNumNormals(const int num); 00063 const SbVec3f *getNormals() const; 00064 const SbVec3f & getNormal(const int32_t i) const; 00065 void setNormal(const int32_t index, const SbVec3f &normal); 00066 00067 private: 00068 SbBSPTree bsp; 00069 SbList <int> vertexList; 00070 SbList <int> vertexFace; 00071 SbList <SbVec3f> faceNormals; 00072 SbList <SbVec3f> vertexNormals; 00073 00074 SbBool ccw; 00075 SbBool perVertex; 00076 int currFaceStart; 00077 00078 SbVec3f calcFaceNormal(); 00079 }; 00080 00081 #endif // !COIN_SONORMALGENERATOR_H
Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.
Generated on Wed Mar 24 01:53:59 2010 for Coin by Doxygen 1.6.2-20100208.