Commit bc2e1c32 authored by Pierre Kraemer's avatar Pierre Kraemer

Set spherical harmonics resolution at ShaderRadiancePerVertex construction

parent c32aa9d5
......@@ -260,11 +260,9 @@ MapHandlerGen* Surface_Radiance_Plugin::importFromFile(const QString& fileName)
mapParams.paramVBO = new Utils::VBO();
mapParams.paramVBO->updateData(mapParams.param);
mapParams.radiancePerVertexShader = new Utils::ShaderRadiancePerVertex();
mapParams.radiancePerVertexShader = new Utils::ShaderRadiancePerVertex(SH_TYPE::get_resolution());
registerShader(mapParams.radiancePerVertexShader);
mapParams.radiancePerVertexShader->compile(SH_TYPE::get_resolution());
mapParams.radiancePerVertexShader->setAttributeRadiance(mapParams.paramVBO, mapParams.radianceTexture, GL_TEXTURE1);
// compute map bounding box
......
......@@ -62,11 +62,11 @@ protected:
static int index (int l, int m) { return l*(l+1)+m; } // compute indices in K_tab
public:
ShaderRadiancePerVertex();
ShaderRadiancePerVertex(int resolution);
~ShaderRadiancePerVertex() ;
void compile(int resolution);
void compile();
void setCamera(Geom::Vec3f camera) ;
......
......@@ -34,15 +34,17 @@ namespace Utils
#include "shaderRadiancePerVertex.geom"
#include "shaderRadiancePerVertex.frag"
ShaderRadiancePerVertex::ShaderRadiancePerVertex() :
ShaderRadiancePerVertex::ShaderRadiancePerVertex(int resolution) :
m_vboPos(NULL),
m_vboNorm(NULL),
m_vboParam(NULL),
m_tex_ptr(NULL),
m_tex_unit(-1),
m_resolution(-1),
m_resolution(resolution),
K_tab(NULL)
{}
{
compile();
}
ShaderRadiancePerVertex::~ShaderRadiancePerVertex()
{
......@@ -50,13 +52,12 @@ ShaderRadiancePerVertex::~ShaderRadiancePerVertex()
delete[] K_tab ;
}
void ShaderRadiancePerVertex::compile(int resolution)
void ShaderRadiancePerVertex::compile()
{
m_nameVS = "ShaderRadiancePerVertex_vs";
m_nameFS = "ShaderRadiancePerVertex_fs";
m_nameGS = "ShaderRadiancePerVertex_gs";
m_resolution = resolution;
const int nb_coefs = (m_resolution+1)*(m_resolution+1);
if (m_resolution != -1)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment