GPUParticles: Reenable rain, windows build is fixed
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14815 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
df2bd304ab
commit
187abe584b
1315
sources.cmake
1315
sources.cmake
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,3 @@
|
||||
#if 0
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "gpuparticles.h"
|
||||
#include <fstream>
|
||||
@ -6,9 +5,48 @@
|
||||
#include "config/user_config.hpp"
|
||||
#include <ICameraSceneNode.h>
|
||||
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
#define IRR_OGL_LOAD_EXTENSION(X) wglGetProcAddress(reinterpret_cast<const char*>(X))
|
||||
|
||||
|
||||
PFNGLGENTRANSFORMFEEDBACKSPROC glGenTransformFeedbacks;
|
||||
PFNGLBINDTRANSFORMFEEDBACKPROC glBindTransformFeedback;
|
||||
PFNGLDRAWTRANSFORMFEEDBACKPROC glDrawTransformFeedback;
|
||||
PFNGLBEGINTRANSFORMFEEDBACKPROC glBeginTransformFeedback;
|
||||
PFNGLENDTRANSFORMFEEDBACKPROC glEndTransformFeedback;
|
||||
PFNGLTRANSFORMFEEDBACKVARYINGSPROC glTransformFeedbackVaryings;
|
||||
PFNGLBINDBUFFERBASEPROC glBindBufferBase;
|
||||
PFNGLGENBUFFERSPROC glGenBuffers;
|
||||
PFNGLBINDBUFFERPROC glBindBuffer;
|
||||
PFNGLBUFFERDATAPROC glBufferData;
|
||||
PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
|
||||
PFNGLCREATESHADERPROC glCreateShader;
|
||||
PFNGLCOMPILESHADERPROC glCompileShader;
|
||||
PFNGLSHADERSOURCEPROC glShaderSource;
|
||||
PFNGLCREATEPROGRAMPROC glCreateProgram;
|
||||
PFNGLATTACHSHADERPROC glAttachShader;
|
||||
PFNGLLINKPROGRAMPROC glLinkProgram;
|
||||
PFNGLUSEPROGRAMPROC glUseProgram;
|
||||
PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
|
||||
PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray;
|
||||
PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation;
|
||||
PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv;
|
||||
PFNGLUNIFORM1FPROC glUniform1f;
|
||||
PFNGLUNIFORM3FPROC glUniform3f;
|
||||
PFNGLDELETESHADERPROC glDeleteShader;
|
||||
PFNGLGETSHADERIVPROC glGetShaderiv;
|
||||
PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog;
|
||||
PFNGLACTIVETEXTUREPROC glActiveTexture;
|
||||
PFNGLUNIFORM2FPROC glUniform2f;
|
||||
PFNGLUNIFORM1IPROC glUniform1i;
|
||||
PFNGLGETPROGRAMIVPROC glGetProgramiv;
|
||||
PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;
|
||||
#endif
|
||||
|
||||
void initGL()
|
||||
{
|
||||
/* glGenTransformFeedbacks = (PFNGLGENTRANSFORMFEEDBACKSPROC)IRR_OGL_LOAD_EXTENSION("glGenTransformFeedbacks");
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
glGenTransformFeedbacks = (PFNGLGENTRANSFORMFEEDBACKSPROC)IRR_OGL_LOAD_EXTENSION("glGenTransformFeedbacks");
|
||||
glBindTransformFeedback = (PFNGLBINDTRANSFORMFEEDBACKPROC)IRR_OGL_LOAD_EXTENSION("glBindTransformFeedback");
|
||||
glDrawTransformFeedback = (PFNGLDRAWTRANSFORMFEEDBACKPROC)IRR_OGL_LOAD_EXTENSION("glDrawTransformFeedback");
|
||||
glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)IRR_OGL_LOAD_EXTENSION("glBeginTransformFeedback");
|
||||
@ -34,14 +72,13 @@ void initGL()
|
||||
glDeleteShader = (PFNGLDELETESHADERPROC)IRR_OGL_LOAD_EXTENSION("glDeleteShader");
|
||||
glGetShaderiv = (PFNGLGETSHADERIVPROC)IRR_OGL_LOAD_EXTENSION("glGetShaderiv");
|
||||
glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)IRR_OGL_LOAD_EXTENSION("glGetShaderInfoLog");
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
glActiveTexture = (PFNGLACTIVETEXTUREPROC)IRR_OGL_LOAD_EXTENSION("glActiveTexture");
|
||||
#endif
|
||||
glUniform2f = (PFNGLUNIFORM2FPROC)IRR_OGL_LOAD_EXTENSION("glUniform2f");
|
||||
glUniform1i = (PFNGLUNIFORM1IPROC)IRR_OGL_LOAD_EXTENSION("glUniform1i");
|
||||
glGetProgramiv = (PFNGLGETPROGRAMIVPROC)IRR_OGL_LOAD_EXTENSION("glGetProgramiv");
|
||||
glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)IRR_OGL_LOAD_EXTENSION("glGetProgramInfoLog");
|
||||
glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)IRR_OGL_LOAD_EXTENSION("glTransformFeedbackVaryings");*/
|
||||
glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)IRR_OGL_LOAD_EXTENSION("glTransformFeedbackVaryings");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Mostly from shader tutorial
|
||||
@ -207,4 +244,3 @@ void GPUParticle::render() {
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glDisable(GL_VERTEX_PROGRAM_POINT_SIZE);
|
||||
}
|
||||
#endif
|
||||
|
@ -1,54 +1,12 @@
|
||||
#if 0
|
||||
#ifndef GPUPARTICLES_H
|
||||
#define GPUPARTICLES_H
|
||||
|
||||
#ifndef _IRR_WINDOWS_API_
|
||||
#define GL_GLEXT_PROTOTYPES 1
|
||||
#endif
|
||||
#include "graphics/glwrap.hpp"
|
||||
#include <ISceneManager.h>
|
||||
|
||||
/*#ifdef _IRR_WINDOWS_API_
|
||||
#define IRR_OGL_LOAD_EXTENSION(X) wglGetProcAddress(reinterpret_cast<const char*>(X))
|
||||
#else
|
||||
#include <GL/glx.h>
|
||||
#define IRR_OGL_LOAD_EXTENSION(X) glXGetProcAddress(reinterpret_cast<const GLubyte*>(X))
|
||||
#endif
|
||||
|
||||
|
||||
PFNGLGENTRANSFORMFEEDBACKSPROC glGenTransformFeedbacks;
|
||||
PFNGLBINDTRANSFORMFEEDBACKPROC glBindTransformFeedback;
|
||||
PFNGLDRAWTRANSFORMFEEDBACKPROC glDrawTransformFeedback;
|
||||
PFNGLBEGINTRANSFORMFEEDBACKPROC glBeginTransformFeedback;
|
||||
PFNGLENDTRANSFORMFEEDBACKPROC glEndTransformFeedback;
|
||||
PFNGLTRANSFORMFEEDBACKVARYINGSPROC glTransformFeedbackVaryings;
|
||||
PFNGLBINDBUFFERBASEPROC glBindBufferBase;
|
||||
PFNGLGENBUFFERSPROC glGenBuffers;
|
||||
PFNGLBINDBUFFERPROC glBindBuffer;
|
||||
PFNGLBUFFERDATAPROC glBufferData;
|
||||
PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
|
||||
PFNGLCREATESHADERPROC glCreateShader;
|
||||
PFNGLCOMPILESHADERPROC glCompileShader;
|
||||
PFNGLSHADERSOURCEPROC glShaderSource;
|
||||
PFNGLCREATEPROGRAMPROC glCreateProgram;
|
||||
PFNGLATTACHSHADERPROC glAttachShader;
|
||||
PFNGLLINKPROGRAMPROC glLinkProgram;
|
||||
PFNGLUSEPROGRAMPROC glUseProgram;
|
||||
PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
|
||||
PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray;
|
||||
PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation;
|
||||
PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv;
|
||||
PFNGLUNIFORM1FPROC glUniform1f;
|
||||
PFNGLUNIFORM3FPROC glUniform3f;
|
||||
PFNGLDELETESHADERPROC glDeleteShader;
|
||||
PFNGLGETSHADERIVPROC glGetShaderiv;
|
||||
PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog;
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
PFNGLACTIVETEXTUREPROC glActiveTexture;
|
||||
#endif
|
||||
PFNGLUNIFORM2FPROC glUniform2f;
|
||||
PFNGLUNIFORM1IPROC glUniform1i;
|
||||
PFNGLGETPROGRAMIVPROC glGetProgramiv;
|
||||
PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;*/
|
||||
|
||||
void initGL();
|
||||
GLuint LoadProgram(const char * vertex_file_path, const char * fragment_file_path);
|
||||
GLuint LoadTFBProgram(const char * vertex_file_path, const char **varyings, unsigned varyingscount);
|
||||
@ -69,5 +27,4 @@ public:
|
||||
void render();
|
||||
};
|
||||
|
||||
#endif // GPUPARTICLES_H
|
||||
#endif
|
||||
#endif // GPUPARTICLES_H
|
@ -42,7 +42,7 @@ using namespace core;
|
||||
class RainNode: public scene::ISceneNode
|
||||
{
|
||||
private:
|
||||
// GPUParticle *gpupart;
|
||||
GPUParticle *gpupart;
|
||||
public:
|
||||
RainNode(scene::ISceneManager* mgr, ITexture *tex)
|
||||
: scene::ISceneNode(0, mgr, -1)
|
||||
@ -72,7 +72,7 @@ public:
|
||||
vertices[3 * i + 1] = y;
|
||||
vertices[3 * i + 2] = z;
|
||||
}
|
||||
//gpupart = new GPUParticle(count, vertices, getTextureGLuint(mat.getTexture(0)), getTextureGLuint(irr_driver->getRTT(RTT_NORMAL_AND_DEPTH)));
|
||||
gpupart = new GPUParticle(count, vertices, getTextureGLuint(mat.getTexture(0)), getTextureGLuint(irr_driver->getRTT(RTT_NORMAL_AND_DEPTH)));
|
||||
|
||||
box.addInternalPoint(vector3df((float)(-area/2)));
|
||||
box.addInternalPoint(vector3df((float)( area/2)));
|
||||
@ -80,13 +80,13 @@ public:
|
||||
|
||||
~RainNode()
|
||||
{
|
||||
// delete gpupart;
|
||||
delete gpupart;
|
||||
}
|
||||
|
||||
virtual void render()
|
||||
{
|
||||
// gpupart->simulate();
|
||||
// gpupart->render();
|
||||
gpupart->simulate();
|
||||
gpupart->render();
|
||||
// We need to force irrlicht to update its internal states
|
||||
IVideoDriver * const drv = irr_driver->getVideoDriver();
|
||||
drv->setMaterial(mat);
|
||||
|
Loading…
Reference in New Issue
Block a user