亚洲欧美第一页_禁久久精品乱码_粉嫩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电影| 欧美伊人久久久久久午夜久久久久| 欧美性三三影院| 一区二区三区在线观看网站| 精品毛片乱码1区2区3区| 国产成人av网站| 国产不卡一区视频| 国产一区视频在线看| 激情五月婷婷综合网| 一区二区欧美在线观看| 日本韩国欧美一区二区三区| 在线播放91灌醉迷j高跟美女| 久久久久久久电影| 国产精品久久久久天堂| 成人久久视频在线观看| 91精品在线观看入口| 91香蕉视频mp4| 色视频成人在线观看免| 91高清视频在线| 欧美国产日本韩| 亚洲男同1069视频| 性做久久久久久久免费看| 亚洲国产综合视频在线观看| 日韩精品91亚洲二区在线观看 | 樱桃视频在线观看一区| 性欧美大战久久久久久久久| 91同城在线观看| 中文字幕在线不卡一区二区三区| 一区二区三区免费| aaa欧美大片| 91麻豆精品国产91久久久久久久久| 亚洲日本在线视频观看| 日韩制服丝袜先锋影音| 欧美日本高清视频在线观看| 欧美精品一区二区久久久| 国产精品不卡一区| av在线这里只有精品| 亚洲欧美影音先锋| 99re亚洲国产精品| 91精品国产乱码久久蜜臀| 久久婷婷成人综合色| 玉足女爽爽91| 欧美喷水一区二区| 美女免费视频一区| 色综合色狠狠综合色| 亚洲欧美另类久久久精品2019| 在线观看日韩电影| 国产日产欧美一区二区三区| 五月婷婷色综合| 99精品国产热久久91蜜凸| 亚洲三级小视频| 国产激情一区二区三区四区| 国产精品久久久久一区二区三区| 韩国欧美国产一区| 石原莉奈在线亚洲二区| 精品成人一区二区三区| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 99re这里都是精品| 亚洲在线一区二区三区| 精品在线视频一区| 欧美日韩另类一区| 奇米亚洲午夜久久精品| 欧美视频完全免费看| 欧美a一区二区| 国产欧美日韩一区二区三区在线观看| 99国产精品99久久久久久| 黄网站免费久久| 五月婷婷激情综合| 日韩欧美一区在线观看| 五月天欧美精品| 久久综合色一综合色88| 97精品久久久久中文字幕 | 在线观看91精品国产麻豆| 日韩亚洲欧美在线观看| 国产传媒日韩欧美成人| 五月天久久比比资源色| 亚洲国产精品黑人久久久| 欧美美女直播网站| 国产成人精品一区二| 欧美激情自拍偷拍| 免费美女久久99| 91精品免费在线| 手机精品视频在线观看| 91色porny| 国产精品久久网站| 不卡视频在线观看| 国产精品久久久久久户外露出 | 国产麻豆成人精品| 欧美色图天堂网| 午夜精彩视频在线观看不卡| 丁香婷婷综合网| 国产精品色在线观看| 欧美电影免费观看完整版| 成人欧美一区二区三区在线播放| 一区二区三区四区五区视频在线观看| 天堂一区二区在线| 国产福利一区二区三区视频在线| 久久综合视频网| 日韩美女啊v在线免费观看| 亚洲激情自拍视频| 懂色av中文一区二区三区 | 国产一区二区视频在线播放| 亚洲成av人片www| 亚洲欧美日韩久久| 亚洲女人的天堂| 国产精品动漫网站| 亚洲国产成人在线| 国产色爱av资源综合区| 亚洲一区二区五区| 精品日韩欧美在线| 国产精品一区二区91| 成人综合激情网| 一区二区三区欧美亚洲| 精品99一区二区| 国产精品一二三四| 中文字幕第一区综合| 在线观看视频一区二区| 免费人成在线不卡| 1区2区3区欧美| 国产婷婷色一区二区三区四区 | 欧美精品久久天天躁| 一级中文字幕一区二区| 亚洲私人影院在线观看| 亚洲图片激情小说| 亚洲人成亚洲人成在线观看图片| 亚洲女同女同女同女同女同69| 一区二区三区四区在线免费观看| 亚洲国产一区二区在线播放| 日韩中文字幕区一区有砖一区| 日本午夜一区二区| 日韩一区二区三区视频在线| 日韩一区二区免费在线观看| 精品久久久久av影院| 久久精品水蜜桃av综合天堂| 中文字幕一区二区三区蜜月| 亚洲欧美成人一区二区三区| 亚洲gay无套男同| 韩国欧美一区二区| 91原创在线视频| 欧美日韩不卡在线| 久久一夜天堂av一区二区三区| 国产精品久久久久久久久久免费看 | 日韩欧美国产综合在线一区二区三区| 精品久久人人做人人爽| 中文一区二区在线观看| 亚洲人成网站影音先锋播放| 天天综合色天天| 国产成人在线观看| 欧美日韩精品一区二区天天拍小说| 中文字幕中文字幕一区二区| 一区二区三区国产豹纹内裤在线| 日本亚洲天堂网| 成人av网址在线| 欧美老肥妇做.爰bbww视频| 久久久久久久久久久久久久久99| 日韩毛片精品高清免费| 青青草伊人久久| 成人高清伦理免费影院在线观看| 欧美日韩免费观看一区二区三区 | 中文字幕一区二区三区精华液 | 亚洲综合男人的天堂| 国产精品一区二区不卡| 在线播放中文一区| 中文字幕巨乱亚洲| 美女诱惑一区二区| 日本道免费精品一区二区三区| 欧美精品一区二区三区四区| 午夜精品久久久久久| 波多野结衣在线一区| 精品欧美一区二区久久| 亚洲一二三区不卡| 懂色av一区二区三区免费观看| 欧美一区二区日韩| 一区二区三区四区在线免费观看| 粉嫩在线一区二区三区视频| 日韩一区二区中文字幕| 亚洲综合色在线| 99re这里只有精品首页| 欧美国产欧美亚州国产日韩mv天天看完整 | 国产精品免费观看视频| 精品一区二区免费看| 欧美精品丝袜久久久中文字幕| 1区2区3区欧美| 懂色av中文一区二区三区| 2020国产精品自拍| 卡一卡二国产精品| 国产麻豆精品一区二区| 7777精品伊人久久久大香线蕉| 亚洲精品成人a在线观看| 不卡一区二区在线| 国产女人18水真多18精品一级做| 久久成人av少妇免费| 日韩欧美的一区| 蜜桃av一区二区三区电影| 欧美日本韩国一区二区三区视频 | 亚洲精选在线视频| 成人app网站| 亚洲国产精品精华液ab| 国产成人8x视频一区二区|