Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TerrainHaze.cpp
Go to the documentation of this file.
1 /* Project Starshatter 4.5
2  Destroyer Studios LLC
3  Copyright © 1997-2005. All Rights Reserved.
4 
5  SUBSYSTEM: Stars.exe
6  FILE: TerrainHaze.cpp
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12 */
13 
14 #include "MemDebug.h"
15 #include "Terrain.h"
16 #include "TerrainHaze.h"
17 #include "TerrainRegion.h"
18 
19 #include "Light.h"
20 #include "CameraView.h"
21 #include "Bitmap.h"
22 #include "DataLoader.h"
23 #include "Game.h"
24 
25 // +====================================================================+
26 
27 static Bitmap terrain_texture;
28 
29 // +--------------------------------------------------------------------+
30 
32 : tregion(0)
33 {
34 }
35 
36 // +--------------------------------------------------------------------+
37 
39 {
40 }
41 
42 // +--------------------------------------------------------------------+
43 
44 void
45 TerrainHaze::Render(Video* video, DWORD flags)
46 {
47  if (flags & RENDER_ADDITIVE)
48  return;
49 
50  if (model) {
51  if (!Luminous()) {
52  SetLuminous(true);
53  model->SetDynamic(true);
54  }
55 
56  Surface* surface = model->GetSurfaces().first();
57 
58  if (!surface) return;
59 
60  int i;
61  DWORD sky = 0;
62  DWORD fog = 0;
63 
64  if (tregion) {
65  sky = tregion->SkyColor().Value();
66  fog = tregion->FogColor().Value();
67  }
68 
69  // clear the solid lights to ambient:
70  VertexSet* vset = surface->GetVertexSet();
71 
72  for (i = 0; i < vset->nverts; i++) {
73  if (vset->loc[i].y > 0)
74  vset->diffuse[i] = sky;
75  else
76  vset->diffuse[i] = fog;
77  }
78 
80  Solid::Render(video, flags);
81  }
82 }
83 
84 // +--------------------------------------------------------------------+
85 
86 int
87 TerrainHaze::CheckRayIntersection(Point Q, Point w, double len, Point& ipt, bool ttpas)
88 {
89  return 0;
90 }