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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================
#include "stdafx.h"
#pragma warning(push, 1)
#pragma warning(disable:4701 4702 4530)
#include <fstream>
#pragma warning(pop)
#include "hammer.h"
#include "lprvwindow.h"
#include "TextureBrowser.h"
#include "CustomMessages.h"
#include "IEditorTexture.h"
#include "GameConfig.h"
#include "GlobalFunctions.h"
#include "TextureSystem.h"
#include "materialsystem/imaterial.h"
#include "materialsystem/imaterialsystem.h"
#include "lpreview_thread.h"
#include "MainFrm.h"
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
BEGIN_MESSAGE_MAP(CLightingPreviewResultsWindow, CWnd)
//{{AFX_MSG_MAP(CTextureWindow)
ON_WM_PAINT()
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//-----------------------------------------------------------------------------
// Purpose: Constructor. Initializes data members.
//-----------------------------------------------------------------------------
CLightingPreviewResultsWindow::CLightingPreviewResultsWindow(void)
{
}
//-----------------------------------------------------------------------------
// Purpose: Destructor.
//-----------------------------------------------------------------------------
CLightingPreviewResultsWindow::~CLightingPreviewResultsWindow(void)
{
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pParentWnd -
// rect -
//-----------------------------------------------------------------------------
void CLightingPreviewResultsWindow::Create(CWnd *pParentWnd )
{
static CString LPreviewWndClassName;
if(LPreviewWndClassName.IsEmpty())
{
// create class
LPreviewWndClassName = AfxRegisterWndClass(
CS_DBLCLKS | CS_HREDRAW |
CS_VREDRAW, LoadCursor(NULL, IDC_ARROW),
(HBRUSH) GetStockObject(BLACK_BRUSH), NULL);
}
RECT rect;
rect.left = 500; rect.right = 600;
rect.top = 500; rect.bottom = 600;
CWnd::CreateEx(0,LPreviewWndClassName, "LightingPreviewWindow",
WS_OVERLAPPEDWINDOW|WS_SIZEBOX,
rect, NULL, NULL,NULL);
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CLightingPreviewResultsWindow::OnClose()
{
GetMainWnd()->GlobalNotify(LPRV_WINDOWCLOSED);
CWnd::OnClose();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CLightingPreviewResultsWindow::OnPaint(void)
{
CPaintDC dc(this); // device context for painting
CRect clientrect;
GetClientRect(clientrect);
if ( g_pLPreviewOutputBitmap)
{
// blit it
BITMAPINFOHEADER mybmh;
mybmh.biHeight=-g_pLPreviewOutputBitmap->Height();
mybmh.biSize=sizeof(BITMAPINFOHEADER);
// now, set up bitmapheader struct for StretchDIB
mybmh.biWidth=g_pLPreviewOutputBitmap->Width();
mybmh.biPlanes=1;
mybmh.biBitCount=32;
mybmh.biCompression=BI_RGB;
mybmh.biSizeImage=g_pLPreviewOutputBitmap->Width()*g_pLPreviewOutputBitmap->Height();
StretchDIBits(
dc.GetSafeHdc(),clientrect.left,clientrect.top,1+(clientrect.right-clientrect.left),
1+(clientrect.bottom-clientrect.top),
0,0,g_pLPreviewOutputBitmap->Width(), g_pLPreviewOutputBitmap->Height(),
g_pLPreviewOutputBitmap->GetBits(), (BITMAPINFO *) &mybmh,
DIB_RGB_COLORS, SRCCOPY);
}
}
|