Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
Anonymous
unregistriert
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall tbVector3::tbVector3(void)" (__imp_??0tbVector3@@QAE@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class tbVector3 __thiscall tbVector3::operator-=(class tbVector3 const &)" (__imp_??ZtbVector3@@QAE?AV0@ABV0@@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class tbVector3 __thiscall tbVector3::operator+=(class tbVector3 const &)" (__imp_??YtbVector3@@QAE?AV0@ABV0@@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class tbVector3 __thiscall tbVector3::operator*(float)const " (__imp_??DtbVector3@@QBE?AV0@M@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class tbVector3 __thiscall tbVector3::operator=(class tbVector3 const &)" (__imp_??4tbVector3@@QAE?AV0@ABV0@@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall tbVector3::tbVector3(float,float,float)" (__imp_??0tbVector3@@QAE@MMM@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: enum tbResult __thiscall tbModel::Render(int,int,int,int)" (__imp_?Render@tbModel@@QAE?AW4tbResult@@HHHH@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static enum tbResult __cdecl tbDirect3D::SetRSF(enum _D3DRENDERSTATETYPE,float)" (__imp_?SetRSF@tbDirect3D@@SA?AW4tbResult@@W4_D3DRENDERSTATETYPE@@M@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static enum tbResult __cdecl tbDirect3D::SetRS(enum _D3DRENDERSTATETYPE,unsigned long)" (__imp_?SetRS@tbDirect3D@@SA?AW4tbResult@@W4_D3DRENDERSTATETYPE@@K@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall tbVector3::operator struct _D3DVECTOR &(void)" (__imp_??BtbVector3@@QAEAAU_D3DVECTOR@@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall tbColor::operator struct _D3DCOLORVALUE &(void)" (__imp_??BtbColor@@QAEAAU_D3DCOLORVALUE@@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall tbColor::tbColor(float,float,float)" (__imp_??0tbColor@@QAE@MMM@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: enum tbResult __thiscall tbEffect::End(void)" (__imp_?End@tbEffect@@QAE?AW4tbResult@@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: enum tbResult __thiscall tbEffect::Pass(int)" (__imp_?Pass@tbEffect@@QAE?AW4tbResult@@H@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall tbEffect::Begin(int,int)" (__imp_?Begin@tbEffect@@QAEHHH@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static enum tbResult __cdecl tbDirect3D::SetFVF(unsigned long)" (__imp_?SetFVF@tbDirect3D@@SA?AW4tbResult@@K@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct IDirect3DIndexBuffer9 * __thiscall tbIndexBuffer::GetIB(void)" (__imp_?GetIB@tbIndexBuffer@@QAEPAUIDirect3DIndexBuffer9@@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct IDirect3DVertexBuffer9 * __thiscall tbVertexBuffer::GetVB(void)" (__imp_?GetVB@tbVertexBuffer@@QAEPAUIDirect3DVertexBuffer9@@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class tbMatrix __cdecl tbMatrixTranslation(class tbVector3 const &)" (__imp_?tbMatrixTranslation@@YA?AVtbMatrix@@ABVtbVector3@@@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static enum tbResult __cdecl tbDirect3D::SetTexture(unsigned long,struct IDirect3DBaseTexture9 *)" (__imp_?SetTexture@tbDirect3D@@SA?AW4tbResult@@KPAUIDirect3DBa seTexture9@@@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class tbMatrix __cdecl tbMatrixCamera(class tbVector3 const &,class tbVector3 const &,class tbVector3 const &)" (__imp_?tbMatrixCamera@@YA?AVtbMatrix@@ABVtbVector3@@00@Z ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class tbVector3 __thiscall tbVector3::operator+(class tbVector3 const &)const " (__imp_??HtbVector3@@QBE?AV0@ABV0@@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class tbMatrix __thiscall tbMatrix::operator=(class tbMatrix const &)" (__imp_??4tbMatrix@@QAE?AV0@ABV0@@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class tbMatrix __cdecl tbMatrixProjection(float,float,float,float)" (__imp_?tbMatrixProjection@@YA?AVtbMatrix@@MMMM@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static struct IDirect3DDevice9 * __cdecl tbDirect3D::GetDevice(void)" (__imp_?GetDevice@tbDirect3D@@SAPAUIDirect3DDevice9@@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall tbMatrix::tbMatrix(void)" (__imp_??0tbMatrix@@QAE@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: enum tbResult __thiscall tbEffect::Init(char *)" (__imp_?Init@tbEffect@@QAE?AW4tbResult@@PAD@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall tbEffect::tbEffect(void)" (__imp_??0tbEffect@@QAE@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static struct IDirect3DCubeTexture9 * __cdecl tbTextureManager::GetCubeTexture(char *,int,int,int,enum _D3DFORMAT,unsigned long,enum _D3DPOOL,unsigned long,unsig ned long,unsigned long)" (__imp_?GetCubeTexture@tbTextureManager@@SAPAUIDirect3DCubeTexture9@@PADHHHW4_D3DFORMAT@@KW4_D3DPOOL@@KKK@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: enum tbResult __thiscall tbIndexBuffer::Update(void)" (__imp_?Update@tbIndexBuffer@@QAE?AW4tbResult@@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned long __thiscall tbIndexBuffer::AddIndices(unsigned long,void const *)" (__imp_?AddIndices@tbIndexBuffer@@QAEKKPBX@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: enum tbResult __thiscall tbVertexBuffer::Update(void)" (__imp_?Update@tbVertexBuffer@@QAE?AW4tbResult@@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned long __thiscall tbVertexBuffer::AddVertices(unsigned long,void const *)" (__imp_?AddVertices@tbVertexBuffer@@QAEKKPBX@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class tbVector3 __thiscall tbVector3::operator*=(float)" (__imp_??XtbVector3@@QAE?AV0@M@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: enum tbResult __thiscall tbIndexBuffer::Init(unsigned long,unsigned long,enum _D3DFORMAT,unsigned long,enum _D3DPOOL)" (__imp_?Init@tbIndexBuffer@@QAE?AW4tbResul t@@KKW4_D3DFORMAT@@KW4_D3DPOOL@@@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall tbIndexBuffer::tbIndexBuffer(void)" (__imp_??0tbIndexBuffer@@QAE@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: enum tbResult __thiscall tbVertexBuffer::Init(unsigned long,unsigned long,unsigned long,unsigned long,enum _D3DPOOL)" (__imp_?Init@tbVertexBuffer@@QAE?AW4tbResul t@@KKKKW4_D3DPOOL@@@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall tbVertexBuffer::tbVertexBuffer(void)" (__imp_??0tbVertexBuffer@@QAE@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) enum tbResult __cdecl tbExit(void)" (__imp_?tbExit@@YA?AW4tbResult@@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static enum tbResult __cdecl tbTextureManager::Exit(void)" (__imp_?Exit@tbTextureManager@@SA?AW4tbResult@@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static enum tbResult __cdecl tbDirect3D::Exit(void)" (__imp_?Exit@tbDirect3D@@SA?AW4tbResult@@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall tbVertexBuffer::~tbVertexBuffer(void)" (__imp_??1tbVertexBuffer@@QAE@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall tbIndexBuffer::~tbIndexBuffer(void)" (__imp_??1tbIndexBuffer@@QAE@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall tbEffect::~tbEffect(void)" (__imp_??1tbEffect@@QAE@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall tbModel::~tbModel(void)" (__imp_??1tbModel@@QAE@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) enum tbResult __cdecl tbDoMessageLoop(enum tbResult (__cdecl*)(float),enum tbResult (__cdecl*)(float))" (__imp_?tbDoMessageLoop@@YA?AW4tbResult@@P6A?AW41@M@Z0@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: enum tbResult __thiscall tbModel::Init(char *,char *,char *,enum _D3DPOOL,unsigned long,enum _D3DPOOL,unsigned long,int,int)" (__imp_?Init@tbModel@@QAE?AW4tbResu lt@@PAD00W4_D3DPOOL@@K1KHH@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall tbModel::tbModel(void)" (__imp_??0tbModel@@QAE@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static struct HWND__ * __cdecl tbDirect3D::GetWindow(void)" (__imp_?GetWindow@tbDirect3D@@SAPAUHWND__@@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static enum tbResult __cdecl tbTextureManager::Init(int)" (__imp_?Init@tbTextureManager@@SA?AW4tbResult@@H@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static enum tbResult __cdecl tbDirect3D::Init(struct tbConfig *,char *,struct HWND__ *,struct HICON__ *)" (__imp_?Init@tbDirect3D@@SA?AW4tbResult@@PAUtbConfig@@P ADPAUHWND__@@PAUHICON__@@@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) enum tbResult __cdecl tbDoConfigDialog(struct tbConfig *)" (__imp_?tbDoConfigDialog@@YA?AW4tbResult@@PAUtbConfig@@@Z) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) enum tbResult __cdecl tbInit(void)" (__imp_?tbInit@@YA?AW4tbResult@@XZ) demofile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall tbMatrix::tbMatrix(float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float)" (__imp_??0tbMatrix@@QAE@MMMMMMMMM MMMMMMM@Z) Debug/DemotbRaum.exe : fatal error LNK1120: 54 unresolved externals Error executing link.exe. DemotbRaum.exe - 55 error(s), 0 warning(s) |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
#include <TriBase.h> #include "Resource.h" #define SKY_BOX_VERTEX_FVF (D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE3(0)) struct SSkyBoxVertex { tbVector3 vPosition; // Position tbVector3 vTexture; // 3D-Texturkoordinaten }; tbConfig g_Config; // Konfigurationsstruktur tbVertexBuffer* g_pSkyBoxVB = NULL; // Sky-Box-Vertex-Buffer tbIndexBuffer* g_pSkyBoxIB = NULL; // Sky-Box-Index-Buffer PDIRECT3DCUBETEXTURE9 g_pSkyBoxTexture = NULL; // Sky-Box-Textur tbEffect* g_pSkyBoxEffect = NULL; // Sky-Box-Effekt tbModel* g_pRaumEr = NULL; // Raumschiffmodell tbVector3 g_vCameraPos; // Kameraposition float g_fCameraRot; // Rotation der Kamera float g_fCameraUpDown; // Schaut die Kamera hoch oder runter? float g_fTime = 0.0f; // Globaler Zeitzähler tbResult MoveProc(float fNumSecsPassed) { tbVector3 vCameraDir; // Den Zeitzähler aktualisieren g_fTime += fNumSecsPassed; // Tastatursteuerung... vCameraDir = tbVector3(sinf(g_fCameraRot) * cosf(g_fCameraUpDown), sinf(g_fCameraUpDown), cosf(g_fCameraRot) * cosf(g_fCameraUpDown)); if(GetAsyncKeyState(VK_LEFT)) g_fCameraRot -= 1.0f * fNumSecsPassed; if(GetAsyncKeyState(VK_RIGHT)) g_fCameraRot += 1.0f * fNumSecsPassed; if(GetAsyncKeyState(VK_UP)) g_fCameraUpDown -= 1.0f * fNumSecsPassed; if(GetAsyncKeyState(VK_DOWN)) g_fCameraUpDown += 1.0f * fNumSecsPassed; if(GetAsyncKeyState(VK_ADD)) g_vCameraPos += vCameraDir * 15.0f * fNumSecsPassed; if(GetAsyncKeyState(VK_SUBTRACT)) g_vCameraPos -= vCameraDir * 15.0f * fNumSecsPassed; return TB_OK; } tbResult RenderProc(float fNumSecsPassed) { float fAspect; tbMatrix mProjection; tbMatrix mCamera; tbMatrix mWorld; tbVector3 vCameraDir; D3DLIGHT9 Light; int iNumPasses; // Z-Buffer leeren und die Szene beginnen tbDirect3D::GetDevice()->Clear(0, NULL, D3DCLEAR_ZBUFFER, 0, 1.0f, 0); tbDirect3D::GetDevice()->BeginScene(); // Projektionsmatrix erstellen und einsetzen fAspect = (float)(g_Config.Direct3D.VideoMode.Width) / (float)(g_Config.Direct3D.VideoMode.Height); mProjection = tbMatrixProjection(TB_DEG_TO_RAD(60.0f), fAspect, 1.0f, 300.0f); tbDirect3D::GetDevice()->SetTransform(D3DTS_PROJECTION, (D3DMATRIX*)(&mProjection)); // Kameramatrix erstellen und einsetzen vCameraDir = tbVector3(sinf(g_fCameraRot) * cosf(g_fCameraUpDown), sinf(g_fCameraUpDown), cosf(g_fCameraRot) * cosf(g_fCameraUpDown)); mCamera = tbMatrixCamera(g_vCameraPos, g_vCameraPos + vCameraDir); tbDirect3D::GetDevice()->SetTransform(D3DTS_VIEW, (D3DMATRIX*)(&mCamera)); // ------------------------------------------------------------------ // Die Sky-Box-Textur setzen tbDirect3D::SetTexture(0, g_pSkyBoxTexture); // Weltmatrix erstellen, die die Sky-Box zur Kamera hin schiebt mWorld = tbMatrixTranslation(g_vCameraPos); tbDirect3D::GetDevice()->SetTransform(D3DTS_WORLD, (D3DMATRIX*)(&mWorld)); // Vertex- und Index-Buffer aktivieren und das Vertexformat setzen tbDirect3D::GetDevice()->SetStreamSource(0, g_pSkyBoxVB->GetVB(), 0, sizeof(SSkyBoxVertex)); tbDirect3D::GetDevice()->SetIndices(g_pSkyBoxIB->GetIB()); tbDirect3D::SetFVF(SKY_BOX_VERTEX_FVF); // Zeichnen! iNumPasses = g_pSkyBoxEffect->Begin(); for(int iPass = 0; iPass < iNumPasses; iPass++) { g_pSkyBoxEffect->Pass(iPass); tbDirect3D::GetDevice()->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 8, 0, 12); } g_pSkyBoxEffect->End(); // Ein Richtungslicht erstellen mit der Richtung der Kamera ZeroMemory(&Light, sizeof(D3DLIGHT9)); Light.Type = D3DLIGHT_DIRECTIONAL; Light.Diffuse = tbColor(0.5f, 0.5f, 0.5f); Light.Ambient = tbColor(0.5f, 0.5f, 0.5f); Light.Specular = tbColor(0.5f, 0.5f, 0.5f); Light.Direction = vCameraDir; tbDirect3D::GetDevice()->SetLight(0, &Light); tbDirect3D::GetDevice()->LightEnable(0, TRUE); // Linearer schwarzer Nebel! tbDirect3D::SetRS(D3DRS_FOGENABLE, TRUE); tbDirect3D::SetRS(D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR); tbDirect3D::SetRS(D3DRS_RANGEFOGENABLE, TRUE); tbDirect3D::SetRS(D3DRS_FOGCOLOR, 0); tbDirect3D::SetRSF(D3DRS_FOGSTART, 100.0f); tbDirect3D::SetRSF(D3DRS_FOGEND, 350.0f); g_pRaumEr->Render(-1, -1, TRUE, FALSE); g_pRaumEr->Render(-1, -1, FALSE, TRUE); // Weltmatrix zurücksetzen tbDirect3D::GetDevice()->SetTransform(D3DTS_WORLD, (D3DMATRIX*)(&tbMatrixIdentity())); // Kein Nebel mehr! tbDirect3D::SetRS(D3DRS_FOGENABLE, FALSE); // ------------------------------------------------------------------ // Szene beenden und darstellen tbDirect3D::GetDevice()->EndScene(); tbDirect3D::GetDevice()->Present(NULL, NULL, NULL, NULL); return TB_OK; } tbResult InitSkyBox() { SSkyBoxVertex aVertex[8]; // Vertex- und Index-Buffer erstellen. 8 Vertizes, 36 Indizes. g_pSkyBoxVB = new tbVertexBuffer; if(g_pSkyBoxVB->Init(8 * sizeof(SSkyBoxVertex), sizeof(SSkyBoxVertex), SKY_BOX_VERTEX_FVF, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, D3DPOOL_DEFAULT)) { // Fehler! return TB_ERROR; } // Nun der Index-Buffer (16 Bits pro Index) g_pSkyBoxIB = new tbIndexBuffer; if(g_pSkyBoxIB->Init(36 * sizeof(WORD), sizeof(WORD), D3DFMT_INDEX16)) { // Fehler! return TB_ERROR; } // ------------------------------------------------------------------ // Die Vertizes erstellen aVertex[0].vPosition = tbVector3(-1.0f, 1.0f, 1.0f); aVertex[1].vPosition = tbVector3( 1.0f, 1.0f, 1.0f); aVertex[2].vPosition = tbVector3( 1.0f, 1.0f, -1.0f); aVertex[3].vPosition = tbVector3(-1.0f, 1.0f, -1.0f); aVertex[4].vPosition = tbVector3(-1.0f, -1.0f, 1.0f); aVertex[5].vPosition = tbVector3( 1.0f, -1.0f, 1.0f); aVertex[6].vPosition = tbVector3( 1.0f, -1.0f, -1.0f); aVertex[7].vPosition = tbVector3(-1.0f, -1.0f, -1.0f); // Die Texturkoordinaten entsprechen den Vertexpositionen for(int iVertex = 0; iVertex < 8; iVertex++) { // Texturkoordinate eintragen und Sky-Box skalieren aVertex[iVertex].vTexture = aVertex[iVertex].vPosition; aVertex[iVertex].vPosition *= 10.0f; } // Alle Vertizes eintragen und den Vertex-Buffer aktualisieren g_pSkyBoxVB->AddVertices(8, aVertex); if(g_pSkyBoxVB->Update()) return TB_ERROR; // ------------------------------------------------------------------ // Den Index-Buffer ausfüllen WORD awIndex[36] = {7, 3, 0, 4, 7, 0, // Vorderseite 5, 1, 2, 6, 5, 2, // Hinterseite 4, 0, 1, 5, 4, 1, // Linke Seite 6, 2, 3, 7, 6, 3, // Rechte Seite 2, 1, 0, 3, 2, 0, // Oberseite 4, 5, 6, 7, 4, 6}; // Unterseite g_pSkyBoxIB->AddIndices(36, awIndex); if(g_pSkyBoxIB->Update()) return TB_ERROR; // ------------------------------------------------------------------ // Die Textur der Sky-Box laden g_pSkyBoxTexture = tbTextureManager::GetCubeTexture("SkyBox.dds@Data\\SkyBox.zip"); if(g_pSkyBoxTexture == NULL) return TB_ERROR; // Effekt laden g_pSkyBoxEffect = new tbEffect; if(g_pSkyBoxEffect == NULL) return TB_ERROR; if(g_pSkyBoxEffect->Init("SkyBox.fx@Data\\SkyBox.zip")) return TB_ERROR; return TB_OK; } // ****************************************************************** // Aufräumen tbResult CleanUp() { // Alles löschen TB_SAFE_DELETE(g_pSkyBoxVB); TB_SAFE_DELETE(g_pSkyBoxIB); TB_SAFE_DELETE(g_pSkyBoxEffect); TB_SAFE_DELETE(g_pRaumEr); tbDirect3D::Exit(); tbTextureManager::Exit(); // Die TriBase-Engine herunterfahren tbExit(); return TB_OK; } // Windows-Hauptfunktion int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, char* pcCommandLine, int iShowCommand) { int r; // TriBase-Engine initialisieren tbInit(); // Konfiguration abfragen if(r = tbDoConfigDialog(&g_Config)) { if(r == TB_CANCELED) return 0; else { // Fehler! MessageBox(NULL, "Fehler im Konfigurationsdialog!", "Fehler", MB_OK | MB_ICONEXCLAMATION); return 1; } } // Direct3D initialisieren if(tbDirect3D::Init(&g_Config, "Beispielprogramm Nr. 2: Modelle", NULL, LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)))) { // Fehler! MessageBox(NULL, "Fehler bei der Direct3D-Initialisierung!", "Fehler", MB_OK | MB_ICONEXCLAMATION); CleanUp(); return 1; } // Den Texturmanager initialisieren if(tbTextureManager::Init()) { MessageBox(tbDirect3D::GetWindow(), "Fehler beim Initialisieren des Texturmanagers!", "Fehler", MB_OK | MB_ICONEXCLAMATION); CleanUp(); return 1; } // Sky-Box initialisieren if(InitSkyBox()) { MessageBox(tbDirect3D::GetWindow(), "Fehler beim Erstellen der Sky-Box!", "Fehler", MB_OK | MB_ICONEXCLAMATION); CleanUp(); return 1; } g_pRaumEr = new tbModel; if(g_pRaumEr->Init("Raumschiff.tbm")) { MessageBox(tbDirect3D::GetWindow(), "Fehler beim Laden der Schiffmodelldatei!", "Fehler", MB_OK | MB_ICONEXCLAMATION); CleanUp(); return 1; } // Kamera initialisieren g_vCameraPos = tbVector3(0.0f, 10.0f, 0.0f); g_fCameraRot = 0.0f; g_fCameraUpDown = 0.0f; // Nachrichtenschleife betreten if(tbDoMessageLoop(MoveProc, RenderProc)) { MessageBox(tbDirect3D::GetWindow(), "Fehler beim Zeichnen!", "Fehler", MB_OK | MB_ICONEXCLAMATION); CleanUp(); return 1; } // Aufräumen CleanUp(); return 0; } |
Quellcode |
|
1 |
Projekt->Eigenschaften von <Projektname>->Linker->Eingabe->Zusätzliche Abhängigkeiten->[zu linkende libs eintragen] |
Werbeanzeige