Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
ww3d.cpp
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/***********************************************************************************************
20 *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
21 ***********************************************************************************************
22 * *
23 * Project Name : WW3D *
24 * *
25 * $Archive:: /Commando/Code/ww3d2/ww3d.cpp $*
26 * *
27 * Org Author:: Greg_h *
28 * *
29 * Author : Kenny Mitchell *
30 * *
31 * $Modtime:: 08/05/02 10:03a $*
32 * *
33 * $Revision:: 98 $*
34 * *
35 * 07/01/02 KM Scalable shader library integration *
36 * 08/05/02 KM Texture class redesign
37 *---------------------------------------------------------------------------------------------*
38 * Functions: *
39 * WW3D::Init -- Initialize the WW3D Library *
40 * WW3D::Shutdown -- shutdown the WW3D Library *
41 * WW3D::Set_Render_Device -- set the render device being currently used *
42 * WW3D::Set_Next_Render_Device -- just go to the next device in the list *
43 * WW3D::Set_Device_Resolution -- set the current resolution and bitdepth *
44 * WW3D::Get_Render_Device -- Get the index of the current render device *
45 * WW3D::Get_Render_Device_Desc -- returns description of the current render device *
46 * WW3D::Get_Render_Device_Count -- returns the number of render devices available *
47 * WW3D::Get_Render_Device_Name -- returns the name of the n-th render device *
48 * WW3D::Get_Render_Target_Resolution -- get the resolution and bitdepth of the current target*
49 * WW3D::Get_Device_Resolution -- get the current resolution and bitdepth *
50 * WW3D::Begin_Render -- mark the start of rendering for a new frame *
51 * WW3D::Render -- Render a 3D Scene using the given camera *
52 * WW3D::Render -- Render a single render object *
53 * WW3D::End_Render -- Mark the completion of a frame *
54 * WW3D::Sync -- Time sychronization *
55 * WW3D::Set_Ext_Swap_Interval -- Sets the swap interval the device should aim sync for. *
56 * WW3D::Get_Ext_Swap_Interval -- Queries the swap interval the device is aiming sync for. *
57 * WW3D::Get_Polygon_Mode -- returns the current rendering mode *
58 * WW3D::Set_Collision_Box_Display_Mask -- control rendering of collision boxes *
59 * WW3D::Get_Collision_Box_Display_Mask -- returns the current display mask for collision bo *
60 * WW3D::Normalize_Coordinates -- Convert pixel coords to normalized screen coords 0..1 *
61 * WW3D::Update_Render_Device_Description -- updates the description of the current render d *
62 * WW3D::Make_Screen_Shot -- saves a screenshot with the given base filename *
63 * WW3D::Start_Movie_Capture -- begins dumping frames to a movie *
64 * WW3D::Stop_Movie_Capture -- ends dumping frames to a movie *
65 * WW3D::Toggle_Movie_Capture -- toggles movie capture... *
66 * WW3D::Start_Single_Frame_Movie_Capture -- starts capturing a single frame movie *
67 * WW3D::Capture_Next_Movie_Frame -- tells ww3d to grab another frame for the movie *
68 * WW3D::Pause_Movie -- pauses/unpauses movie capturing *
69 * WW3D::Is_Movie_Paused -- returns whether the movie capture system is paused *
70 * WW3D::Is_Recording_Next_Frame -- returns whether the next frame will be dumped to a movie *
71 * WW3D::Is_Movie_Ready -- returns whether the movie capture system is ready *
72 * WW3D::Update_Movie_Capture -- dumps the current frame into the movie *
73 * WW3D::Get_Movie_Capture_Frame_Rate -- returns the framerate at which the movie is being c *
74 * WW3D::Set_Texture_Reduction -- sets the (hacky) texture reduction factor *
75 * WW3D::Get_Texture_Reduction -- gets the (hacky) texture reduction factor *
76 * WW3D::Flush_Texture_Cache -- dump all textures from the texture cache *
77 * WW3D::Allocate_Debug_Resources -- allocates the debug resources *
78 * WW3D::Release_Debug_Resources -- releases the debug resources *
79 * WW3D::Get_Last_Frame_Poly_Count -- returns the number of polys submitted in the previous *
80 * WW3D::Flush -- Process all pending rendering tasks *
81 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
82
83
84#include "ww3d.h"
85#include "rinfo.h"
86#include "assetmgr.h"
87#include "boxrobj.h"
88#include "predlod.h"
89#include "camera.h"
90#include "scene.h"
91#include "texfcach.h"
92#include "registry.h"
93#include "segline.h"
94#include "shader.h"
95#include "vertmaterial.h"
96#include "wwdebug.h"
97#include "wwprofile.h"
98#include "wwmemlog.h"
99#include "shattersystem.h"
100#include "textureloader.h"
101#include "statistics.h"
102#include "pointgr.h"
103#include "ffactory.h"
104#include "ini.h"
105#include "dazzle.h"
106#include "meshmdl.h"
107#include "dx8renderer.h"
108#include "render2d.h"
109#include "bound.h"
110#include "rddesc.h"
111#include "vector3i.h"
112#include <cstdio>
113#include "dx8wrapper.h"
114#include "targa.h"
115#include "sortingrenderer.h"
116#include "thread.h"
117#include "cpudetect.h"
118#include "dx8texman.h"
119#include "formconv.h"
120#include "animatedsoundmgr.h"
121#include "static_sort_list.h"
122
123#include "shdlib.h"
124
125#ifndef _UNIX
126#include "framgrab.h"
127#endif
128
129
130const char* DAZZLE_INI_FILENAME="DAZZLE.INI";
131
132#define DEFAULT_DEBUG_SHADER_BITS ( SHADE_CNST(\
133 ShaderClass::PASS_LEQUAL,\
134 ShaderClass::DEPTH_WRITE_ENABLE,\
135 ShaderClass::COLOR_WRITE_ENABLE,\
136 ShaderClass::SRCBLEND_ONE,\
137 ShaderClass::DSTBLEND_ZERO,\
138 ShaderClass::FOG_DISABLE,\
139 ShaderClass::GRADIENT_MODULATE,\
140 ShaderClass::SECONDARY_GRADIENT_DISABLE,\
141 ShaderClass::TEXTURING_DISABLE,\
142 ShaderClass::ALPHATEST_DISABLE,\
143 ShaderClass::CULL_MODE_ENABLE, \
144 ShaderClass::DETAILCOLOR_DISABLE,\
145 ShaderClass::DETAILALPHA_DISABLE) )
146
147#define LIGHTMAP_DEBUG_SHADER_BITS ( SHADE_CNST(\
148 ShaderClass::PASS_LEQUAL,\
149 ShaderClass::DEPTH_WRITE_ENABLE,\
150 ShaderClass::COLOR_WRITE_ENABLE,\
151 ShaderClass::SRCBLEND_ONE,\
152 ShaderClass::DSTBLEND_ZERO,\
153 ShaderClass::FOG_DISABLE,\
154 ShaderClass::GRADIENT_DISABLE,\
155 ShaderClass::SECONDARY_GRADIENT_DISABLE,\
156 ShaderClass::TEXTURING_ENABLE,\
157 ShaderClass::ALPHATEST_DISABLE,\
158 ShaderClass::CULL_MODE_ENABLE, \
159 ShaderClass::DETAILCOLOR_DISABLE,\
160 ShaderClass::DETAILALPHA_DISABLE) )
161
162
163
164/**********************************************************************************
165**
166** WW3D Static Globals
167**
168***********************************************************************************/
169
170unsigned int WW3D::SyncTime = 0;
171unsigned int WW3D::PreviousSyncTime = 0;
172bool WW3D::IsSortingEnabled = true;
173
174float WW3D::PixelCenterX = 0.0f;
175float WW3D::PixelCenterY = 0.0f;
176
177
178bool WW3D::IsInitted = false;
179bool WW3D::IsRendering = false;
180bool WW3D::IsCapturing = false;
181bool WW3D::IsScreenUVBiased = false;
182
183bool WW3D::AreDecalsEnabled = true;
184float WW3D::DecalRejectionDistance = 1000000.0f;
185
186bool WW3D::AreStaticSortListsEnabled = false;
187bool WW3D::MungeSortOnLoad = false;
188
189bool WW3D::OverbrightModifyOnLoad = false;
190
191FrameGrabClass * WW3D::Movie = NULL;
192bool WW3D::PauseRecord;
193bool WW3D::RecordNextFrame;
194
195int WW3D::FrameCount = 0;
196long WW3D::UserStat0 = 0;
197long WW3D::UserStat1 = 0;
198long WW3D::UserStat2 = 0;
199
200float WW3D::DefaultNativeScreenSize = 1.0f;
201
202StaticSortListClass * WW3D::DefaultStaticSortLists = NULL;
203StaticSortListClass * WW3D::CurrentStaticSortLists = NULL;
204
205
206VertexMaterialClass * WW3D::DefaultDebugMaterial = NULL;
207ShaderClass WW3D::DefaultDebugShader(DEFAULT_DEBUG_SHADER_BITS);
208ShaderClass WW3D::LightmapDebugShader(LIGHTMAP_DEBUG_SHADER_BITS);
209
210WW3D::PrelitModeEnum WW3D::PrelitMode = PRELIT_MODE_LIGHTMAP_MULTI_PASS;
211bool WW3D::ExposePrelit = false;
212
213bool WW3D::SnapshotActivated=false;
214bool WW3D::ThumbnailEnabled=true;
215
216WW3D::MeshDrawModeEnum WW3D::MeshDrawMode = MESH_DRAW_MODE_OLD;
217WW3D::NPatchesGapFillingModeEnum WW3D::NPatchesGapFillingMode = NPATCHES_GAP_FILLING_ENABLED;
218unsigned WW3D::NPatchesLevel=1;
219bool WW3D::IsTexturingEnabled=true;
220bool WW3D::IsColoringEnabled=false;
221
222static HWND _Hwnd = NULL; // Not a member to hide windows from WW3D users
223static int _TextureReduction = 0;
224static int _TextureMinDim = 1;
225static bool _LargeTextureExtraReductionEnabled = false;
226int WW3D::LastFrameMemoryAllocations;
227int WW3D::LastFrameMemoryFrees;
228
229int WW3D::TextureFilter = 0;
230
231bool WW3D::Lite = false;
232
233/**********************************************************************************
234**
235** WW3D Static Functions
236**
237***********************************************************************************/
238
240{
241 if (NPatchesGapFillingMode!=mode) {
242 NPatchesGapFillingMode=mode;
243 TheDX8MeshRenderer.Invalidate();
244 }
245}
246
247void WW3D::Set_NPatches_Level(unsigned level)
248{
249 if (level>8) level=8;
250 if (level<1) level=1;
251 if (NPatchesLevel==1 && level>1) TheDX8MeshRenderer.Invalidate();
252 if (NPatchesLevel>1 && level==1) TheDX8MeshRenderer.Invalidate();
253 NPatchesLevel = level;
254}
255
256/***********************************************************************************************
257 * WW3D::Init -- Initialize the WW3D Library *
258 * *
259 * INPUT: *
260 * *
261 * OUTPUT: *
262 * *
263 * WARNINGS: *
264 * *
265 * HISTORY: *
266 * 3/24/98 GTH : Created. *
267 *=============================================================================================*/
268WW3DErrorType WW3D::Init(void *hwnd, char *defaultpal, bool lite)
269{
270 assert(IsInitted == false);
271 WWDEBUG_SAY(("WW3D::Init hwnd = %p\n",hwnd));
272 _Hwnd = (HWND)hwnd;
273 Lite = lite;
274
275 /*
276 ** Initialize d3d, this also enumerates the available devices and resolutions.
277 */
279 WWDEBUG_SAY(("Init DX8Wrapper\n"));
280 if (!DX8Wrapper::Init(_Hwnd, lite)) {
282 }
283 WWDEBUG_SAY(("Allocate Debug Resources\n"));
284 Allocate_Debug_Resources();
285
286 MMRESULT r=timeBeginPeriod(1);
287 WWASSERT(r==TIMERR_NOERROR);
288
289 /*
290 ** Initialize the dazzle system
291 */
292 if (!lite) {
293 WWDEBUG_SAY(("Init Dazzles\n"));
294 FileClass * dazzle_ini_file = _TheFileFactory->Get_File(DAZZLE_INI_FILENAME);
295 if (dazzle_ini_file) {
296 INIClass dazzle_ini(*dazzle_ini_file);
298 _TheFileFactory->Return_File(dazzle_ini_file);
299 }
300 }
301 /*
302 ** Initialize the default static sort lists
303 ** Note that DefaultStaticSortLists[0] is unused.
304 */
305 DefaultStaticSortLists = W3DNEW DefaultStaticSortListClass();
307
308 /*
309 ** Initialize the animation-triggered sound system
310 */
311 if (!lite) {
313 IsInitted = true;
314 }
315 WWDEBUG_SAY(("WW3D Init completed\n"));
316 return WW3D_ERROR_OK;
317}
318
319
320/***********************************************************************************************
321 * WW3D::Shutdown -- shutdown the WW3D Library *
322 * *
323 * INPUT: *
324 * *
325 * OUTPUT: *
326 * *
327 * WARNINGS: *
328 * *
329 * HISTORY: *
330 * 3/24/98 GTH : Created. *
331 *=============================================================================================*/
333{
334 assert(Lite || IsInitted == true);
335// WWDEBUG_SAY(("WW3D::Shutdown\n"));
336
337#ifdef WW3D_DX8
338 if (IsCapturing) {
340 }
341#endif //WW3D_DX8
342
343 //restore the previous timer resolution
344 MMRESULT r=timeEndPeriod(1);
345 WWASSERT(r==TIMERR_NOERROR);
346 /*
347 ** Free memory in predictive LOD optimizer
348 */
350
351 /*
352 ** Free the DazzleRenderObject class stuff. Whatever it is. ST - 6/11/2001 8:20PM
353 */
354 if (!Lite) {
356 }
357
358 /*
359 ** Release all of our assets
360 */
361 Release_Debug_Resources();
364 }
365
367 if (!Lite) {
369 }
370
371 /*
372 ** Clear the default static sort lists
373 */
374 delete DefaultStaticSortLists;
375
376 /*
377 ** Release the animation-triggered sound data
378 */
380
381 IsInitted = false;
382 return WW3D_ERROR_OK;
383}
384
385
386/***********************************************************************************************
387 * WW3D::Set_Render_Device -- set the render device being currently used *
388 * *
389 * INPUT: *
390 * *
391 * OUTPUT: *
392 * *
393 * WARNINGS: *
394 * *
395 * HISTORY: *
396 * 3/24/98 GTH : Created. *
397 *=============================================================================================*/
398WW3DErrorType WW3D::Set_Render_Device( const char * dev_name, int width, int height, int bits, int windowed, bool resize_window )
399{
400 bool success = DX8Wrapper::Set_Render_Device(dev_name,width,height,bits,windowed,resize_window);
401 if (success) {
402 return WW3D_ERROR_OK;
403 } else {
405 }
406}
407
408
409/***********************************************************************************************
410 * WW3D::Set_Any_Render_Device -- set any render device you can find *
411 * *
412 * INPUT: *
413 * *
414 * OUTPUT: *
415 * *
416 * WARNINGS: *
417 * *
418 * HISTORY: *
419 * 3/24/98 GTH : Created. *
420 *=============================================================================================*/
422{
423 bool success = DX8Wrapper::Set_Any_Render_Device();
424 if (success) {
425 return WW3D_ERROR_OK;
426 } else {
428 }
429}
430
431
432/***********************************************************************************************
433 * WW3D::Set_Render_Device -- set the render device being currently used *
434 * *
435 * INPUT: *
436 * *
437 * OUTPUT: *
438 * *
439 * WARNINGS: *
440 * *
441 * HISTORY: *
442 * 3/24/98 GTH : Created. *
443 *=============================================================================================*/
444WW3DErrorType WW3D::Set_Render_Device(int dev, int width, int height, int bits, int windowed, bool resize_window, bool reset_device, bool restore_assets )
445{
446 bool success = DX8Wrapper::Set_Render_Device(dev,width,height,bits,windowed,resize_window,reset_device, restore_assets );
447 if (success) {
448 return WW3D_ERROR_OK;
449 } else {
451 }
452}
453
454
455/***********************************************************************************************
456 * WW3D::Set_Next_Render_Device -- just go to the next device in the list *
457 * *
458 * INPUT: *
459 * *
460 * OUTPUT: *
461 * *
462 * WARNINGS: *
463 * *
464 * HISTORY: *
465 * 3/26/98 GTH : Created. *
466 *=============================================================================================*/
468{
469 bool success = DX8Wrapper::Set_Next_Render_Device();
470 if (success) {
471 return WW3D_ERROR_OK;
472 } else {
474 }
475}
476
477/***********************************************************************************************
478 * WW3D::Get_Window -- returns the handle of the render window. *
479 * *
480 * INPUT: *
481 * *
482 * OUTPUT: *
483 * *
484 * WARNINGS: *
485 * *
486 * HISTORY: *
487 * 3/28/2001 pds : Created. *
488 *=============================================================================================*/
489void *WW3D::Get_Window( void )
490{
491 return _Hwnd;
492}
493
494/***********************************************************************************************
495 * WW3D::Is_Windowed -- returns wether we are currently in a windowed mode *
496 * *
497 * INPUT: *
498 * *
499 * OUTPUT: *
500 * *
501 * WARNINGS: *
502 * *
503 * HISTORY: *
504 * 1/26/2001 gth : Created. *
505 *=============================================================================================*/
507{
509}
510
511/***********************************************************************************************
512 * WW3D::Toggle_Windowed -- Toggle the current render device between fullscreen and windowed *
513 * mode. Note: Its called '_Windowed' to be consistent with the *
514 * other references inside WW3D, a more descriptive name would *
515 * be Toggle_Fullscreen. *
516 * *
517 * INPUT: *
518 * *
519 * OUTPUT: *
520 * *
521 * WARNINGS: *
522 * *
523 * HISTORY: *
524 * 1/11/99 PDS : Created. *
525 *=============================================================================================*/
527{
528 bool success = DX8Wrapper::Toggle_Windowed();
529 if (success) {
530 return WW3D_ERROR_OK;
531 } else {
533 }
534}
535
536
537/***********************************************************************************************
538 * WW3D::Get_Render_Device -- Get the index of the current render device *
539 * *
540 * INPUT: *
541 * *
542 * OUTPUT: *
543 * *
544 * WARNINGS: *
545 * *
546 * HISTORY: *
547 * 3/24/98 GTH : Created. *
548 * 1/25/2001 gth : converted to dx8 *
549 *=============================================================================================*/
554
555
556/***********************************************************************************************
557 * WW3D::Get_Render_Device_Desc -- returns description of the current render device *
558 * *
559 * INPUT: *
560 * *
561 * OUTPUT: *
562 * *
563 * WARNINGS: *
564 * *
565 * HISTORY: *
566 * 3/26/98 GTH : Created. *
567 * 1/25/2001 gth : converted to dx8 *
568 *=============================================================================================*/
570{
571 return DX8Wrapper::Get_Render_Device_Desc(deviceidx);
572}
573
574
575
576/***********************************************************************************************
577 * WW3D::Get_Render_Device_Count -- returns the number of render devices available *
578 * *
579 * INPUT: *
580 * *
581 * OUTPUT: *
582 * *
583 * WARNINGS: *
584 * *
585 * HISTORY: *
586 * 5/19/99 GTH : Created. *
587 * 1/25/2001 gth : converted to DX8 *
588 *=============================================================================================*/
593
594
595/***********************************************************************************************
596 * WW3D::Get_Render_Device_Name -- returns the name of the n-th render device *
597 * *
598 * INPUT: *
599 * *
600 * OUTPUT: *
601 * *
602 * WARNINGS: *
603 * *
604 * HISTORY: *
605 * 5/19/99 GTH : Created. *
606 * 1/25/2001 gth : converted to dx8 *
607 *=============================================================================================*/
608const char * WW3D::Get_Render_Device_Name(int device_index)
609{
610 return DX8Wrapper::Get_Render_Device_Name(device_index);
611}
612
613
614/***********************************************************************************************
615 * WW3D::Set_Device_Resolution -- set the current resolution and bitdepth *
616 * *
617 * INPUT: *
618 * *
619 * OUTPUT: *
620 * *
621 * WARNINGS: *
622 * *
623 * HISTORY: *
624 * 3/24/98 GTH : Created. *
625 *=============================================================================================*/
626WW3DErrorType WW3D::Set_Device_Resolution(int width,int height,int bits,int windowed, bool resize_window)
627{
628 bool success = DX8Wrapper::Set_Device_Resolution(width,height,bits,windowed,resize_window);
629
630 if (success) {
631 return WW3D_ERROR_OK;
632 } else {
634 }
635}
636
637
638/***********************************************************************************************
639 * WW3D::Get_Render_Target_Resolution -- get the resolution and bitdepth of the current target *
640 * *
641 * INPUT: *
642 * *
643 * OUTPUT: *
644 * *
645 * WARNINGS: *
646 * *
647 * HISTORY: *
648 * 3/24/98 GTH : Created. *
649 * 1/25/2001 gth : converted to dx8 *
650 *=============================================================================================*/
651void WW3D::Get_Render_Target_Resolution(int & set_w,int & set_h,int & set_bits,bool & set_windowed)
652{
653 DX8Wrapper::Get_Render_Target_Resolution(set_w,set_h,set_bits,set_windowed);
654}
655
656
657/***********************************************************************************************
658 * WW3D::Get_Device_Resolution -- get the current resolution and bitdepth *
659 * *
660 * INPUT: *
661 * *
662 * OUTPUT: *
663 * *
664 * WARNINGS: *
665 * *
666 * HISTORY: *
667 * 3/24/98 GTH : Created. *
668 * 1/25/2001 gth : converted to dx8 *
669 *=============================================================================================*/
670void WW3D::Get_Device_Resolution(int & set_w,int & set_h,int & set_bits,bool & set_windowed)
671{
672 DX8Wrapper::Get_Device_Resolution(set_w,set_h,set_bits,set_windowed);
673}
674
675
676/***********************************************************************************************
677 * WW3D::Registry_Save_Render_Device -- Saves settings to Registry
678 * *
679 * INPUT: *
680 * *
681 * OUTPUT: *
682 * *
683 * WARNINGS: *
684 * *
685 * HISTORY: *
686 * 12/3/98 BMG : Created. *
687 * 1/25/2001 gth : converted to dx8 *
688 *=============================================================================================*/
690{
691 bool success = DX8Wrapper::Registry_Save_Render_Device(sub_key);
692 if (success) {
693 return WW3D_ERROR_OK;
694 } else {
696 }
697}
698
699/***********************************************************************************************
700 * WW3D::Registry_Save_Render_Device -- Saves settings to Registry
701 * *
702 * INPUT: *
703 * *
704 * OUTPUT: *
705 * *
706 * WARNINGS: *
707 * *
708 * HISTORY: *
709 * 12/3/98 BMG : Created. *
710 *=============================================================================================*/
711WW3DErrorType WW3D::Registry_Save_Render_Device( const char *sub_key, int device, int width, int height, int depth, bool windowed, int texture_depth )
712{
713 bool success = DX8Wrapper::Registry_Save_Render_Device(sub_key,device,width,height,depth,windowed,texture_depth);
714 if (success) {
715 return WW3D_ERROR_OK;
716 } else {
718 }
719}
720
721
722/***********************************************************************************************
723 * WW3D::Registry_Load_Render_Device -- Loads settings from Registry
724 * *
725 * INPUT: *
726 * *
727 * OUTPUT: *
728 * *
729 * WARNINGS: *
730 * *
731 * HISTORY: *
732 * 12/3/98 BMG : Created. *
733 *=============================================================================================*/
734WW3DErrorType WW3D::Registry_Load_Render_Device( const char * sub_key, bool resize_window )
735{
736 bool success = DX8Wrapper::Registry_Load_Render_Device(sub_key,resize_window);
737 if (success) {
738 return WW3D_ERROR_OK;
739 } else {
741 }
742}
743
744bool WW3D::Registry_Load_Render_Device( const char * sub_key, char *device, int device_len, int &width, int &height, int &depth, int &windowed, int &texture_depth)
745{
746 return DX8Wrapper::Registry_Load_Render_Device(sub_key,device,device_len,width,height,depth,windowed,texture_depth);
747}
748
750{
751 TheDX8MeshRenderer.Invalidate();
752}
753
755{
756 if (!WW3DAssetManager::Get_Instance()) return;
757
759
761
762 // Loop through all the textures in the manager
763 for (ite.First();!ite.Is_Done();ite.Next()) {
764 // Get the current texture
765 TextureClass* tex=ite.Peek_Value();
766 tex->Invalidate();
767 }
768}
769
770void WW3D::Set_Texture_Filter(int texture_filter)
771{
772 if (texture_filter<0) texture_filter=0;
774 TextureFilter=texture_filter;
776}
777
778
779/***********************************************************************************************
780 * WW3D::Begin_Render -- mark the start of rendering for a new frame *
781 * *
782 * INPUT: *
783 * *
784 * OUTPUT: *
785 * *
786 * WARNINGS: *
787 * *
788 * HISTORY: *
789 * 3/24/98 GTH : Created. *
790 *=============================================================================================*/
791WW3DErrorType WW3D::Begin_Render(bool clear,bool clearz,const Vector3 & color, float dest_alpha, void(*network_callback)(void))
792{
793 if (!IsInitted) {
794 return(WW3D_ERROR_OK);
795 }
796
797 WWPROFILE("WW3D::Begin_Render");
798 WWASSERT(IsInitted);
799 HRESULT hr;
800
801 SNAPSHOT_SAY(("==========================================\r\n"));
802 SNAPSHOT_SAY(("========== WW3D::Begin_Render ============\r\n"));
803 SNAPSHOT_SAY(("==========================================\r\n\r\n"));
804
805 if (DX8Wrapper::_Get_D3D_Device8() && (hr=DX8Wrapper::_Get_D3D_Device8()->TestCooperativeLevel()) != D3D_OK)
806 {
807 // If the device was lost, do not render until we get it back
808 if( D3DERR_DEVICELOST == hr )
809 return WW3D_ERROR_GENERIC; //other app has the device
810
811 // Check if the device needs to be reset
812 if( D3DERR_DEVICENOTRESET == hr )
813 {
815 }
816
817 return WW3D_ERROR_GENERIC;
818 }
819
820 // Memory allocation statistics
821 LastFrameMemoryAllocations=WWMemoryLogClass::Get_Allocate_Count();
822 LastFrameMemoryFrees=WWMemoryLogClass::Get_Free_Count();
824
825 TextureLoader::Update(network_callback);
826// TextureClass::_Reset_Time_Stamp();
829#ifdef WW3D_DX8
830 TextureFileClass::Update_Texture_Flash();
831#endif //WW3D_DX8
833
834 if (IsCapturing && (!PauseRecord || RecordNextFrame)) {
836 RecordNextFrame = false;
837 }
838
839 WWASSERT(!IsRendering);
840 IsRendering = true;
841
842 // If we want to clear the screen, we need to set the viewport to include the entire screen:
843 if (clear || clearz) {
844 D3DVIEWPORT8 vp;
845 int width, height, bits;
846 bool windowed;
847 WW3D::Get_Render_Target_Resolution(width, height, bits, windowed);
848 vp.X = 0;
849 vp.Y = 0;
850 vp.Width = width;
851 vp.Height = height;
852 vp.MinZ = 0.0f;;
853 vp.MaxZ = 1.0f;
855 DX8Wrapper::Clear(clear, clearz, color, dest_alpha);
856 }
857
858 // Notify D3D that we are beginning to render the frame
860
861 return WW3D_ERROR_OK;
862}
863
864/***********************************************************************************************
865 * WW3D::Render -- Render a list of layers, starting at the back. *
866 * *
867 * INPUT: *
868 * *
869 * OUTPUT: *
870 * *
871 * WARNINGS: *
872 * *
873 * HISTORY: *
874 * 4/2/98 EHC : Created. *
875 *=============================================================================================*/
877{
878 if (!IsInitted) {
879 return(WW3D_ERROR_OK);
880 }
881
882 WWASSERT(IsRendering);
883
884 LayerClass *layer = LayerList.Last();
885
886 while (layer->Is_Valid()) {
887 WW3DErrorType result = Render(*layer);
888
889 if (result != WW3D_ERROR_OK) {
890 return result;
891 }
892
893 layer = layer->Prev();
894 }
895
896 return WW3D_ERROR_OK;
897}
898
899/***********************************************************************************************
900 * WW3D::Render -- Render a Layer *
901 * *
902 * INPUT: *
903 * *
904 * OUTPUT: *
905 * *
906 * WARNINGS: *
907 * *
908 * HISTORY: *
909 * 4/2/98 EHC : Created. *
910 *=============================================================================================*/
912{
913 if (!IsInitted) {
914 return(WW3D_ERROR_OK);
915 }
916
917 WWASSERT(IsRendering);
918 return Render(Layer.Scene, Layer.Camera, Layer.Clear, Layer.ClearZ, Layer.ClearColor);
919
920}
921
922
923/***********************************************************************************************
924 * WW3D::Render -- Render a 3D Scene using the given camera *
925 * *
926 * INPUT: *
927 * *
928 * OUTPUT: *
929 * *
930 * WARNINGS: *
931 * *
932 * HISTORY: *
933 * 3/24/98 GTH : Created. *
934 *=============================================================================================*/
935WW3DErrorType WW3D::Render(SceneClass * scene,CameraClass * cam,bool clear,bool clearz,const Vector3 & color)
936{
937 if (!IsInitted) {
938 return(WW3D_ERROR_OK);
939 }
940
941 WWPROFILE("WW3D::Render");
943 WWASSERT(IsInitted);
944 WWASSERT(IsRendering);
945 WWASSERT(scene);
946 WWASSERT(cam);
947
948 cam->On_Frame_Update();
949 RenderInfoClass rinfo(*cam);
950
951 // Apply the camera and viewport (including depth range)
952 cam->Apply();
953
954 // Clear the viewport
955 if (clear || clearz) {
956 DX8Wrapper::Clear(clear, clearz, color);
957 }
958
959 // set the rendering mode
960 switch(scene->Get_Polygon_Mode()) {
962 DX8Wrapper::Set_DX8_Render_State(D3DRS_FILLMODE,D3DFILL_POINT);
963 break;
964 case SceneClass::LINE:
965 DX8Wrapper::Set_DX8_Render_State(D3DRS_FILLMODE,D3DFILL_WIREFRAME);
966 break;
967 case SceneClass::FILL:
968 DX8Wrapper::Set_DX8_Render_State(D3DRS_FILLMODE,D3DFILL_SOLID);
969 break;
970 }
971
972 // Set the global ambient light value here. If the scene is using the LightEnvironment system
973 // this setting will get overriden.
975
976 // render the scene
977
978 TheDX8MeshRenderer.Set_Camera(&rinfo.Camera);
979
980 scene->Render(rinfo);
981
982 Flush(rinfo);
983
984 return WW3D_ERROR_OK;
985}
986
987
988/***********************************************************************************************
989 * WW3D::Render -- Render a single render object *
990 * *
991 * INPUT: *
992 * *
993 * OUTPUT: *
994 * *
995 * WARNINGS: *
996 * *
997 * HISTORY: *
998 * 4/4/2001 gth : Created. *
999 *=============================================================================================*/
1001 RenderObjClass & obj,
1002 RenderInfoClass & rinfo
1003)
1004{
1005 if (!IsInitted) {
1006 return(WW3D_ERROR_OK);
1007 }
1008
1009 WWPROFILE("WW3D::Render");
1010 WWASSERT(IsInitted);
1011 WWASSERT(IsRendering);
1012
1013 {
1014 WWPROFILE("On_Frame_Update");
1015 rinfo.Camera.On_Frame_Update();
1016 }
1017
1018 // Apply the camera and viewport (including depth range)
1019 rinfo.Camera.Apply();
1020
1021 // set the rendering mode
1022 DX8Wrapper::Set_DX8_Render_State(D3DRS_FILLMODE,D3DFILL_SOLID);
1023
1024 // Install the lighting environment if one is supplied
1025 if (rinfo.light_environment != NULL) {
1027 }
1028
1029 // Render the object
1030 TheDX8MeshRenderer.Set_Camera(&rinfo.Camera);
1031
1032 obj.Render(rinfo);
1033
1034 Flush(rinfo);
1035
1036 return WW3D_ERROR_OK;
1037}
1038
1039
1040/***********************************************************************************************
1041 * WW3D::Flush -- Process all pending rendering tasks *
1042 * *
1043 * NOTE: This normally happens AUTOMATICALLY. The user should almost *NEVER* have to call *
1044 * this function. Anyway, this function causes all of the deferred rendering systems to *
1045 * actually perform all of their rendering tasks. This includes the DX8MeshRenderer and *
1046 * the sorting system. *
1047 * *
1048 * INPUT: *
1049 * *
1050 * OUTPUT: *
1051 * *
1052 * WARNINGS: *
1053 * Don't call this unless you know what you're doing *
1054 * *
1055 * HISTORY: *
1056 * 4/17/2001 gth : Created. *
1057 * 07/01/02 KM Scalable shader library integration *
1058 *=============================================================================================*/
1060{
1061 TheDX8MeshRenderer.Flush();
1062 SHD_FLUSH;
1063 WW3D::Render_And_Clear_Static_Sort_Lists(rinfo); //draws things like water
1064
1066 TheDX8MeshRenderer.Clear_Pending_Delete_Lists();
1067}
1068
1069
1070/***********************************************************************************************
1071 * WW3D::End_Render -- Mark the completion of a frame *
1072 * *
1073 * INPUT: *
1074 * *
1075 * OUTPUT: *
1076 * *
1077 * WARNINGS: *
1078 * *
1079 * HISTORY: *
1080 * 3/24/98 GTH : Created. *
1081 *=============================================================================================*/
1083{
1084 if (!IsInitted) {
1085 return(WW3D_ERROR_OK);
1086 }
1087
1088 WWPROFILE("WW3D::End_Render");
1089
1090 WWASSERT(IsRendering);
1091 WWASSERT(IsInitted);
1092
1093 // If sorting renderer flush isn't called from within any of the render functions
1094 // the sorting arrays will overflow!
1095
1097
1098 IsRendering = false;
1099
1100 {
1101 WWPROFILE("DX8Wrapper::End_Scene");
1102 DX8Wrapper::End_Scene(flip_frame);
1103 }
1104
1105 FrameCount++;
1106
1107 {
1108 WWPROFILE("End_Statistics");
1110 }
1111
1112 SNAPSHOT_SAY(("==========================================\r\n"));
1113 SNAPSHOT_SAY(("========== WW3D::End_Render ==============\r\n"));
1114 SNAPSHOT_SAY(("==========================================\r\n\r\n"));
1115
1116 Activate_Snapshot(false);
1117
1118 // (gth) I've found some cases where its not safe to rely on our "shadow" copy (of
1119 // matrices for example) across multiple frames. So even though this is slightly
1120 // less "optimal", lets just reset the caches each frame.
1122
1123 return WW3D_ERROR_OK;
1124}
1125
1126
1127/***********************************************************************************************
1128 * WW3D::Flip_To_Primary *
1129 * *
1130 * INPUT: *
1131 * *
1132 * OUTPUT: *
1133 * *
1134 * WARNINGS: *
1135 * *
1136 * HISTORY: *
1137 * 6/20/01 DEL : Created. *
1138 *=============================================================================================*/
1143
1144
1145/***********************************************************************************************
1146 * WW3D::Get_Last_Frame_Poly_Count -- returns the number of polys submitted in the previous fr *
1147 * *
1148 * INPUT: *
1149 * *
1150 * OUTPUT: *
1151 * *
1152 * WARNINGS: *
1153 * *
1154 * HISTORY: *
1155 * 7/28/99 GTH : Created. *
1156 *=============================================================================================*/
1158{
1160}
1161
1163{
1165}
1166
1167
1168/***********************************************************************************************
1169 * WW3D::Sync -- Time sychronization *
1170 * *
1171 * INPUT: *
1172 * *
1173 * OUTPUT: *
1174 * *
1175 * WARNINGS: *
1176 * *
1177 * HISTORY: *
1178 * 3/24/98 GTH : Created. *
1179 *=============================================================================================*/
1180void WW3D::Sync(unsigned int sync_time)
1181{
1182 PreviousSyncTime = SyncTime;
1183 SyncTime = sync_time;
1184}
1185
1186
1187/***********************************************************************************************
1188 * WW3D::Set_Ext_Swap_Interval -- Sets the swap interval the device should aim sync for. *
1189 * *
1190 * INPUT: *
1191 * *
1192 * OUTPUT: *
1193 * *
1194 * WARNINGS: Not supported by all rendering devices. *
1195 * *
1196 * HISTORY: *
1197 * 5/07/98 NH : Created. *
1198 *=============================================================================================*/
1203
1204
1205/***********************************************************************************************
1206 * WW3D::Get_Ext_Swap_Interval -- Queries the swap interval the device is aiming sync for. *
1207 * *
1208 * INPUT: *
1209 * *
1210 * OUTPUT: *
1211 * *
1212 * WARNINGS: Not supported by all rendering devices. *
1213 * *
1214 * HISTORY: *
1215 * 5/07/98 NH : Created. *
1216 *=============================================================================================*/
1221
1222
1223/***********************************************************************************************
1224 * WW3D::Set_Collision_Box_Display_Mask -- control rendering of collision boxes *
1225 * *
1226 * INPUT: *
1227 * *
1228 * OUTPUT: *
1229 * *
1230 * WARNINGS: *
1231 * *
1232 * HISTORY: *
1233 * 3/17/99 GTH : Created. *
1234 *=============================================================================================*/
1239
1240/***********************************************************************************************
1241 * WW3D::Get_Collision_Box_Display_Mask -- returns the current display mask for collision boxe *
1242 * *
1243 * INPUT: *
1244 * *
1245 * OUTPUT: *
1246 * *
1247 * WARNINGS: *
1248 * *
1249 * HISTORY: *
1250 * 6/1/99 GTH : Created. *
1251 *=============================================================================================*/
1256
1257
1258/***********************************************************************************************
1259 * WW3D::Normalize_Coordinates -- Convert pixel coords to normalized screen coords 0..1 *
1260 * *
1261 * *
1262 * *
1263 * *
1264 * INPUT: *
1265 * *
1266 * OUTPUT: *
1267 * *
1268 * WARNINGS: *
1269 * *
1270 * HISTORY: *
1271 * 7/27/99 EHC : Created. *
1272 *=============================================================================================*/
1273void WW3D::Normalize_Coordinates(int x, int y, float &fx, float &fy)
1274{
1275 // clip the coordinates back into the resolution of the screen
1278
1279 // now that the coordinates are clipped convert them to their normalized values.
1282}
1283
1284
1285/***********************************************************************************************
1286 * WW3D::Make_Screen_Shot -- saves a screenshot with the given base filename *
1287 * *
1288 * INPUT: *
1289 * *
1290 * OUTPUT: *
1291 * *
1292 * WARNINGS: *
1293 * *
1294 * HISTORY: *
1295 * 5/19/99 GTH : Created. *
1296 * 2/26/2001 hy : Updated to DX8 *
1297 *=============================================================================================*/
1298void WW3D::Make_Screen_Shot( const char * filename_base , const float gamma, const ScreenShotFormatEnum format)
1299{
1300
1301 WWASSERT(!IsRendering);
1302
1303 char filename[80];
1304
1305 char ext[4];
1306 switch (format) {
1307 case TGA:
1308 sprintf(ext,"tga");
1309 break;
1310 case BMP:
1311 sprintf(ext,"bmp");
1312 break;
1313 default:
1314 WWASSERT(0);
1315 return;
1316 break;
1317 }
1318
1319 static int frame_number = 1;
1320
1321 bool done = false;
1322 while (!done) {
1323 sprintf( filename, "%s%.2d.%s", filename_base, frame_number++, ext);
1324 FileClass*file=_TheFileFactory->Get_File( filename );
1325 if ( file ) {
1326 file->Open();
1327 done = !file->Is_Available();
1328 _TheFileFactory->Return_File( file );
1329 } else {
1330 done = true;
1331 }
1332 }
1333
1334 WWDEBUG_SAY(( "Creating Screen Shot %s\n", filename ));
1335
1336 // make the gamma look up table
1337 int i;
1338 unsigned char gamma_lut[256];
1339 float recip = 1.0f;
1340 if (gamma > WWMATH_EPSILON) {
1341 recip = 1.0f / gamma;
1342 }
1343 for (i = 0; i < 256; i++) {
1344 gamma_lut[i] = (unsigned char) (256.0f * powf(i / 256.0f, recip));
1345 }
1346
1347 // Lock front buffer and copy
1348
1349 IDirect3DSurface8 *fb;
1351 D3DSURFACE_DESC desc;
1352 fb->GetDesc(&desc);
1353
1354 RECT bounds;
1355 GetWindowRect(_Hwnd,&bounds);
1356
1357 D3DLOCKED_RECT lrect;
1358
1359 DX8_ErrorCode(fb->LockRect(&lrect,&bounds,D3DLOCK_READONLY));
1360
1361 unsigned int x,y,index,index2,width,height;
1362
1363 width=bounds.right-bounds.left;
1364 height=bounds.bottom-bounds.top;
1365
1366 unsigned char *image=W3DNEWARRAY unsigned char[3*width*height];
1367
1368 for (y=0; y<height; y++)
1369 {
1370 for (x=0; x<width; x++)
1371 {
1372 // index for image
1373 index=3*(x+y*width);
1374 // index for fb
1375 index2=y*lrect.Pitch+4*x;
1376
1377 image[index] = gamma_lut[*((unsigned char *) lrect.pBits + index2+2)];
1378 image[index+1] = gamma_lut[*((unsigned char *) lrect.pBits + index2+1)];
1379 image[index+2] = gamma_lut[*((unsigned char *) lrect.pBits + index2+0)];
1380 }
1381 }
1382
1383 fb->Release();
1384
1385 switch (format) {
1386 case TGA:
1387 {
1388 Targa targ;
1389 memset(&targ.Header,0,sizeof(targ.Header));
1390 targ.Header.Width=width;
1391 targ.Header.Height=height;
1392 targ.Header.PixelDepth=24;
1393 targ.Header.ImageType=TGA_TRUECOLOR;
1394 targ.SetImage((char *) image);
1395 targ.YFlip();
1396
1397 FileClass*file=_TheWritingFileFactory->Get_File( filename );
1398 if ( file ) {
1399 file->Create();
1400 file->Close();
1401 _TheWritingFileFactory->Return_File( file );
1402 }
1403
1404 targ.Save(filename,TGAF_IMAGE,false);
1405 }
1406 break;
1407 case BMP:
1408 {
1409 BITMAPFILEHEADER fileheader;
1410 BITMAPINFOHEADER header;
1411 memset(&header, 0, sizeof(BITMAPINFOHEADER));
1412 header.biSize = sizeof(BITMAPINFOHEADER);
1413 header.biWidth = width;
1414 header.biHeight = height;
1415 header.biPlanes = 1;
1416 header.biBitCount = 24;
1417 header.biCompression = BI_RGB;
1418 header.biXPelsPerMeter = 0xB12;
1419 header.biYPelsPerMeter = 0xB12;
1420 int len = ((width * 24 +31) & ~31) /8;
1421
1422 memset(&fileheader, 0, sizeof(BITMAPFILEHEADER));
1423 fileheader.bfType = 19778; // BM
1424 fileheader.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
1425 fileheader.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + 3 * len * height * sizeof(char);
1426
1427 FileClass *file = _TheWritingFileFactory->Get_File( filename );
1428 if ( file ) {
1429 file->Create();
1430 file->Open(FileClass::WRITE);
1431 int num;
1432 num = file->Write(&fileheader, sizeof(BITMAPFILEHEADER));
1433 WWASSERT(num == sizeof(BITMAPFILEHEADER));
1434 num = file->Write(&header, sizeof(BITMAPINFOHEADER));
1435 WWASSERT(num == sizeof(BITMAPINFOHEADER));
1436 char *temp = new char [3 * len];
1437 memset(temp, 0, 3 * len * sizeof(char));
1438 // invert image, pad and swap R and B
1439 for (y = 0; y < (int) height; y++) {
1440 memcpy(&temp[0], &image[ 3 * width * (height - y - 1)], 3 * width * sizeof(char));
1441 for (x = 0; x < width; x++) {
1442 char t2 = temp[3 * x];
1443 temp[3 * x] = temp[3 * x + 2];
1444 temp[3 * x + 2] = t2;
1445 }
1446 num = file->Write(&temp[0], len * sizeof(char));
1447 WWASSERT(num == len * (int)sizeof(char));
1448 }
1449 delete [] temp;
1450 file->Close();
1451 _TheWritingFileFactory->Return_File( file );
1452 }
1453 }
1454 break;
1455 }
1456
1457 delete [] image;
1458}
1459
1460
1461/***********************************************************************************************
1462 * WW3D::Start_Movie_Capture -- begins dumping frames to a movie *
1463 * *
1464 * INPUT: *
1465 * *
1466 * OUTPUT: *
1467 * *
1468 * WARNINGS: *
1469 * *
1470 * HISTORY: *
1471 * 5/19/99 GTH : Created. *
1472 * 2/26/2001 hy : updated to dx8 *
1473 *=============================================================================================*/
1474void WW3D::Start_Movie_Capture( const char * filename_base, float frame_rate )
1475{
1476#ifdef _WINDOWS
1477 if (IsCapturing) {
1479 }
1480 WWASSERT( !IsCapturing);
1481 IsCapturing = true;
1482
1483 RECT bounds;
1484 GetWindowRect(_Hwnd,&bounds);
1485 int height=bounds.bottom-bounds.top;
1486 int width=bounds.right-bounds.left;
1487 int depth=24;
1488
1489 WWASSERT( Movie == NULL);
1490
1491 if (frame_rate == 0.0f) {
1492 frame_rate = 1.0f;
1493 PauseRecord = true;
1494 } else {
1495 PauseRecord = false;
1496 }
1497
1498 Movie = W3DNEW FrameGrabClass( filename_base, FrameGrabClass::AVI, width, height, depth, frame_rate);
1499
1500 WWDEBUG_SAY(( "Starting Movie %s\n", filename_base ));
1501#endif
1502}
1503
1504
1505/***********************************************************************************************
1506 * WW3D::Stop_Movie_Capture -- ends dumping frames to a movie *
1507 * *
1508 * INPUT: *
1509 * *
1510 * OUTPUT: *
1511 * *
1512 * WARNINGS: *
1513 * *
1514 * HISTORY: *
1515 * 5/19/99 GTH : Created. *
1516 *=============================================================================================*/
1518{
1519#ifdef _WINDOWS
1520 if (IsCapturing) {
1521 IsCapturing = false;
1522 WWDEBUG_SAY(( "Stoping Movie\n" ));
1523
1524 WWASSERT( Movie != NULL);
1525 delete Movie;
1526 Movie = NULL;
1527 }
1528#endif
1529}
1530
1531
1532/***********************************************************************************************
1533 * WW3D::Toggle_Movie_Capture -- toggles movie capture... *
1534 * *
1535 * INPUT: *
1536 * *
1537 * OUTPUT: *
1538 * *
1539 * WARNINGS: *
1540 * *
1541 * HISTORY: *
1542 * 5/19/99 GTH : Created. *
1543 *=============================================================================================*/
1544void WW3D::Toggle_Movie_Capture( const char * filename_base, float frame_rate )
1545{
1546 if (IsCapturing) {
1548 } else {
1549 Start_Movie_Capture( filename_base, frame_rate);
1550 }
1551}
1552
1553
1554/***********************************************************************************************
1555 * WW3D::Start_Single_Frame_Movie_Capture -- starts capturing a single frame movie *
1556 * *
1557 * INPUT: *
1558 * *
1559 * OUTPUT: *
1560 * *
1561 * WARNINGS: *
1562 * *
1563 * HISTORY: *
1564 * 5/19/99 GTH : Created. *
1565 *=============================================================================================*/
1566void WW3D::Start_Single_Frame_Movie_Capture(const char *filename_base)
1567{
1568 Start_Movie_Capture(filename_base, 0.0f);
1569}
1570
1571
1572/***********************************************************************************************
1573 * WW3D::Capture_Next_Movie_Frame -- tells ww3d to grab another frame for the movie *
1574 * *
1575 * INPUT: *
1576 * *
1577 * OUTPUT: *
1578 * *
1579 * WARNINGS: *
1580 * *
1581 * HISTORY: *
1582 * 5/19/99 GTH : Created. *
1583 *=============================================================================================*/
1585{
1586 RecordNextFrame = true;
1587}
1588
1589
1590/***********************************************************************************************
1591 * WW3D::Pause_Movie -- pauses/unpauses movie capturing *
1592 * *
1593 * INPUT: *
1594 * *
1595 * OUTPUT: *
1596 * *
1597 * WARNINGS: *
1598 * *
1599 * HISTORY: *
1600 * 5/19/99 GTH : Created. *
1601 *=============================================================================================*/
1602void WW3D::Pause_Movie(bool mode)
1603{
1604 PauseRecord = mode;
1605}
1606
1607
1608/***********************************************************************************************
1609 * WW3D::Is_Movie_Paused -- returns whether the movie capture system is paused *
1610 * *
1611 * INPUT: *
1612 * *
1613 * OUTPUT: *
1614 * *
1615 * WARNINGS: *
1616 * *
1617 * HISTORY: *
1618 * 5/19/99 GTH : Created. *
1619 *=============================================================================================*/
1621{
1622 return PauseRecord;
1623}
1624
1625
1626/***********************************************************************************************
1627 * WW3D::Is_Recording_Next_Frame -- returns whether the next frame will be dumped to a movie *
1628 * *
1629 * INPUT: *
1630 * *
1631 * OUTPUT: *
1632 * *
1633 * WARNINGS: *
1634 * *
1635 * HISTORY: *
1636 * 5/19/99 GTH : Created. *
1637 *=============================================================================================*/
1639{
1640 return (Movie != 0) && (!PauseRecord || RecordNextFrame);
1641}
1642
1643
1644/***********************************************************************************************
1645 * WW3D::Is_Movie_Ready -- returns whether the movie capture system is ready *
1646 * *
1647 * INPUT: *
1648 * *
1649 * OUTPUT: *
1650 * *
1651 * WARNINGS: *
1652 * *
1653 * HISTORY: *
1654 * 5/19/99 GTH : Created. *
1655 *=============================================================================================*/
1657{
1658 return Movie != 0;
1659}
1660
1661
1662/***********************************************************************************************
1663 * WW3D::Update_Movie_Capture -- dumps the current frame into the movie *
1664 * *
1665 * INPUT: *
1666 * *
1667 * OUTPUT: *
1668 * *
1669 * WARNINGS: *
1670 * *
1671 * HISTORY: *
1672 * 5/19/99 GTH : Created. *
1673 * 2/26/2001 hy : Updated to dx8 *
1674 *=============================================================================================*/
1676{
1677#ifdef _WINDOWS
1678 WWASSERT( IsCapturing);
1679 WWPROFILE("WW3D::Update_Movie_Capture");
1680 WWDEBUG_SAY(( "Updating\n"));
1681
1682 // Lock front buffer and copy
1683
1684 IDirect3DSurface8 *fb;
1686 D3DSURFACE_DESC desc;
1687 fb->GetDesc(&desc);
1688
1689 RECT bounds;
1690 GetWindowRect(_Hwnd,&bounds);
1691
1692 D3DLOCKED_RECT lrect;
1693
1694 DX8_ErrorCode(fb->LockRect(&lrect,&bounds,D3DLOCK_READONLY));
1695
1696 unsigned int x,y,index,index2,width,height;
1697
1698 width=bounds.right-bounds.left;
1699 height=bounds.bottom-bounds.top;
1700
1701 char *image=(char *)Movie->GetBuffer();
1702
1703 for (y=0; y<height; y++)
1704 {
1705 for (x=0; x<width; x++)
1706 {
1707 // index for image
1708 index=3*(x+(height-y-1)*width);
1709 // index for fb
1710 index2=y*lrect.Pitch+4*x;
1711
1712 image[index]=*((char *) lrect.pBits + index2+0);
1713 image[index+1]=*((char *) lrect.pBits + index2+1);
1714 image[index+2]=*((char *) lrect.pBits + index2+2);
1715 }
1716 }
1717
1718 fb->Release();
1719
1720 Movie->Grab(image);
1721#endif
1722}
1723
1724
1725/***********************************************************************************************
1726 * WW3D::Get_Movie_Capture_Frame_Rate -- returns the framerate at which the movie is being cap *
1727 * *
1728 * INPUT: *
1729 * *
1730 * OUTPUT: *
1731 * *
1732 * WARNINGS: *
1733 * *
1734 * HISTORY: *
1735 * 5/19/99 GTH : Created. *
1736 *=============================================================================================*/
1738{
1739#ifdef _WINDOWS
1740 if (IsCapturing) {
1741 return Movie->GetFrameRate();
1742 }
1743#endif
1744 return 0;
1745}
1746
1747
1748/***********************************************************************************************
1749 * WW3D::Set_Texture_Reduction -- sets the (hacky) texture reduction factor *
1750 * *
1751 * INPUT: *
1752 * *
1753 * OUTPUT: *
1754 * *
1755 * WARNINGS: *
1756 * *
1757 * HISTORY: *
1758 * 5/19/99 GTH : Created. *
1759 *=============================================================================================*/
1760void WW3D::Set_Texture_Reduction( int value, int minDim )
1761{
1762 if (_TextureReduction != value || _TextureMinDim != minDim) {
1763 _TextureReduction=value;
1764 _TextureMinDim=minDim;
1766 }
1767}
1768
1769
1771{
1772 if (b==IsTexturingEnabled) return;
1773 IsTexturingEnabled=b;
1774// _Invalidate_Textures();
1775}
1776
1777void WW3D::Enable_Coloring(unsigned int color)
1778{
1779 IsColoringEnabled = (color == 0) ? false : true;
1780}
1781
1782/***********************************************************************************************
1783 * WW3D::Get_Texture_Reduction -- gets the (hacky) texture reduction factor *
1784 * *
1785 * INPUT: *
1786 * *
1787 * OUTPUT: *
1788 * *
1789 * WARNINGS: *
1790 * *
1791 * HISTORY: *
1792 * 11/25/99 TSS : Created. *
1793 *=============================================================================================*/
1795{
1796 return _TextureReduction;
1797}
1798
1799/***********************************************************************************************
1800 * WW3D::Get_Texture_Min_Mip_Levels -- gets the minimum number of mip levels permitted *
1801 * *
1802 * INPUT: *
1803 * *
1804 * OUTPUT: *
1805 * *
1806 * WARNINGS: *
1807 * *
1808 * HISTORY: *
1809 * 11/25/99 TSS : Created. *
1810 *=============================================================================================*/
1812{
1813 return _TextureMinDim;
1814}
1815
1817{
1818 if (_LargeTextureExtraReductionEnabled != onoff) {
1819 _LargeTextureExtraReductionEnabled = onoff;
1821 }
1822}
1823
1825{
1826 return _LargeTextureExtraReductionEnabled;
1827}
1828
1829/***********************************************************************************************
1830 * WW3D::Peek_Default_Debug_Material -- returns a pointer to the default debug mtl *
1831 * *
1832 * INPUT: *
1833 * *
1834 * OUTPUT: *
1835 * *
1836 * WARNINGS: *
1837 * *
1838 * HISTORY: *
1839 * 7/21/99 GTH : Created. *
1840 *=============================================================================================*/
1842{
1843#ifdef WWDEBUG
1844 WWASSERT(DefaultDebugMaterial);
1845 return DefaultDebugMaterial;
1846#else
1847 return NULL;
1848#endif
1849}
1850
1851/***********************************************************************************************
1852 * WW3D::Peek_Default_Debug_Shader -- returns the default shader for debugging. *
1853 * *
1854 * INPUT: *
1855 * *
1856 * OUTPUT: *
1857 * *
1858 * WARNINGS: *
1859 * *
1860 * HISTORY: *
1861 * 7/21/99 GTH : Created. *
1862 *=============================================================================================*/
1864{
1865 return DefaultDebugShader;
1866}
1867
1868/***********************************************************************************************
1869 * WW3D::Peek_Lightmap_Debug_Shader -- returns the shader for lightmap debugging. *
1870 * *
1871 * INPUT: *
1872 * *
1873 * OUTPUT: *
1874 * *
1875 * WARNINGS: *
1876 * *
1877 * HISTORY: *
1878 * 7/21/99 GTH : Created. *
1879 *=============================================================================================*/
1881{
1882 return LightmapDebugShader;
1883}
1884
1885/***********************************************************************************************
1886 * WW3D::Allocate_Debug_Resources -- allocates the debug resources *
1887 * *
1888 * INPUT: *
1889 * *
1890 * OUTPUT: *
1891 * *
1892 * WARNINGS: *
1893 * *
1894 * HISTORY: *
1895 * 7/21/99 GTH : Created. *
1896 *=============================================================================================*/
1897void WW3D::Allocate_Debug_Resources(void)
1898{
1899#ifdef WWDEBUG
1900 WWASSERT(DefaultDebugMaterial == NULL);
1901 DefaultDebugMaterial = W3DNEW VertexMaterialClass;
1902 DefaultDebugMaterial->Set_Shininess(0.0f);
1903 DefaultDebugMaterial->Set_Opacity(1.0f);
1904 DefaultDebugMaterial->Set_Ambient(0,0,0);
1905 DefaultDebugMaterial->Set_Diffuse(0,0,0);
1906 DefaultDebugMaterial->Set_Specular(0,0,0);
1907 DefaultDebugMaterial->Set_Emissive(0,0,0);
1908#endif
1909}
1910
1911/***********************************************************************************************
1912 * WW3D::Release_Debug_Resources -- releases the debug resources *
1913 * *
1914 * INPUT: *
1915 * *
1916 * OUTPUT: *
1917 * *
1918 * WARNINGS: *
1919 * *
1920 * HISTORY: *
1921 * 7/21/99 GTH : Created. *
1922 *=============================================================================================*/
1923void WW3D::Release_Debug_Resources(void)
1924{
1925#ifdef WWDEBUG
1926 WWASSERT(DefaultDebugMaterial);
1927 REF_PTR_RELEASE(DefaultDebugMaterial);
1928#endif
1929}
1930
1931
1939
1940
1945
1946
1947void WW3D::Get_Pixel_Center(float &x, float &y)
1948{
1949 x = PixelCenterX; y = PixelCenterY;
1950}
1951
1952
1953void WW3D::Update_Pixel_Center(void)
1954{
1955#ifdef WW3D_DX8
1956 const char *name = _RenderDeviceShortNameTable.getString(CurRenderDevice);
1957 if ( strstr(name, "OpenGL") ) {
1958 PixelCenterX = 0.0f; PixelCenterY = 0.0f;
1959 } else if ( strstr(name, "Glide") ) {
1960 PixelCenterX = 0.0f; PixelCenterY = 0.0f;
1961 } else if ( strstr(name, "DirectX") ) {
1962 PixelCenterX = 0.5f; PixelCenterY = 0.5f;
1963 } else if ( strstr(name, "Software") ) {
1964 PixelCenterX = 0.0f; PixelCenterY = 0.0f;
1965 } else if ( strstr(name, "Null") ) {
1966 PixelCenterX = 0.0f; PixelCenterY = 0.0f;
1967 } else {
1968 // unknown device
1969 PixelCenterX = 0.0f; PixelCenterY = 0.0f;
1970 }
1971#endif //WW3D_DX8
1972}
1973
1975{
1977}
1978
1983
1984void WW3D::Add_To_Static_Sort_List(RenderObjClass *robj, unsigned int sort_level)
1985{
1986 CurrentStaticSortLists->Add_To_List(robj, sort_level);
1987}
1988
1990{
1991 // The ststic sort lists need to be disabled while we are rendering from them otherwise the
1992 // Render() function will just dump the objects right back on the same lists.
1993 bool old_enable = AreStaticSortListsEnabled;
1994 AreStaticSortListsEnabled = false;
1995 CurrentStaticSortLists->Render_And_Clear(rinfo);
1996 AreStaticSortListsEnabled = old_enable;
1997}
1998
1999void WW3D::Enable_Sorting(bool onoff)
2000{
2001 IsSortingEnabled = onoff;
2002 // Have to invalidate mesh rendering system because
2003 // meshes are put into different fvfs depending on their sort state
2004 TheDX8MeshRenderer.Invalidate();
2005}
2006
2008{
2009 if (sort_list) {
2010 CurrentStaticSortLists = sort_list;
2011 } else {
2012 WWASSERT(sort_list);
2013 }
2014}
2015
2016
2018{
2019 CurrentStaticSortLists = DefaultStaticSortLists;
2020}
2021
2022void WW3D::Set_Gamma(float gamma,float bright,float contrast,bool calibrate)
2023{
2024 DX8Wrapper::Set_Gamma(gamma,bright,contrast,calibrate);
2025}
#define NULL
Definition BaseType.h:92
void const char * value
#define WWASSERT
#define TGAF_IMAGE
Definition TARGA.H:112
#define TGA_TRUECOLOR
Definition TARGA.H:87
#define W3DNEWARRAY
Definition always.h:110
#define W3DNEW
Definition always.h:109
#define WWMATH_EPSILON
Definition wwmath.h:54
T Bound(T original, T minval, T maxval)
Definition bound.h:44
static void Shutdown(void)
static void Initialize(const char *ini_filename=NULL)
static int Get_Box_Display_Mask(void)
Definition boxrobj.cpp:426
static void Set_Box_Display_Mask(int mask)
Definition boxrobj.cpp:408
void Apply(void)
Definition camera.cpp:719
static void Shutdown()
Definition dx8texman.cpp:74
static int Get_Swap_Interval(void)
static void Begin_Scene(void)
static IDirect3DDevice8 * _Get_D3D_Device8()
Definition dx8wrapper.h:530
static bool Set_Next_Render_Device(void)
static void Clear(bool clear_color, bool clear_z_stencil, const Vector3 &color, float dest_alpha=0.0f, float z=1.0f, unsigned int stencil=0)
Clear current render device.
static IDirect3DSurface8 * _Get_DX8_Front_Buffer()
static int Get_Render_Device(void)
static void Shutdown(void)
static void Get_Device_Resolution(int &set_w, int &set_h, int &set_bits, bool &set_windowed)
static void Set_Ambient(const Vector3 &color)
Definition dx8wrapper.h:835
static bool Set_Any_Render_Device(void)
static void Invalidate_Cached_Render_States(void)
static bool Init(void *hwnd, bool lite=false)
static void Set_Light_Environment(LightEnvironmentClass *light_env)
Set the light environment. This is a lighting model which used up to four directional lights to produ...
static void Flip_To_Primary(void)
static void End_Scene(bool flip_frame=true)
static bool Toggle_Windowed(void)
static bool Set_Render_Device(const char *dev_name, int width=-1, int height=-1, int bits=-1, int windowed=-1, bool resize_window=false)
static int Get_Device_Resolution_Width(void)
Definition dx8wrapper.h:599
static void Set_Gamma(float gamma, float bright, float contrast, bool calibrate=true, bool uselimit=true)
static void Set_Texture_Bitdepth(int depth)
Definition dx8wrapper.h:606
static bool Reset_Device(bool reload_assets=true)
static int Get_Render_Device_Count(void)
static bool Set_Device_Resolution(int width=-1, int height=-1, int bits=-1, int windowed=-1, bool resize_window=false)
static bool Is_Windowed(void)
Definition dx8wrapper.h:604
static void Get_Render_Target_Resolution(int &set_w, int &set_h, int &set_bits, bool &set_windowed)
static int Get_Texture_Bitdepth(void)
Definition dx8wrapper.h:607
static void Set_Viewport(CONST D3DVIEWPORT8 *pViewport)
static const char * Get_Render_Device_Name(int device_index)
static void Set_Swap_Interval(int swap)
static const RenderDeviceDescClass & Get_Render_Device_Desc(int deviceidx)
static bool Registry_Save_Render_Device(const char *sub_key)
static void Set_DX8_Render_State(D3DRENDERSTATETYPE state, unsigned value)
Definition dx8wrapper.h:874
static bool Registry_Load_Render_Device(const char *sub_key, bool resize_window)
static int Get_Device_Resolution_Height(void)
Definition dx8wrapper.h:600
static void Init_From_INI(const INIClass *ini)
Definition dazzle.cpp:565
static void Deinit()
Definition dazzle.cpp:726
static void _Reset(bool frame_changed)
static void _Reset(bool frame_changed)
virtual int Create(void)=0
virtual bool Is_Available(int forced=false)=0
virtual void Close(void)=0
virtual int Open(char const *filename, int rights=READ)=0
@ WRITE
Definition WWFILE.H:72
ValueType & Peek_Value()
Definition INI.H:80
T Last(void) const
Definition LISTNODE.H:208
T Prev(void) const
Definition LISTNODE.H:191
bool Is_Valid(void) const
Definition LISTNODE.H:193
static void Free(void)
Definition predlod.cpp:380
CameraClass & Camera
Definition rinfo.h:100
LightEnvironmentClass * light_environment
Definition rinfo.h:109
virtual void On_Frame_Update()
Definition rendobj.h:270
virtual void Render(RenderInfoClass &rinfo)=0
virtual const Vector3 & Get_Ambient_Light(void)
Definition scene.h:120
virtual void Render(RenderInfoClass &rinfo)
Definition scene.cpp:213
PolyRenderType Get_Polygon_Mode(void)
Definition scene.h:145
Definition TARGA.H:260
char * SetImage(char *buffer)
Definition TARGA.CPP:930
TGAHeader Header
Definition TARGA.H:287
long Save(const char *name, long flags, bool addextension=false)
Definition TARGA.CPP:586
void YFlip(void)
Definition TARGA.CPP:870
void Invalidate()
Invalidate this texture.
Definition texture.cpp:194
static void _Init_Filters(TextureFilterMode texture_filter)
Init filters (legacy)
static void Flush_Pending_Load_Tasks(void)
static void Update(void(*network_callback)(void)=NULL)
void Set_Specular(const Vector3 &color)
void Set_Diffuse(const Vector3 &color)
void Set_Ambient(const Vector3 &color)
void Set_Shininess(float shin)
void Set_Emissive(const Vector3 &color)
void Set_Opacity(float o)
static WW3DAssetManager * Get_Instance(void)
Definition assetmgr.h:205
virtual void Free_Assets(void)
Definition assetmgr.cpp:457
static WW3DErrorType On_Activate_App(void)
Definition ww3d.cpp:1941
static WW3DErrorType Render(const LayerListClass &layerlist)
Definition ww3d.cpp:876
static bool Is_Recording_Next_Frame()
Definition ww3d.cpp:1638
static ShaderClass Peek_Lightmap_Debug_Shader(void)
Definition ww3d.cpp:1880
static WW3DErrorType Registry_Save_Render_Device(const char *sub_key)
Definition ww3d.cpp:689
static void Set_Ext_Swap_Interval(long swap)
Definition ww3d.cpp:1199
static bool Is_Movie_Paused()
Definition ww3d.cpp:1620
static void Render_And_Clear_Static_Sort_Lists(RenderInfoClass &rinfo)
Definition ww3d.cpp:1989
static int Get_Texture_Reduction(void)
Definition ww3d.cpp:1794
static VertexMaterialClass * Peek_Default_Debug_Material(void)
Definition ww3d.cpp:1841
static WW3DErrorType Set_Render_Device(int dev=-1, int resx=-1, int resy=-1, int bits=-1, int windowed=-1, bool resize_window=false, bool reset_device=false, bool restore_assets=true)
Definition ww3d.cpp:444
static long UserStat2
Definition ww3d.h:305
static WW3DErrorType Init(void *hwnd, char *defaultpal=NULL, bool lite=false)
Definition ww3d.cpp:268
static WW3DErrorType Set_Device_Resolution(int w=-1, int h=-1, int bits=-1, int windowed=-1, bool resize_window=false)
Definition ww3d.cpp:626
static void Add_To_Static_Sort_List(RenderObjClass *robj, unsigned int sort_level)
Definition ww3d.cpp:1984
static void Enable_Texturing(bool b)
Definition ww3d.cpp:1770
static void Activate_Snapshot(bool b)
Definition ww3d.h:299
ScreenShotFormatEnum
Definition ww3d.h:103
@ TGA
Definition ww3d.h:104
@ BMP
Definition ww3d.h:105
static WW3DErrorType Toggle_Windowed(void)
Definition ww3d.cpp:526
static void * Get_Window(void)
Definition ww3d.cpp:489
static WW3DErrorType Begin_Render(bool clear=false, bool clearz=true, const Vector3 &color=Vector3(0, 0, 0), float dest_alpha=0.0f, void(*network_callback)(void)=NULL)
Definition ww3d.cpp:791
static void Pause_Movie(bool mode)
Definition ww3d.cpp:1602
static bool Is_Windowed(void)
Definition ww3d.cpp:506
MeshDrawModeEnum
Definition ww3d.h:87
static WW3DErrorType On_Deactivate_App(void)
Definition ww3d.cpp:1932
static void Set_Gamma(float gamma, float bright, float contrast, bool calibrate=true)
Definition ww3d.cpp:2022
static WW3DErrorType Shutdown(void)
Definition ww3d.cpp:332
static int Get_Texture_Bitdepth()
Definition ww3d.cpp:1979
static void Flip_To_Primary(void)
Definition ww3d.cpp:1139
static void Update_Movie_Capture(void)
Definition ww3d.cpp:1675
static void Enable_Coloring(unsigned int color)
when non-zero color is passed, it will override vertex colors
Definition ww3d.cpp:1777
static void Enable_Large_Texture_Extra_Reduction(bool onoff)
Definition ww3d.cpp:1816
static void Toggle_Movie_Capture(const char *filename_base="Movie", float frame_rate=15)
Definition ww3d.cpp:1544
static void Normalize_Coordinates(int x, int y, float &fx, float &fy)
Definition ww3d.cpp:1273
static const RenderDeviceDescClass & Get_Render_Device_Desc(int device=-1)
Definition ww3d.cpp:569
static bool Is_Large_Texture_Extra_Reduction_Enabled(void)
Definition ww3d.cpp:1824
static void Start_Single_Frame_Movie_Capture(const char *filename_base="Frames")
Definition ww3d.cpp:1566
static void Get_Device_Resolution(int &set_w, int &set_h, int &get_bits, bool &get_windowed)
Definition ww3d.cpp:670
static void _Invalidate_Textures()
Definition ww3d.cpp:754
static const char * Get_Render_Device_Name(int device_index)
Definition ww3d.cpp:608
static void Set_Texture_Filter(int filter)
Definition ww3d.cpp:770
static float Get_Movie_Capture_Frame_Rate(void)
Definition ww3d.cpp:1737
PrelitModeEnum
Definition ww3d.h:81
static bool Is_Movie_Ready()
Definition ww3d.cpp:1656
static const int Get_Render_Device_Count(void)
Definition ww3d.cpp:589
static WW3DErrorType Set_Any_Render_Device(void)
Definition ww3d.cpp:421
static WW3DErrorType Registry_Load_Render_Device(const char *sub_key, bool resize_window=false)
Definition ww3d.cpp:734
static void Sync(unsigned int sync_time)
Definition ww3d.cpp:1180
static int Get_Texture_Min_Dimension(void)
Definition ww3d.cpp:1811
static void Flush(RenderInfoClass &rinfo)
Definition ww3d.cpp:1059
static WW3DErrorType End_Render(bool flip_frame=true)
Definition ww3d.cpp:1082
static void Set_Texture_Bitdepth(int bitdepth)
Definition ww3d.cpp:1974
static void Set_Texture_Reduction(int value, int min_dim=1)
Definition ww3d.cpp:1760
static int Get_Render_Device(void)
Definition ww3d.cpp:550
static int Get_Collision_Box_Display_Mask(void)
Definition ww3d.cpp:1252
static void Enable_Sorting(bool onoff)
Definition ww3d.cpp:1999
static void Start_Movie_Capture(const char *filename_base="Movie", float frame_rate=15)
Definition ww3d.cpp:1474
static long UserStat0
Definition ww3d.h:303
static void _Invalidate_Mesh_Cache()
Definition ww3d.cpp:749
static void Capture_Next_Movie_Frame()
Definition ww3d.cpp:1584
static void Make_Screen_Shot(const char *filename="ScreenShot", const float gamma=1.3f, const ScreenShotFormatEnum format=TGA)
Definition ww3d.cpp:1298
static void Reset_Current_Static_Sort_Lists_To_Default(void)
Definition ww3d.cpp:2017
static long UserStat1
Definition ww3d.h:304
static long Get_Ext_Swap_Interval(void)
Definition ww3d.cpp:1217
static unsigned int Get_Last_Frame_Vertex_Count(void)
Definition ww3d.cpp:1162
NPatchesGapFillingModeEnum
Definition ww3d.h:97
static void Set_NPatches_Gap_Filling_Mode(NPatchesGapFillingModeEnum mode)
Definition ww3d.cpp:239
static void Set_NPatches_Level(unsigned level)
Definition ww3d.cpp:247
static void Stop_Movie_Capture(void)
Definition ww3d.cpp:1517
static unsigned int Get_Last_Frame_Poly_Count(void)
Definition ww3d.cpp:1157
static void Override_Current_Static_Sort_Lists(StaticSortListClass *sort_list)
Definition ww3d.cpp:2007
static ShaderClass Peek_Default_Debug_Shader(void)
Definition ww3d.cpp:1863
static void Get_Pixel_Center(float &x, float &y)
Definition ww3d.cpp:1947
static void Set_Collision_Box_Display_Mask(int mask)
Definition ww3d.cpp:1235
static void Get_Render_Target_Resolution(int &set_w, int &set_h, int &get_bits, bool &get_windowed)
Definition ww3d.cpp:651
static WW3DErrorType Set_Next_Render_Device(void)
Definition ww3d.cpp:467
static int Get_Free_Count()
Definition wwmemlog.cpp:755
static int Get_Allocate_Count()
Definition wwmemlog.cpp:749
static void Reset_Counters()
Definition wwmemlog.cpp:742
DX8MeshRendererClass TheDX8MeshRenderer
WWINLINE void DX8_ErrorCode(unsigned res)
Definition dx8wrapper.h:125
RawFileFactoryClass * _TheWritingFileFactory
Definition ffactory.cpp:55
FileFactoryClass * _TheFileFactory
Definition ffactory.cpp:51
void Init_D3D_To_WW3_Conversion()
Init format conversion tables.
Definition formconv.cpp:206
List< LayerClass * > LayerListClass
Definition layer.h:95
#define REF_PTR_RELEASE(x)
Definition refcount.h:80
#define SHD_FLUSH
Definition shdlib.h:64
void swap(T &a, T &b)
WW3DErrorType
Definition w3derr.h:51
@ WW3D_ERROR_GENERIC
Definition w3derr.h:53
@ WW3D_ERROR_OK
Definition w3derr.h:52
@ WW3D_ERROR_INITIALIZATION_FAILED
Definition w3derr.h:57
#define LIGHTMAP_DEBUG_SHADER_BITS
Definition ww3d.cpp:147
const char * DAZZLE_INI_FILENAME
Definition ww3d.cpp:130
#define DEFAULT_DEBUG_SHADER_BITS
Definition ww3d.cpp:132
#define SNAPSHOT_SAY(x)
Definition ww3d.h:68
#define WWDEBUG_SAY(x)
Definition wwdebug.h:114
@ MEM_GAMEDATA
Definition wwmemlog.h:67
#define WWMEMLOG(category)
Definition wwmemlog.h:183
#define WWPROFILE(name)
Definition wwprofile.h:270