- #Expensive water in 3d skybox source engine sdk update#
- #Expensive water in 3d skybox source engine sdk download#
If (FAILED(dx_Object->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &dx_PresParams, &graphicsDevice))) ZeroMemory(&dx_PresParams, sizeof(dx_PresParams)) ĭx_PresParams.SwapEffect = D3DSWAPEFFECT_DISCARD ĭx_PresParams.BackBufferFormat = D3DFMT_UNKNOWN ĭx_PresParams.EnableAutoDepthStencil = TRUE ĭx_PresParams.AutoDepthStencilFormat = D3DFMT_D16
MessageBox(hwnd, "DirectX Runtime library not installed!", "InitializeDevice()",MB_OK) LPDIRECT3DDEVICE9 RC3DUtility::InitializeDevice(HWND hwnd, UINT width,UINT height)ĭx_Object = Direct3DCreate9(D3D_SDK_VERSION) (I know, the window creation is important, but as I said in the last post, this is covered in Riemers tutorial so I wont cover it here) The most important of the lot is InitializeDevice, this is the method that is going to give you your graphics device and allow you to draw your stuff. So there is a fair bit in here already, but once I have these out of the way, we can get onto some more interesting stuff. and finally, two members a graphics device and an input device for the keyboard. A method to create and initialise the graphics driver, a method to create a window the application will run in, a method to initialise the keyboards for input, my own Clamp method (could not find one natively, though there must be one.), translate and rotate methods so I don't have to have these methods in each of my game objects. Static void Rotate(D3DXQUATERNION *outRotation,D3DXVECTOR3 axis, float angle,D3DXQUATERNION *rotation) Īs you can see we have a constructor and corresponding destructor. Static void Translate(D3DXVECTOR3 *outPosition,D3DXVECTOR3 distance,D3DXQUATERNION *rotation) Static float Clamp( float val, float min, float max) LPDIRECTINPUTDEVICE8 InitializeKeyboard(HWND hwnd) HWND CreateNewWindow(LPCTSTR str_Title, int int_XPos, int int_YPos, int int_Width, int int_Height,WNDPROC callBack) LPDIRECT3DDEVICE9 InitializeDevice(HWND hwnd,UINT width,UINT height)
#Expensive water in 3d skybox source engine sdk download#
This post has been a bit light I know, the terrain class will be next and then the main.cpp, this will show how it all hangs together and in that last post I will put up a solution to download so you can have a play with it.
#Expensive water in 3d skybox source engine sdk update#
Not sure what else to add here, it is pretty simple stuff, the only method of real note is the Update method as this is where the View and Projection Matrices are set, but this is done exactly the same as before in my XNA Camera class. Void BaseCamera::SetRotation(D3DXQUATERNION newRotation)ĭ3DXVECTOR3 BaseCamera::GetPosition( void) Void BaseCamera::SetPosition(D3DXVECTOR3 newPos) RC3DUtility::Rotate(&rotation,axis,angle,&rotation) Void BaseCamera::Rotate(D3DXVECTOR3 axis, float angle) RC3DUtility::Translate(&position,distance,&rotation) Void BaseCamera::Translate(D3DXVECTOR3 distance) Then the protected members.īaseCamera::BaseCamera(LPDIRECT3DDEVICE9 *Device,D3DXVECTOR3 pos, D3DXVECTOR3 worldUp, D3DXQUATERNION rot,UINT width,UINT height)ĭ3DXMatrixRotationQuaternion(&rotMat,&rotation) ĭ3DXMatrixTranslation(&posMat,position.x,position.y,position.z) ĭ3DXMatrixMultiply(&rotMat,&rotMat,&posMat) įloat md = D3DXMatrixDeterminant(&rotMat) ĭ3DXMatrixPerspectiveFovRH(&projection, D3DX_PI/3.0, ( float)Width/( float)Height, 1, 10000) The ctor and dtor are there as expected, then two methods to get the cameras View and Projection Matrix, an update method, translate and rotate then methods to set the position, target and rotation, height and width (for the viewport) and finally a method to get the camera position.
Void SetRotation(D3DXQUATERNION newRotation) Void Rotate(D3DXVECTOR3 axis, float angle) BaseCamera(LPDIRECT3DDEVICE9 *p_dx_Device,D3DXVECTOR3 pos,D3DXVECTOR3 worldUp,D3DXQUATERNION rot, UINT width,UINT height)