Add test for ARBfp1.0 fragment program in snowballs (it works)

--HG--
branch : multipass-stereo
This commit is contained in:
kaetemi 2013-06-19 02:59:32 +02:00
parent 1c3fc17d91
commit c3af389ea6
2 changed files with 41 additions and 1 deletions

View file

@ -40,6 +40,12 @@
#include "snowballs_client.h" #include "snowballs_client.h"
#include "interface.h" #include "interface.h"
#if SBCLIENT_DEV_PIXEL_PROGRAM
#include <nel/3d/driver_user.h>
#include <nel/3d/driver.h>
#include <nel/3d/pixel_program.h>
#endif
// //
// Namespaces // Namespaces
// //
@ -237,6 +243,12 @@ void cbUpdateCommands (CConfigFile::CVar &var)
else nlwarning ("Unknown variable update %s", var.Name.c_str()); else nlwarning ("Unknown variable update %s", var.Name.c_str());
} }
#if SBCLIENT_DEV_PIXEL_PROGRAM
namespace {
CPixelProgram *a_DevPixelProgram;
}
#endif
void initCommands() void initCommands()
{ {
// Add the keyboard listener in the event server // Add the keyboard listener in the event server
@ -278,6 +290,15 @@ void initCommands()
CommandsMaterial.initUnlit(); CommandsMaterial.initUnlit();
CommandsMaterial.setBlendFunc(UMaterial::srcalpha, UMaterial::invsrcalpha); CommandsMaterial.setBlendFunc(UMaterial::srcalpha, UMaterial::invsrcalpha);
CommandsMaterial.setBlend(true); 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() void updateCommands()
@ -301,8 +322,18 @@ void updateCommands()
float y0 = CommandsBoxY - CommandsBoxBorderY; float y0 = CommandsBoxY - CommandsBoxBorderY;
float x1 = CommandsBoxX + CommandsBoxWidth + CommandsBoxBorderX; float x1 = CommandsBoxX + CommandsBoxWidth + CommandsBoxBorderX;
float y1 = CommandsBoxY + CommandsBoxHeight + CommandsBoxBorderY; float y1 = CommandsBoxY + CommandsBoxHeight + CommandsBoxBorderY;
#if SBCLIENT_DEV_PIXEL_PROGRAM
NL3D::IDriver *d = dynamic_cast<NL3D::CDriverUser *>(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); 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 // Set the text context
TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setHotSpot (UTextContext::BottomLeft);
TextContext->setColor (CommandsFrontColor); TextContext->setColor (CommandsFrontColor);
@ -334,6 +365,10 @@ void clearCommands ()
void releaseCommands() void releaseCommands()
{ {
#if SBCLIENT_DEV_PIXEL_PROGRAM
delete a_DevPixelProgram;
a_DevPixelProgram = NULL;
#endif
// Remove the displayers // Remove the displayers
CommandsLog.removeDisplayer(&CommandsDisplayer); CommandsLog.removeDisplayer(&CommandsDisplayer);
#ifndef NL_RELEASE #ifndef NL_RELEASE

View file

@ -37,7 +37,11 @@
#define SBCLIENT_ERASE_LOG true #define SBCLIENT_ERASE_LOG true
// version number // 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_SOUND 0
#define SBCLIENT_DEV_STEREO 0 #define SBCLIENT_DEV_STEREO 0
#define SBCLIENT_DEV_MEMLEAK 0 #define SBCLIENT_DEV_MEMLEAK 0
#define SBCLIENT_DEV_PIXEL_PROGRAM 1