Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HUtilityShadow.h
Go to the documentation of this file.
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: afa285c82e43f6e8c93de261f9be1ce672e77c67 $
13 //
14 
15 // HUtilityShadow.h : interface of the HUtilityShadow classes
16 // Set of utility methods for shadow creations
17 
22 #ifndef _HUTILITYSHADOW_H
23 #define _HUTILITYSHADOW_H
24 
25 #ifdef H_PACK_8
26 #pragma pack(push)
27 #pragma pack(8)
28 #endif
29 
30 #include "HTools.h"
31 
32 
33 class HBaseView;
34 class HPixelRGB;
35 class HPixelRGBA;
36 
37 
42 {
46 };
47 
48 
50 
98 class MVO_API HShadow
99 {
100 public:
101 
107  HShadow(HC_KEY ModelSegmentKey, HC_KEY ShadowBaseSegmentKey, float *ObjectModellingMatrix = 0);
108 
112  void CalculateTotalModelExtents();
113 
115  void GetModelExtents(HPoint &ObjectBoundingMin, HPoint &ObjectBoundingMax)
116  {
117  ObjectBoundingMin = m_ObjectBoundingMin;
118  ObjectBoundingMax = m_ObjectBoundingMax;
119  }
120 
122  void GetShadowLightPos(HPoint &lightpos) { lightpos = m_ShadowLightPos; }
124  void GetShadowGroundPlane(HPlane &plane) { plane = m_ShadowGroundPlane; }
126  HC_KEY GetShadowKey() { return m_ShadowSegmentKey; }
127 
129  void SetShadowLightPos(HPoint lightpos) { m_ShadowLightPos = lightpos; }
131  void SetShadowGroundPlane(HPlane plane) { m_ShadowGroundPlane = plane; }
132 
134  void SetShadowBrightness(int ShadowBrightness) { m_ShadowBrightness = ShadowBrightness; }
136  int GetShadowBrightness() { return m_ShadowBrightness; }
137 
138 protected:
151  float m_ObjectModellingMatrix[16];
159  void ShowModellingMatrix(HC_KEY segkey, float * oldmatrix, float * newmatrix);
160 
168  void ComputeObjectExtents(HPoint &min, HPoint &max, HPoint *points, int numpoints);
169 
175  void RotateToGroundPlane(HPlane plane, float *matrix);
176 
183  void ShadowMatrix2(float *matrix, HPlane plane, HPoint d);
184 
188  HC_KEY IsolateShell();
189 
193  void RestoreShell();
194 
195 
200  bool HasShell(HC_KEY segKey);
201 
202 private:
203  void CalculateModelExtents(HC_KEY SegKey, float *totalmatrix);
204  void SetIdentityMatrix(float *matrix);
205  void ShadowMatrix(float *mm, HPlane plane, HPoint light);
206 
207 
208 };
209 
211 
214 class MVO_API HSmoothShadow : public HShadow
215 {
216 
217 public:
222  HSmoothShadow(HC_KEY ModelSegmentKey, HC_KEY ShadowBaseSegmentKey, bool UseOglShadow = false);
223  virtual ~HSmoothShadow();
227  void CleanUp();
228 
235  void Create(ShadowPlaneType ptype, int TextureSize = 0, int FilterSize = -1, int *filter = 0);
236 
240  void Create();
241 
243  int GetFilterSize() { return m_FilterSize; }
244 
246  int GetTextureSize() { return m_TextureSize; }
247 
252  void SetTextureSize(int TextureSize) { m_TextureSize = TextureSize; }
253 
259  void SetFilter(int *filter, int FilterSize) { m_filter = filter; m_FilterSize = FilterSize; }
260 
263  void UnDefineShadowTexture();
266  static void UnDefineAllShadowTextures(HC_KEY modelsegmentkey);
267 
272  void SetAllowOpenglShadow(bool AllowOpenglShadow) { m_bAllowOpenglShadow = AllowOpenglShadow; }
273 protected:
276  int *m_filter;
280  char m_texname[MVO_SMALL_BUFFER_SIZE];
282 
285  void CalculateTotalShadowExtents();
286 
292  void CalculateShadowExtents(HC_KEY segkey,float *totalmatrix);
293 
297  void CreateSoftShadow();
298 
302  void CreateShadowTexture();
303 
312  void SmoothImage(HPixelRGB *origImage, HPixelRGBA **smoothImage, int width, int height, int filterSize, int *filter);
313 
314 private:
315  void CalculateOneShadowExtent(HC_KEY shellkey, float *modellingMatrix);
316 
317 };
318 
319 
321 class MVO_API HHardShadow : public HShadow
322 {
323 
324 public:
326  HHardShadow(HC_KEY ModelSegmentKey, HC_KEY ShadowBaseSegmentKey) : HShadow(ModelSegmentKey, ShadowBaseSegmentKey) {}
327 
328  virtual ~HHardShadow() {};
329 
330 
335  void Create(ShadowPlaneType ptype);
336 
340  virtual void Create();
341 
342 protected:
343 
347  void CreateHardShadow();
348 
349 };
350 
351 
352 
353 #ifdef H_PACK_8
354 #pragma pack(pop)
355 #endif
356 
357 #endif
358 
359 
360 
HPoint m_ShadowBoundingMax
max value of shadow bounding volume
Definition: HUtilityShadow.h:279
The HPixelRGB class is the data type of a rgb pixel.
Definition: HGlobals.h:478
int m_ShadowBrightness
Definition: HUtilityShadow.h:143
void GetShadowLightPos(HPoint &lightpos)
Definition: HUtilityShadow.h:122
int GetShadowBrightness()
Definition: HUtilityShadow.h:136
HPoint m_ObjectBoundingMin
Definition: HUtilityShadow.h:148
int GetTextureSize()
Definition: HUtilityShadow.h:246
This class has been deprecated.
Definition: HUtilityShadow.h:214
self-explanatory
Definition: HUtilityShadow.h:44
bool m_bFirstCoordinate
Definition: HUtilityShadow.h:139
HC_KEY m_ImageKey
key to shadow image
Definition: HUtilityShadow.h:277
void SetShadowBrightness(int ShadowBrightness)
Definition: HUtilityShadow.h:134
void GetShadowGroundPlane(HPlane &plane)
Definition: HUtilityShadow.h:124
int m_FilterSize
size of filter matrix
Definition: HUtilityShadow.h:275
#define HC_KEY
bool m_bAllowOpenglShadow
use opengl offscreen buffer
Definition: HUtilityShadow.h:281
void SetShadowLightPos(HPoint lightpos)
Definition: HUtilityShadow.h:129
The HPixelRGBA class is the data type of a rgba pixel.
Definition: HGlobals.h:516
HHardShadow(HC_KEY ModelSegmentKey, HC_KEY ShadowBaseSegmentKey)
Definition: HUtilityShadow.h:326
int * m_filter
filter matrix
Definition: HUtilityShadow.h:276
int m_TextureSize
size of texture extents
Definition: HUtilityShadow.h:274
void GetModelExtents(HPoint &ObjectBoundingMin, HPoint &ObjectBoundingMax)
Definition: HUtilityShadow.h:115
HPoint m_ShadowBoundingMin
min value of shadow bounding volume
Definition: HUtilityShadow.h:278
HC_KEY m_ShadowSegmentKey
Definition: HUtilityShadow.h:142
void SetFilter(int *filter, int FilterSize)
Definition: HUtilityShadow.h:259
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:126
This class has been deprecated.
Definition: HUtilityShadow.h:98
The HBaseView class defines and manages a view of model information.
Definition: HBaseView.h:337
void SetShadowGroundPlane(HPlane plane)
Definition: HUtilityShadow.h:131
ShadowPlaneType
Definition: HUtilityShadow.h:41
void SetTextureSize(int TextureSize)
Definition: HUtilityShadow.h:252
HC_KEY m_ModelSegmentKey
Definition: HUtilityShadow.h:141
HPlane m_ShadowGroundPlane
Definition: HUtilityShadow.h:146
self-explanatory
Definition: HUtilityShadow.h:45
void SetAllowOpenglShadow(bool AllowOpenglShadow)
Definition: HUtilityShadow.h:272
HPoint m_ObjectBoundingMax
Definition: HUtilityShadow.h:149
HPoint m_ShadowLightPos
Definition: HUtilityShadow.h:145
self-explanatory
Definition: HUtilityShadow.h:43
int GetFilterSize()
Definition: HUtilityShadow.h:243
This class has been deprecated.
Definition: HUtilityShadow.h:321
HC_KEY GetShadowKey()
Definition: HUtilityShadow.h:126
The HPlane class is the data type of a plane.
Definition: HGlobals.h:339