Skip to content
Snippets Groups Projects
Commit 13e66153 authored by Florent Berthaut's avatar Florent Berthaut
Browse files

Add audio output attribute for modules

parent 77b7f728
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,8 @@ class Reveal : public GroupModule {
SURFACE, SURFACECOLOR, SURFACETHICKNESS,
AUDIOOUTPUT,
INSIDEVISIBLE, INSIDESTRUCT, STRUCTRATIO,
GRADIENTALPHA, GRADIENTTYPE, GRADIENTSTEPS, GRADIENTCURVERATIO,
GRADIENTTEXTURE,
......
......@@ -489,6 +489,9 @@ void ProjectorModule::initGL() {
m_uniforms[Reveal::RENDERPROG][Reveal::SURFDISTEX]
= glGetUniformLocation(m_programs[Reveal::RENDERPROG], "surfDistTex");
m_uniforms[Reveal::RENDERPROG][Reveal::AUDIOOUTPUT]
= glGetUniformLocation(m_programs[Reveal::RENDERPROG], "audioOutput");
m_uniforms[Reveal::RENDERPROG][Reveal::SHAPEID]
= glGetUniformLocation(m_programs[Reveal::RENDERPROG], "shapeID");
m_uniforms[Reveal::RENDERPROG][Reveal::SHAPEIDBIT]
......
......@@ -60,6 +60,7 @@ RevealedModule::RevealedModule(): GeomModule(),
m_textureOffset[d]=0;
m_textureScale[d]=1;
}
m_audioOutput=false;
m_revSize=0;
m_revSurf=0;
......@@ -278,6 +279,10 @@ void RevealedModule::addRevealedInsideTextureAttributes() {
}
void RevealedModule::addRevealedOutputAttributes() {
addAttribute(new Attribute("audio_output",
Attribute::BOOL_ATTRIBUTE,
audioOutputCallback, this, 1));
addAttribute(new Attribute("revealed_name",
Attribute::STRING_ATTRIBUTE,
revnamCallback, this, 1, Attribute::OUTPUT));
......@@ -445,6 +450,8 @@ void RevealedModule::draw(const int& contextID,
glUniform3fv(uniforms[Reveal::TEXSCALE], 1, &m_textureScale[0]);
glUniform1i(uniforms[Reveal::TEXGRAY], m_textureGrayscale);
glUniform1i(uniforms[Reveal::AUDIOOUTPUT], m_audioOutput);
glUniform1i(uniforms[Reveal::INSIDETEX], 2);
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_3D, m_insideIDMap[contextID]);
......@@ -1171,6 +1178,12 @@ void RevealedModule::setSurfaceThickness(const float& surface) {
m_surfaceThickness=surface;
}
void RevealedModule::setAudioOutput(bool o){
m_audioOutput=o;
}
void RevealedModule::gotAttributeListenersUpdate(Attribute* att) {
bool active=false;
vector<Attribute*>::iterator itAtt = m_revAttributes.begin();
......
......@@ -239,6 +239,12 @@ class RevealedModule : public virtual GeomModule {
}
virtual void setSurfaceTexture(const std::string& f);
static void audioOutputCallback(Module* mod,
const std::vector<bool>& vals) {
dynamic_cast<RevealedModule*>(mod)->setAudioOutput(vals[0]);
}
virtual void setAudioOutput(bool o);
//Revealed
static void revnamCallback(Module* mod,
const std::vector<std::string>& vals){}
......@@ -361,6 +367,8 @@ class RevealedModule : public virtual GeomModule {
int m_outDepthSize;
int m_outNbDepth;
bool m_audioOutput;
std::thread* m_reactThread;
std::mutex m_reactLock;
bool m_reactActive;
......
......@@ -77,6 +77,8 @@ uniform vec3 texOffset;
uniform vec3 texScale;
uniform int texGray;
uniform int audioOutput;
uniform int revSize;
uniform int revSurface;
uniform int revInside;
......@@ -582,6 +584,7 @@ void main(void) {
if((insideVisible>0 && rendered==1) || (surface>0 && rendered==2)) {
color = vec4(finalColor, 1.0);
if(audioOutput>0) {
switch(processAudio) {
case 1 : {
additiveSynth(color);
......@@ -592,6 +595,7 @@ void main(void) {
default:break;
}
}
}
else {
color = vec4(0.0, 0.0, 0.0, 1.0);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment