Skip to content

Commit

Permalink
dumping and resolution-independent bloom
Browse files Browse the repository at this point in the history
  • Loading branch information
kusma committed Nov 20, 2007
1 parent 2c528ea commit 5597e75
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
5 changes: 4 additions & 1 deletion very_last_engine_ever/config.h
Expand Up @@ -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;
Expand All @@ -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
Expand Down
26 changes: 23 additions & 3 deletions very_last_engine_ever/main.cpp
Expand Up @@ -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");

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion very_last_engine_ever/very_last_engine_ever.vcproj
Expand Up @@ -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"
Expand Down

0 comments on commit 5597e75

Please sign in to comment.