source: GTP-Internal/trunk/App/Demos/Illum/Ocean/OceanEffect.h @ 1777

Revision 1777, 1.5 KB checked in by szirmay, 18 years ago (diff)
Line 
1#pragma once
2
3#include <d3d9.h>
4#include <d3dx9.h>
5#include <dxerr.h>
6#include <vector>
7
8#include "ship.h"
9#define MAXSHIPS 2
10
11class OceanEffect
12{
13        LPDIRECT3DDEVICE9 device;
14        LPD3DXEFFECT effect;
15
16        LPDIRECT3DINDEXBUFFER9          oceanIndexBuffer;
17        LPDIRECT3DVERTEXBUFFER9         oceanVertexBuffer;
18
19        CFirstPersonCamera*     camera;
20
21        LPDIRECT3DCUBETEXTURE9 environmentCube;
22        LPDIRECT3DTEXTURE9 waterTexture;
23        LPDIRECT3DTEXTURE9 elevationTexture;
24
25        LPD3DXMESH ship;
26        LPDIRECT3DINDEXBUFFER9           shipIndexBuffer;
27        LPDIRECT3DVERTEXBUFFER9          shipVertexBuffer;
28
29        LPDIRECT3DVERTEXDECLARATION9 shipDeclaration;
30
31        LPDIRECT3DVERTEXBUFFER9         instanceVertexBuffer;
32
33        Ship ships[MAXSHIPS];
34        int nShips;
35
36        struct ShipInstanceData
37        {
38                D3DXVECTOR3 tangent;
39                D3DXVECTOR3 binormal;
40                D3DXVECTOR3 shipPos;
41        } shipLocations[MAXSHIPS];
42
43        LPD3DXMESH optimizedShip;
44        D3DXMATRIX downScale, shipWorldViewProjMatrix, finalWorld;
45
46        ID3DXFont*              g_pFont;         // Font for drawing text
47        ID3DXSprite*            g_pTextSprite;   // Sprite for batching draw text calls
48
49
50        std::vector<D3DMATERIAL9>       Mtrls;
51        std::vector<IDirect3DTexture9*> textures;
52
53        ID3DXBuffer* adjBuffer;
54        ID3DXBuffer* mtrlBuffer;
55        DWORD        numMtrls;
56
57        float testRotation;
58
59        float time;
60public:
61        OceanEffect(LPDIRECT3DDEVICE9 device);
62        ~OceanEffect(void);
63
64        void render();
65        void move(double time, double elapsedTime);
66        void message(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
67        void applyShip();
68};
Note: See TracBrowser for help on using the repository browser.