Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HIOUtilityPly.h
1 //
2 // Copyright (c) 2000 by Tech Soft 3D, LLC.
3 // The information contained herein is confidential and proprietary to
4 // Tech Soft 3D, LLC., and considered a trade secret as defined under
5 // civil and criminal statutes. Tech Soft 3D shall pursue its civil
6 // and criminal remedies in the event of unauthorized use or misappropriation
7 // of its trade secrets. Use of this information by anyone other than
8 // authorized employees of Tech Soft 3D, LLC. is granted only under a
9 // written non-disclosure agreement, expressly prescribing the scope and
10 // manner of such use.
11 //
12 // $Id: cd82ff1b734e3ab64f4b241c5de9e03f10112485 $
13 //
14 
15 #ifndef _HIOUTILITYPLY_H
16 #define _HIOUTILITYPLY_H
17 
18 #ifdef H_PACK_8
19 #pragma pack(push)
20 #pragma pack(8)
21 #endif
22 
23 #include "HTools.h"
24 #include "HIOManager.h"
25 #include "varray.h"
26 #include <stdio.h>
27 
31 class MVO_API HIOUtilityPly: public HInputHandler, public HOutputHandler
32 {
33 private:
34  bool m_binary;
35  bool m_bigendian;
36 
37  bool m_vertex_colors;
38  bool m_vertex_normals;
39  bool m_face_colors;
40 
41  bool read_ply_header( FILE *f, int *point_count, int *face_count, int *opcodes );
42  bool write_ply_header( FILE *f, int point_count, int face_count, HPoint *min=0, HPoint *max=0 );
43 
44  bool count( int *total_point_count, int *total_face_count );
45  bool write_points( FILE *f );
46  bool write_faces( FILE *f );
47 
48  bool count_recursive( int *total_point_count, int *total_face_count );
49  bool write_points_recursive( FILE *f, float *modelling_matrix_in );
50  bool write_faces_recursive( FILE *f, int *point_offset );
51 
52  bool write_one_int( FILE *f, int val );
53  bool write_one_byte( FILE *f, unsigned char val );
54  bool write_one_float( FILE *f, float val );
55  bool read_one_int( FILE *f, int *val );
56  bool read_one_byte( FILE *f, unsigned char *val );
57  bool read_one_float( FILE *f, float *val );
58 
59  class Color_Node {
60  public:
61  Color_Node() { entity_list = new VArray<int>; }
62  ~Color_Node() { delete entity_list; }
63  float rgb_color_f[3];
64  VArray<int> *entity_list;
65  };
66 
67 public:
68 
71  m_binary = false;
72  m_bigendian = false;
74  SetOutputOps(HOutputOpFileOutputByKey);
75  };
76 
77  virtual ~HIOUtilityPly() {;};
78 
81  const char * GetOutputName() { return "HIOUtilityPly"; }
82  const char * GetInputName() { return "HIOUtilityPly"; }
83 
86  HIORegisterInputType("ply",this);
87  };
88 
91  HIORegisterOutputType("ply",this);
92  };
93 
95  const char * GetInputTypesString() {return "ply";};
96 
98  const char * GetOutputTypesString() {return "ply";};
99 
102 
104  HOutputHandlerStyle GetOutputStyle() {return HOutputHandlerStyleModel;};
105 
115  HFileInputResult FileInputByKey(const __wchar_t * FileName, HC_KEY key, HInputHandlerOptions * options);
116 
117  HFileInputResult FileInputByKey(const char * FileName, HC_KEY key, HInputHandlerOptions * options){
118  return FileInputByKey(H_WCS(FileName).encodedText(), key, options);
119  };
120 
121  HFileInputResult FileInputByKey(const unsigned short * FileName, HC_KEY key, HInputHandlerOptions * options){
122  H_UTF16 utf16;
123  utf16.encodedText((utf16_char const*) FileName);
124  return FileInputByKey(H_WCS(utf16).encodedText(), key, options);
125  };
126 
134  HFileOutputResult FileOutputByKey(const __wchar_t * filename, HC_KEY key, HOutputHandlerOptions * options);
135 
136  HFileOutputResult FileOutputByKey(const unsigned short * filename, HC_KEY key, HOutputHandlerOptions * options){
137  H_UTF16 utf16;
138  utf16.encodedText((utf16_char const*) filename);
139  return FileOutputByKey(H_WCS(utf16).encodedText(), key, options);
140  }
141 
142  HFileOutputResult FileOutputByKey(const char * filename, HC_KEY key, HOutputHandlerOptions * options){
143  return FileOutputByKey(H_WCS(filename).encodedText(), key, options);
144  }
145 
146 };
147 
148 
149 #ifdef H_PACK_8
150 #pragma pack(pop)
151 #endif
152 
153 #endif
HInputHandlerStyle GetInputStyle()
Definition: HIOUtilityPly.h:101
Specifies an HInputHandler for model data.
Definition: HIOManager.h:227
#define HOutputOpFileOutputByKey
This HOutputHandler supports output from a segment key.
Definition: HIOManager.h:75
virtual HFileInputResult FileInputByKey(const char *filename, HC_KEY key, HInputHandlerOptions *options)
HInputHandler an abstract base class for model and image input.
Definition: HIOManager.h:667
HOutputHandlerStyle
Definition: HIOManager.h:858
HOutputHandlerStyle GetOutputStyle()
Definition: HIOUtilityPly.h:104
void RegisterInputHandlerTypes()
Definition: HIOUtilityPly.h:85
#define HIORegisterInputType(type, input_object)
Definition: HIOManager.h:87
const char * GetInputName()
Definition: HIOUtilityPly.h:82
#define HIORegisterOutputType(type, output_object)
HIORegisterOutputType(type,output_object) Used by a HOutputHandler to set extension types that it han...
Definition: HIOManager.h:92
Definition: HIOUtilityPly.h:31
HInputHandlerStyle
Definition: HIOManager.h:226
HFileInputResult FileInputByKey(const char *FileName, HC_KEY key, HInputHandlerOptions *options)
Definition: HIOUtilityPly.h:117
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:126
#define HInputOpFileInputByKey
This HInputHandler supports input to a segment key.
Definition: HIOManager.h:60
const char * GetOutputName()
Definition: HIOUtilityPly.h:81
const char * GetInputTypesString()
Definition: HIOUtilityPly.h:95
Definition: HIOManager.h:247
void SetInputOps(unsigned long ops)
This sets the HInputOp.
Definition: HIOManager.h:836
HFileInputResult FileInputByKey(const unsigned short *FileName, HC_KEY key, HInputHandlerOptions *options)
Definition: HIOUtilityPly.h:121
void RegisterOutputHandlerTypes()
Definition: HIOUtilityPly.h:90
A header file containing the HIO classes for passing to HBaseView::FileInput and HBaseView::FileOutpu...
const char * GetOutputTypesString()
Definition: HIOUtilityPly.h:98
HIOUtilityPly()
Definition: HIOUtilityPly.h:70