From f534bac6e1547567085482859657057740120a93 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 19 Jun 2013 02:59:32 +0200 Subject: [PATCH] Add test for ARBfp1.0 fragment program in snowballs (it works) --- code/snowballs2/client/src/commands.cpp | 35 +++++++++++++++++++ code/snowballs2/client/src/snowballs_config.h | 7 +++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/code/snowballs2/client/src/commands.cpp b/code/snowballs2/client/src/commands.cpp index 70dd3b247..f5acf0b80 100644 --- a/code/snowballs2/client/src/commands.cpp +++ b/code/snowballs2/client/src/commands.cpp @@ -40,6 +40,12 @@ #include "snowballs_client.h" #include "interface.h" +#if SBCLIENT_DEV_PIXEL_PROGRAM +#include +#include +#include +#endif + // // Namespaces // @@ -237,6 +243,12 @@ void cbUpdateCommands (CConfigFile::CVar &var) else nlwarning ("Unknown variable update %s", var.Name.c_str()); } +#if SBCLIENT_DEV_PIXEL_PROGRAM +namespace { +CPixelProgram *a_DevPixelProgram; +} +#endif + void initCommands() { // Add the keyboard listener in the event server @@ -278,6 +290,15 @@ void initCommands() CommandsMaterial.initUnlit(); CommandsMaterial.setBlendFunc(UMaterial::srcalpha, UMaterial::invsrcalpha); CommandsMaterial.setBlend(true); + +#if SBCLIENT_DEV_PIXEL_PROGRAM + static const char *program = + "!!ARBfp1.0\n" + "PARAM red = {1.0, 0.0, 0.0, 1.0};\n" + "MOV result.color, red;\n" + "END\n"; + a_DevPixelProgram = new CPixelProgram(program); +#endif } void updateCommands() @@ -301,8 +322,18 @@ void updateCommands() float y0 = CommandsBoxY - CommandsBoxBorderY; float x1 = CommandsBoxX + CommandsBoxWidth + CommandsBoxBorderX; float y1 = CommandsBoxY + CommandsBoxHeight + CommandsBoxBorderY; + +#if SBCLIENT_DEV_PIXEL_PROGRAM + NL3D::IDriver *d = dynamic_cast(Driver)->getDriver(); + d->activePixelProgram(a_DevPixelProgram); +#endif + Driver->drawQuad(CQuad(CVector(x0, y0, 0), CVector(x1, y0, 0), CVector(x1, y1, 0), CVector(x0, y1, 0)), CommandsMaterial); +#if SBCLIENT_DEV_PIXEL_PROGRAM + d->activePixelProgram(NULL); +#endif + // Set the text context TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setColor (CommandsFrontColor); @@ -334,6 +365,10 @@ void clearCommands () void releaseCommands() { +#if SBCLIENT_DEV_PIXEL_PROGRAM + delete a_DevPixelProgram; + a_DevPixelProgram = NULL; +#endif // Remove the displayers CommandsLog.removeDisplayer(&CommandsDisplayer); #ifndef NL_RELEASE diff --git a/code/snowballs2/client/src/snowballs_config.h b/code/snowballs2/client/src/snowballs_config.h index edd282718..9565fe4cf 100644 --- a/code/snowballs2/client/src/snowballs_config.h +++ b/code/snowballs2/client/src/snowballs_config.h @@ -37,7 +37,11 @@ #define SBCLIENT_ERASE_LOG true // version number -#define SBCLIENT_VERSION "2.1.551" +// 2.1 +// - Bloom +// 2.2 +// - OculusVR support +#define SBCLIENT_VERSION "2.2" @@ -45,6 +49,7 @@ #define SBCLIENT_DEV_SOUND 0 #define SBCLIENT_DEV_STEREO 0 #define SBCLIENT_DEV_MEMLEAK 0 +#define SBCLIENT_DEV_PIXEL_PROGRAM 1