00001 // Copyright (C) 2005 Dave Griffiths 00002 // 00003 // This program is free software; you can redistribute it and/or modify 00004 // it under the terms of the GNU General Public License as published by 00005 // the Free Software Foundation; either version 2 of the License, or 00006 // (at your option) any later version. 00007 // 00008 // This program is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 // GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License 00014 // along with this program; if not, write to the Free Software 00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00016 00017 #include "Primitive.h" 00018 00019 #ifndef N_NURBSPRIM 00020 #define N_NURBSPRIM 00021 00022 namespace Fluxus 00023 { 00024 00027 class NURBSPrimitive : public Primitive 00028 { 00029 public: 00030 NURBSPrimitive(); 00031 NURBSPrimitive(const NURBSPrimitive &other); 00032 virtual ~NURBSPrimitive(); 00033 00037 virtual NURBSPrimitive* Clone() const; 00038 virtual void Render(); 00039 virtual void RecalculateNormals(bool smooth); 00040 virtual dBoundingBox GetBoundingBox(); 00041 virtual void ApplyTransform(bool ScaleRotOnly=false); 00042 virtual string GetTypeName() { return "NURBSPrimitive"; } 00043 virtual Evaluator *MakeEvaluator() { return NULL; } 00045 00050 void Init(int orderu, int orderv, int ucvs, int vcvs) { m_UOrder=orderu; m_VOrder=orderv; m_UCVCount=ucvs; m_VCVCount=vcvs; } 00051 void AddCV(const dVector &CV) { m_CVVec->push_back(CV); } 00052 void AddN(const dVector &N) { m_NVec->push_back(N); } 00053 void AddTex(const dVector &ST) { m_STVec->push_back(ST); } 00054 void AddUKnot(float k) { m_UKnotVec.push_back(k); } 00055 void AddVKnot(float k) { m_VKnotVec.push_back(k); } 00057 00058 protected: 00059 00060 virtual void PDataDirty(); 00061 void SetupSurface(); 00062 00063 vector<dVector> *m_CVVec; 00064 vector<dVector> *m_STVec; 00065 vector<dVector> *m_NVec; 00066 vector<float> m_UKnotVec; 00067 vector<float> m_VKnotVec; 00068 00069 int m_UOrder; 00070 int m_VOrder; 00071 int m_UCVCount; 00072 int m_VCVCount; 00073 int m_Stride; 00074 00075 GLUnurbsObj *m_Surface; 00076 }; 00077 00078 }; 00079 00080 #endif
1.5.1