亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? bsploader.cpp

?? 一個DXD制作的讀取QUAKE的BSP結構的Demo可以參考
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/*
   Bsp Loader Demo.
   Created by the Programming Ace.
   www.UltimateGameProgramming.com


   The purpose of this demo is to load a Quake 3 map in our application.
   This is done pretty easily by loading the data section by section.
   Once loaded this map can be rendered out to the scene.  This demo
   also has light maps which are added using simple multi-texture.

   This map was created using Q3Radiant.  This map is just a simple room
   with a few squares in it.  Q3 maps can be textured with either .tga
   images or .jpg (that is what the Q3 engine supports) so keep that in
   mind when trying to load maps others made.  If they use any .jpgs you
   either must convert to .tga or write code to load a .jpg.
*/


// Demo: Bsp Loader.


#define WIN32_LEAN_AND_MEAN
#define VC_LEANMEAN

#include<d3dx9.h>
#include"CBspLevel.h"
#include"CCamera.h"


// Function Prototypes...
bool InitializeDirect3D(HWND hwnd, bool fullscreen);
bool InitializeObject();
void RenderScene();
void ShutdownDirect3D();


LPDIRECT3D9 Direct3D_Object = NULL;
LPDIRECT3DDEVICE9 D3D_Device = NULL;
LPDIRECT3DTEXTURE9 *Texture = NULL;
LPDIRECT3DTEXTURE9 *LightMaps = NULL;
LPDIRECT3DVERTEXBUFFER9 Vertex_Buffer = NULL;
LPDIRECT3DVERTEXDECLARATION9 VertexDeclaration = NULL;

// Object to hold the level and a camera object.
CBspLevel BspLevel;
CCamera Camera;


void ApplyGamma(unsigned char *image, int size, int componenets, float gamma)
{
   if(!image) return;

   for(int i = 0; i < size / componenets; i++) 
      {
         float scale = 1.0f, temp = 0.0f;
         float r = 0, g = 0, b = 0;

         // extract the current RGB values
         r = (float)image[0];
         g = (float)image[1];
         b = (float)image[2];

         // Apply gamma.  Divide to keep 0 to 255.
         r *= gamma / 255.0f;
         g *= gamma / 255.0f;
         b *= gamma / 255.0f;

         temp = (1.0f / r);
         if(r > 1.0f && temp < scale) scale = temp;
         temp = (1.0f / g);
         if(g > 1.0f && temp < scale) scale = temp;
         temp = (1.0f / b);
         if(b > 1.0f && temp < scale) scale = temp;

         // Apply scale.
         scale *= 255.0f;		
         r *= scale;
         g *= scale;
         b *= scale;

         image[0] = (unsigned char)r;
         image[1] = (unsigned char)g;
         image[2] = (unsigned char)b;
         image += componenets;
      }
}



LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch(message)
       {
		   case WM_KEYUP:
            // If the user presses the escape key then exit the application.
            if(wParam == VK_ESCAPE)
               PostQuitMessage(0);
            break;


         case WM_DESTROY:
         case WM_CLOSE:
            PostQuitMessage(0);
            break;


            default:
               break;
       }

    return DefWindowProc( hwnd, message, wParam, lParam );
}


int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
   MSG msg;                                           // Message object.
   HWND hwnd;                                         // Handle to the window.
   WNDCLASSEX windowClass;                            // Window class object.
   bool done = false;                                 // False if we should exit.

   // This is the Window class.
   windowClass.cbSize = sizeof(WNDCLASSEX);           // size of the WNDCLASSEX structure.
   windowClass.style = CS_HREDRAW | CS_VREDRAW;       // style of the window.
   windowClass.lpfnWndProc = WndProc;                 // Address to the windows procedure.
   windowClass.cbClsExtra = 0;                        // Extra class information.
   windowClass.cbWndExtra = 0;                        // Extra window information.
   windowClass.hInstance = hInstance;                 // Handle of application Instance.
   windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);// Window Icon.
   windowClass.hCursor = LoadCursor(NULL, IDC_ARROW); // Load mouse cursor.
   windowClass.hbrBackground = NULL;                  // Background color.
   windowClass.lpszMenuName = NULL;                   // Menu.
   windowClass.lpszClassName = "UGPClass";            // Name of the window class.
   windowClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);// Minimized window icon.

   // You must register you class with Windows.
   if(!RegisterClassEx(&windowClass)) return 0;

   // After your class has been registered then you are ready to create your window.
   hwnd = CreateWindowEx(NULL,                                       // The extended style.
                         "UGPClass",                                 // Window class.
                         "Quake 3 BSP - by The Programming Ace",// Window name.
                          WS_OVERLAPPEDWINDOW | WS_VISIBLE |         // Window style.
                          WS_SYSMENU |WS_CLIPCHILDREN |              // Window style.
                          WS_CLIPSIBLINGS,                           // Window style.
                          100, 100,                                  // X, Y coords.
                          640, 480,                                  // Window size.
                          NULL,                                      // Handle to parent window.
                          NULL,                                      // Menu.
                          hInstance,                                 // Handle to app instance.
                          NULL);                                     // Pointer to window.

   // If there was an error with creating the window, then close the program.
   if(!hwnd) return 0;

   ShowWindow(hwnd, SW_SHOW);    // Show the window.
   UpdateWindow(hwnd);           // Update its display.

   done = false;                 // false = run program, true means stop.

   // Initialize Direct3D.  If fails then we don't want to run the application.
   if(!InitializeDirect3D(hwnd, false)) done = true;

   // Application loop.
   while(!done)
      {
         if(PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE))
            {
               // If a quit message is received then stop rendering and quit the app.
               if(msg.message == WM_QUIT)
                  {
                     done = true;
                  }

               TranslateMessage(&msg);
               DispatchMessage(&msg);
            }
         else
            {
               RenderScene();
            }
      }

    // Here we shutdown Direct 3D.
	ShutdownDirect3D();

   // Here we unregister the window class with the OS.
   UnregisterClass("UGPClass", windowClass.hInstance);

   return (int)msg.wParam;
}


