Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HOpCreateNurbs3D.h
Go to the documentation of this file.
00001 // Copyright (c) 1998-2014 by Tech Soft 3D, Inc.
00002 //
00003 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
00004 // and considered a trade secret as defined under civil and criminal statutes.
00005 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
00006 // unauthorized use or misappropriation of its trade secrets.  Use of this information
00007 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
00008 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
00009 
00017 #ifndef _OpCreateNurbs3D_H
00018 #define _OpCreateNurbs3D_H
00019 
00020 #ifdef H_PACK_8
00021 #pragma pack(push)
00022 #pragma pack(8)
00023 #endif
00024 
00025 #include "HTools.h"
00026 #include "HBaseOperator.h"
00027 
00028 
00032 enum HSurfaceType 
00033 {
00034     InternalNurbsType,          
00035     NurbsType,                  
00036     ChakinSubdivisionType       
00037 };
00038 
00039 
00040 class HNurbsSurface;
00041 
00042 
00044 
00056 class MVO_API HOpCreateNurbs3D : public HBaseOperator
00057 {
00058 public:
00066     HOpCreateNurbs3D (HBaseView* view, int DoRepeat=0, int DoCapture=1);
00067     virtual ~HOpCreateNurbs3D();
00068 
00074     virtual HBaseOperator * Clone();
00075     
00079     virtual const char * GetName();  
00085     virtual int OnLButtonDown(HEventInfo &hevent);
00086 
00092     virtual int OnLButtonUp(HEventInfo &hevent);
00093 
00100     virtual int OnLButtonDownAndMove(HEventInfo &hevent);
00101  
00110     static HC_KEY InsertNurbs(HBaseView *pView, HNurbsSurface *pNurbsSurface, bool emit_message);
00111 
00112 
00119     static void InsertNurbsFromMessage(const char *in_data, unsigned int data_length, HBaseView *m_pView);
00120 
00130     static void EmitModifyControlPointMessage(HBaseView *pView, HC_KEY key, int control_point, float x, float y, float z);
00131 
00138     static void ModifyControlPointFromMessage(const char *in_data, unsigned int data_length, HBaseView *pView);
00139 
00148     static void EmitFinishNurbsEditing(HBaseView *pView, HC_KEY key, bool emit_message);
00149  
00156     static void FinishNurbsEditingFromMessage(const char *in_data, unsigned int data_length, HBaseView *pView);
00157 
00158 
00159 protected:
00160 
00161 private:
00162     HPoint m_last_point;
00163     int     m_mnnum;
00164     float   m_gwidth;
00165     int     m_gran;
00166     int     m_degree;
00167     HC_KEY  m_NurbsKey;
00168     HNurbsSurface *m_pNurbsSurface;
00169 
00170     
00171  
00172 };
00173 
00174 
00176 
00183 class MVO_API HNurbsSurface
00184 {
00185 public:
00186 
00188     HNurbsSurface()
00189     {
00190         m_nurbsKey = 0;
00191         m_numUVertices = 0;
00192         m_numVVertices = 0;
00193         m_pVertices = 0;
00194         m_pNurbs = 0;
00195         m_degree = 0;
00196         m_tesselationLevel = 0;
00197         m_pNurbs = 0;
00198         m_pVertices = 0;
00199         m_vertexDistance = 0;
00200         m_verticesKey = 0;
00201         m_surfaceMeshKey = 0;
00202 
00203     }
00204     ~HNurbsSurface()
00205     {
00206         H_SAFE_DELETE_ARRAY(m_pVertices);
00207         H_SAFE_DELETE_ARRAY(m_pNurbs);
00208     }
00209 
00214     void Init(HC_KEY key);
00215 
00228     HC_KEY Init( HPoint * center, HPoint * axis, 
00229             int num_u_vertices, int num_v_vertices, 
00230             int degree, int tesselation_level, 
00231             float distance, HSurfaceType stype);
00232 
00236     void Recalculate();
00237  
00241     HC_KEY GetKey();
00242 
00243     
00247     void DisplayVertices(); 
00248 
00252     void HideVertices();
00253 
00257     void EnableSelectability();
00258 
00262     void DisableSelectability();
00263 
00271     void UpdateVertex(int vertexnum, float x, float y, float z);
00272 
00278     void ShowVertex(int vertexnum, HPoint &v);
00279     
00285     void CreateDefaultVertices(HPoint * center, HPoint * axis);
00286 
00288     HC_KEY GetSurfaceMeshKey() { return m_surfaceMeshKey; }
00289  
00290 private:
00291   
00292     HC_KEY m_nurbsKey;
00293     HC_KEY m_verticesKey;
00294     HC_KEY m_surfaceMeshKey;
00295     int m_numUVertices;
00296     int m_numVVertices;
00297     int m_degree;
00298     int m_tesselationLevel;
00299     float m_vertexDistance;
00300     HPoint *m_pVertices;
00301     HPoint *m_pNurbs;
00302     HSurfaceType m_surfaceType;
00303     
00304 
00305     void UpdateVertices(); 
00306     void UpdateParameters();
00307     float nip(int i,int p, float u, float *uv);
00308     void InsertNurbsMesh(HPoint *pNurbs);
00309     void InsertChakinSubdivionSurface(HPoint *pNurbs);
00310     void CalculateCornerPoint(HPoint &p1, HPoint &p2, HPoint &res, float factor); 
00311     void SubdivideSurface(HPoint *old_surface, HPoint *ssurf, int xlen, int ylen, int &new_xlen, int &new_ylen, bool xrefine);
00312 
00313     void GetVerticesFromHOOPS();
00314     void GetParametersFromHOOPS();
00315 
00316 };
00317  
00318 
00319 
00320 #ifdef H_PACK_8
00321 #pragma pack(pop)
00322 #endif
00323 
00324 #endif
00325 
00326 
00327 
00328