Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

dumping and resolution-independent bloom

  • Loading branch information...
commit 5597e75ecbe95a341b3891cd9c187747ed9c19af 1 parent 2c528ea
@kusma authored
View
5 very_last_engine_ever/config.h
@@ -4,6 +4,9 @@
#define DEVTYPE D3DDEVTYPE_HAL
+// #define DUMP_VIDEO
+#define VIDEO_DUMP_FRAMERATE 30
+
#define DEFAULT_WIDTH 800
#define DEFAULT_HEIGHT 600
#define DEFAULT_FORMAT D3DFMT_X8R8G8B8;
@@ -15,7 +18,7 @@
// #define MIN_VS_VERSION D3DVS_VERSION(2, 0)
#define MIN_VS_VERSION D3DVS_VERSION(1, 1)
-#if defined(NDEBUG) && !defined(SYNC)
+#if defined(NDEBUG) && !defined(SYNC) && !defined(DUMP_VIDEO)
#define WINDOWED 0
#else
#define WINDOWED 1
View
26 very_last_engine_ever/main.cpp
@@ -180,7 +180,8 @@ int main(int /*argc*/, char* /*argv*/ [])
makeLetterboxViewport(&letterbox_viewport, config.getWidth(), config.getHeight(), config.getAspect(), DEMO_ASPECT);
/* setup sound-playback */
- if (!BASS_Init(config.getSoundcard(), 44100, BASS_DEVICE_LATENCY, 0, 0)) throw FatalException("failed to init bass");
+// if (!BASS_Init(config.getSoundcard(), 44100, BASS_DEVICE_LATENCY, 0, 0)) throw FatalException("failed to init bass");
+ if (!BASS_Init(config.getSoundcard(), 44100, 0, 0, 0)) throw FatalException("failed to init bass");
stream = BASS_StreamCreateFile(false, "data/glitch.ogg", 0, 0, BASS_MP3_SETPOS | ((0 == config.getSoundcard()) ? BASS_STREAM_DECODE : 0));
if (!stream) throw FatalException("failed to open tune");
@@ -231,8 +232,8 @@ int main(int /*argc*/, char* /*argv*/ [])
/** DEMO ***/
- RenderTexture color1_hdr(device, letterbox_viewport.Width / 2, letterbox_viewport.Height / 2, 1, D3DFMT_A16B16G16R16F);
- RenderTexture color2_hdr(device, letterbox_viewport.Width / 2, letterbox_viewport.Height / 2, 1, D3DFMT_A16B16G16R16F);
+ RenderTexture color1_hdr(device, 800 / 2, (800 / DEMO_ASPECT) / 2, 1, D3DFMT_A16B16G16R16F);
+ RenderTexture color2_hdr(device, 800 / 2, (800 / DEMO_ASPECT) / 2, 1, D3DFMT_A16B16G16R16F);
// RenderTexture rt(device, 128, 128, 1, D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE);
@@ -317,6 +318,11 @@ int main(int /*argc*/, char* /*argv*/ [])
if (!sync.doEvents()) done = true;
#endif
+#ifdef DUMP_VIDEO
+ static int frame = 0;
+ BASS_ChannelSetPosition(stream, BASS_ChannelSeconds2Bytes(stream, float(frame) / VIDEO_DUMP_FRAMERATE));
+#endif
+
static float last_time = 0.f;
static float time_offset = 0.f;
float time = BASS_ChannelBytes2Seconds(stream, BASS_ChannelGetPosition(stream));
@@ -571,6 +577,20 @@ int main(int /*argc*/, char* /*argv*/ [])
device->EndScene(); /* WE DONE IS! */
+#ifdef DUMP_VIDEO
+ {
+ char temp[256];
+ _snprintf(temp, 256, "dump/frame%04d.tga", frame);
+ core::d3dErr(D3DXSaveSurfaceToFile(
+ temp,
+ D3DXIFF_TGA,
+ backbuffer,
+ NULL,
+ NULL
+ ));
+ frame++;
+ }
+#endif
HRESULT res = device->Present(0, 0, 0, 0);
if (FAILED(res))
View
2  very_last_engine_ever/very_last_engine_ever.vcproj
@@ -124,7 +124,7 @@
AdditionalIncludeDirectories="include;"$(ProjectDir)""
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0"
- EnableEnhancedInstructionSet="2"
+ EnableEnhancedInstructionSet="0"
FloatingPointModel="2"
UsePrecompiledHeader="2"
WarningLevel="3"

0 comments on commit 5597e75

Please sign in to comment.
Something went wrong with that request. Please try again.