bool InitializeDirect3D(HWND hwnd, bool fullscreen)
{
   // This object will allow us to set the display mode of the screen.
   D3DDISPLAYMODE DisplayMode;

   // This will allow us to set the parameters of the screen.
   D3DPRESENT_PARAMETERS Present_Parameters;

   // This is used to get the capabilities of the hardware.
   D3DCAPS9 D3DCaps;

   // It is always a good idea to clear out memory in object although not necessary.
   ZeroMemory(&Present_Parameters, sizeof(Present_Parameters));

   // Create the Direct3D object to get everything started.
   Direct3D_Object = Direct3DCreate9(D3D_SDK_VERSION);

   // Error checking.  Make sure that it was successful.
   if(Direct3D_Object == NULL)
      {
         MessageBox(NULL, "Error, couldn't initialize DirectX!?!",
                    "Error!", MB_OK);
         return false;
      }

   // This function will get the display mode of the device and place it in DisplayMode.
   if(FAILED(Direct3D_Object->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &DisplayMode)))
      {
         MessageBox(NULL, "Error setting the display mode.", "Error!", MB_OK);
         return false;
      }

   // Get the capabilities of the hardware.
	if(FAILED(Direct3D_Object->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &D3DCaps)))
		return false;

   // Test which is supported, hardware or software vertex processing.
	DWORD VertexProcessing = 0;

	if(D3DCaps.VertexProcessingCaps != 0)
		VertexProcessing |= D3DCREATE_HARDWARE_VERTEXPROCESSING;
	else
		VertexProcessing |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;

   // Here we are setting the applications parameters...
   if(fullscreen)
      {
         Present_Parameters.Windowed = FALSE;               // Window mode (fullscreen).
         Present_Parameters.BackBufferWidth = DisplayMode.Width;
         Present_Parameters.BackBufferHeight = DisplayMode.Height;
      }
   else
      Present_Parameters.Windowed = TRUE;                   // Window mode (not fullscreen).
   Present_Parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;   // Dealing with animation (see doc).

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲不卡av一区二区三区| 国产精品另类一区| 欧美日韩一区二区不卡| 欧美综合在线视频| 欧美视频自拍偷拍| 日韩一区二区免费高清| 日韩一区二区三区视频在线观看| 8x福利精品第一导航| 日韩精品一区二区三区视频播放 | 亚洲人成网站影音先锋播放| 亚洲欧美区自拍先锋| 亚洲另类一区二区| 美脚の诱脚舐め脚责91| av午夜精品一区二区三区| 欧洲亚洲国产日韩| www成人在线观看| 一区二区三区.www| 日韩专区欧美专区| 久久97超碰色| 从欧美一区二区三区| 国产精品三级视频| 亚洲福利一二三区| 2020国产成人综合网| 99久久精品国产导航| 视频一区二区三区入口| 亚洲精品一区二区三区蜜桃下载 | 欧美日韩中文另类| 免费在线成人网| 国产精品美女久久久久av爽李琼| 亚洲 欧美综合在线网络| 日韩女优视频免费观看| 在线精品视频免费播放| 国精产品一区一区三区mba视频| 成人黄色网址在线观看| 亚洲欧洲一区二区在线播放| 久久91精品国产91久久小草| 亚洲高清在线视频| 国产婷婷色一区二区三区四区 | 欧美人妖巨大在线| 91国产免费观看| 国产农村妇女毛片精品久久麻豆| 亚洲美女偷拍久久| av在线不卡网| 精品久久一区二区三区| 麻豆传媒一区二区三区| 欧美一区二区国产| 日韩电影一区二区三区四区| 99久久精品久久久久久清纯| 精品视频全国免费看| 91网站在线观看视频| 中文字幕一区三区| av午夜一区麻豆| 免费成人美女在线观看.| 26uuu成人网一区二区三区| 91免费看`日韩一区二区| 日韩成人dvd| 亚洲欧美综合另类在线卡通| 欧美性受xxxx| 国产在线精品免费av| 美女国产一区二区三区| 亚洲一区国产视频| 亚洲色图在线播放| 亚洲精品一二三区| 中文字幕一区二区不卡| 日韩欧美123| 久久久精品免费观看| 久久午夜羞羞影院免费观看| 国产亚洲婷婷免费| 国产欧美日韩亚州综合 | 久久久综合网站| 综合网在线视频| 成人动漫视频在线| 国产亚洲精品aa| 午夜不卡av在线| 久久精品国产澳门| 久久99久久精品| 91成人免费电影| 欧美一激情一区二区三区| 亚洲精品在线免费播放| 精品一区二区三区久久| 精品久久久影院| 国产精品久久久久久妇女6080 | 亚洲精品成人在线| 91亚洲国产成人精品一区二区三 | 欧美老女人第四色| 亚洲欧美偷拍另类a∨色屁股| 色综合中文字幕国产| www.66久久| 精品处破学生在线二十三| 中文字幕在线观看一区二区| 亚洲蜜桃精久久久久久久| 国产一区二区精品久久91| 91国内精品野花午夜精品 | 精品国产乱码久久久久久蜜臀| 极品少妇xxxx偷拍精品少妇| 欧美吻胸吃奶大尺度电影| 久久久国产一区二区三区四区小说 | 亚洲国产高清不卡| 欧美aa在线视频| www久久久久| 在线视频你懂得一区二区三区| 欧美日本乱大交xxxxx| 久久www免费人成看片高清| 日韩一区二区三免费高清| 亚洲一区二区三区四区在线免费观看| 国产精品欧美经典| 国产999精品久久久久久绿帽| 国产91色综合久久免费分享| 欧美va亚洲va在线观看蝴蝶网| 国产精品乱人伦中文| 国产成人午夜片在线观看高清观看| 国产成人免费在线视频| 中文字幕一区二区三区四区不卡| 亚洲美女免费在线| 91精品国产品国语在线不卡| 日韩激情一二三区| 久久影院电视剧免费观看| 成人av电影在线| 三级精品在线观看| 国产精品久久久久四虎| 欧美视频一区二区三区四区| 久久成人精品无人区| 日韩理论片一区二区| 欧美tickling挠脚心丨vk| 99久久99久久免费精品蜜臀| 蜜臀久久99精品久久久画质超高清| 99久久久国产精品| 午夜电影网一区| 亚洲欧美日韩国产综合在线| 精品国产1区二区| 欧美三级电影一区| 成人国产在线观看| 精品无人码麻豆乱码1区2区| 亚洲一区二区影院| 国产精品二区一区二区aⅴ污介绍| 日韩成人精品在线观看| 亚洲欧美在线另类| 久久久一区二区三区| 欧美精品自拍偷拍动漫精品| 色综合久久久久久久久久久| 国产乱人伦精品一区二区在线观看| 91精品欧美一区二区三区综合在 | 91免费国产在线| 成人污视频在线观看| 国产一区二区福利| 日本欧美一区二区| 开心九九激情九九欧美日韩精美视频电影| 欧美三级韩国三级日本三斤| 色综合中文字幕国产 | 国产精品视频观看| 欧美tickle裸体挠脚心vk| 91麻豆精品国产91久久久久 | 欧美一级黄色录像| 欧美日韩mp4| 欧美一区二区福利视频| 制服丝袜亚洲色图| 美女视频黄久久| 国产成人综合自拍| av在线播放成人| 欧美男女性生活在线直播观看| 日本成人在线一区| 久久精品国产免费| 国产精品一区二区视频| 成人av网站在线| 色婷婷综合久久久中文一区二区| 日韩精品乱码免费| 看电视剧不卡顿的网站| 国产乱对白刺激视频不卡| 91视频在线看| 91精品国产综合久久蜜臀 | 色偷偷88欧美精品久久久| 欧美午夜精品免费| 亚洲精品一线二线三线无人区| 色噜噜狠狠色综合中国| 日韩一区二区麻豆国产| 国产精品久久久久久一区二区三区| 欧美丰满一区二区免费视频| 日本一区二区三区国色天香| 三级亚洲高清视频| 91麻豆产精品久久久久久| 久久先锋影音av| 亚洲电影在线免费观看| 成人av在线网| 久久影视一区二区| 久久99久国产精品黄毛片色诱| 亚洲国产va精品久久久不卡综合| 国产女人18毛片水真多成人如厕| 欧美一区二区播放| 亚洲小说欧美激情另类| 国产成人av一区二区三区在线| 激情小说亚洲一区| 日韩欧美在线123| 亚洲mv在线观看| 在线成人av网站| 亚洲aⅴ怡春院| 欧美日韩免费电影| 丝袜a∨在线一区二区三区不卡| 丝袜美腿亚洲一区二区图片| 成人午夜在线视频| 久久久久久99精品|