mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-03-01 21:16:01 +00:00
More noise, less verbosity, and projectM.cg installation
git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@1086 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
@ -149,7 +149,8 @@ FILE(GLOB presets "presets/*.milk" "presets/*.prjm" "presets/*.tga")
|
||||
INSTALL(FILES ${presets} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/projectM/presets)
|
||||
FILE(GLOB fonts "fonts/*.ttf")
|
||||
INSTALL(FILES ${fonts} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/projectM/fonts)
|
||||
INSTALL(FILES "${CMAKE_CURRENT_SOURCE_DIR}/libprojectM.pc" DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig)
|
||||
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/projectM.cg DESTINATION ${CMAKE_INSTALL_PREFIX}/share/projectM/shaders)
|
||||
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/libprojectM.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig)
|
||||
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.inp DESTINATION ${CMAKE_INSTALL_PREFIX}/share/projectM)
|
||||
INSTALL(FILES projectM.hpp event.h dlldefs.h fatal.h PresetFrameIO.hpp PCM.hpp DESTINATION include/libprojectM)
|
||||
INSTALL(TARGETS projectM DESTINATION lib${LIB_SUFFIX})
|
||||
|
||||
@ -9,8 +9,17 @@
|
||||
|
||||
PerlinNoise::PerlinNoise()
|
||||
{
|
||||
// TODO Auto-generated constructor stub
|
||||
for (int x = 0; x < 256;x++)
|
||||
for (int y = 0; y < 256;y++)
|
||||
noise_lq[x][y] = Noise(x,y);
|
||||
|
||||
for (int x = 0; x < 32;x++)
|
||||
for (int y = 0; y < 32;y++)
|
||||
noise_lq_lite[x][y] = Noise(x,y);
|
||||
|
||||
for (int x = 0; x < 256;x++)
|
||||
for (int y = 0; y < 256;y++)
|
||||
noise_hq[x][y] = perlin_noise_2D(x,y,5,1.414);
|
||||
}
|
||||
|
||||
PerlinNoise::~PerlinNoise()
|
||||
|
||||
@ -96,14 +96,7 @@ private:
|
||||
return total;
|
||||
}
|
||||
|
||||
public:
|
||||
void GenerateTextures()
|
||||
{
|
||||
for (int x = 0; x < 256;x++)
|
||||
for (int y = 0; y < 256;y++)
|
||||
noise_lq[x][y] = perlin_noise_2D(x,y,8,1.414);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -112,12 +112,18 @@ SetupCg();
|
||||
std::cout<<"Generating Noise Textures"<<std::endl;
|
||||
PerlinNoise noise;
|
||||
|
||||
noise.GenerateTextures();
|
||||
|
||||
glGenTextures( 1, &noise_texture );
|
||||
glBindTexture( GL_TEXTURE_2D, noise_texture );
|
||||
glGenTextures( 1, &noise_texture_lq );
|
||||
glBindTexture( GL_TEXTURE_2D, noise_texture_lq );
|
||||
glTexImage2D(GL_TEXTURE_2D,0,1,256,256,0,GL_LUMINANCE,GL_FLOAT,noise.noise_lq);
|
||||
|
||||
glGenTextures( 1, &noise_texture_lq_lite );
|
||||
glBindTexture( GL_TEXTURE_2D, noise_texture_lq_lite );
|
||||
glTexImage2D(GL_TEXTURE_2D,0,1,32,32,0,GL_LUMINANCE,GL_FLOAT,noise.noise_lq_lite);
|
||||
|
||||
glGenTextures( 1, &noise_texture_hq );
|
||||
glBindTexture( GL_TEXTURE_2D, noise_texture_hq );
|
||||
glTexImage2D(GL_TEXTURE_2D,0,1,256,256,0,GL_LUMINANCE,GL_FLOAT,noise.noise_hq);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -157,7 +163,7 @@ bool Renderer::LoadCgProgram(std::string program, CGprogram &p)
|
||||
temp.append("OUT.color.xyz = ret;return OUT;}");
|
||||
|
||||
std::cout<<"Cg: Compilation Results:"<<std::endl<<std::endl;
|
||||
std::cout<<temp<<std::endl;
|
||||
std::cout<<program<<std::endl;
|
||||
|
||||
p = cgCreateProgram(myCgContext,
|
||||
CG_SOURCE,
|
||||
@ -223,7 +229,7 @@ void Renderer::checkForCgError(const char *situation)
|
||||
void Renderer::SetupCg()
|
||||
{
|
||||
std::string line;
|
||||
std::ifstream myfile ("/home/pete/projectM.cg");
|
||||
std::ifstream myfile ("/usr/local/share/projectM/shaders/projectM.cg");
|
||||
if (myfile.is_open())
|
||||
{
|
||||
while (! myfile.eof() )
|
||||
@ -270,10 +276,16 @@ void Renderer::SetupCgVariables(CGprogram program, const PipelineContext &contex
|
||||
cgGLSetParameter1f(cgGetNamedParameter(program, "vol_att"), beatDetect->vol);
|
||||
|
||||
cgGLSetParameter4f(cgGetNamedParameter(program, "texsize"), renderTarget->texsize, renderTarget->texsize, 1/(float)renderTarget->texsize,1/(float)renderTarget->texsize);
|
||||
cgGLSetParameter4f(cgGetNamedParameter(program, "aspect"), aspect,1,1/aspect,1);
|
||||
cgGLSetParameter4f(cgGetNamedParameter(program, "aspect"), aspect,1,1/aspect,1);
|
||||
|
||||
cgGLSetTextureParameter(cgGetNamedParameter(program, "sampler_noise_lq"),noise_texture);
|
||||
cgGLSetTextureParameter(cgGetNamedParameter(program, "sampler_noise_lq"),noise_texture_lq_lite);
|
||||
cgGLEnableTextureParameter(cgGetNamedParameter(program, "sampler_noise_lq"));
|
||||
|
||||
cgGLSetTextureParameter(cgGetNamedParameter(program, "sampler_noise_lq_lite"),noise_texture_lq_lite);
|
||||
cgGLEnableTextureParameter(cgGetNamedParameter(program, "sampler_noise_lq_lite"));
|
||||
|
||||
cgGLSetTextureParameter(cgGetNamedParameter(program, "sampler_noise_hq"),noise_texture_hq);
|
||||
cgGLEnableTextureParameter(cgGetNamedParameter(program, "sampler_noise_hq"));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -121,7 +121,12 @@ private:
|
||||
|
||||
std::string cgTemplate;
|
||||
|
||||
unsigned int noise_texture;
|
||||
unsigned int noise_texture_lq_lite;
|
||||
unsigned int noise_texture_lq;
|
||||
unsigned int noise_texture_mq;
|
||||
unsigned int noise_texture_hq;
|
||||
unsigned int noise_texture_lq_vol;
|
||||
unsigned int noise_texture_hq_vol;
|
||||
|
||||
bool warpShadersEnabled;
|
||||
bool compositeShadersEnabled;
|
||||
|
||||
@ -25,12 +25,11 @@ sampler2D sampler_main;
|
||||
#define sampler_fw_main sampler_main
|
||||
#define sampler_fc_main sampler_main
|
||||
|
||||
#define sampler_noise_lq sampler_main
|
||||
#define sampler_noise_lq_lite sampler_main
|
||||
#define sampler_noise_mq sampler_main
|
||||
#define sampler_noise_hq sampler_main
|
||||
#define sampler_noisevol_lq sampler_main
|
||||
#define sampler_noisevol_hq sampler_main
|
||||
|
||||
|
||||
#define sampler_noise_mq sampler_noise_hq
|
||||
#define sampler_noisevol_lq sampler_noise_lq
|
||||
#define sampler_noisevol_hq sampler_noise_lq
|
||||
#define texsize_noise_lq texsize
|
||||
#define texsize_noise_lq_lite texsize
|
||||
#define texsize_noise_mq texsize
|
||||
@ -57,6 +56,9 @@ return ret * 0.2;
|
||||
|
||||
outtype projectm (float2 uv : TEXCOORD0,
|
||||
uniform sampler2D sampler_arg : TEX0,
|
||||
uniform sampler2D sampler_noise_lq,
|
||||
uniform sampler2D sampler_noise_lq_lite,
|
||||
uniform sampler2D sampler_noise_hq,
|
||||
uniform float time,
|
||||
uniform float4 rand_preset,
|
||||
uniform float4 rand_frame,
|
||||
|
||||
@ -852,7 +852,7 @@ void projectM::switchPreset(std::auto_ptr<Preset> & targetPreset, PresetInputs &
|
||||
|
||||
// Set preset name here- event is not done because at the moment this function is oblivious to smooth/hard switches
|
||||
renderer->setPresetName ( targetPreset->presetName() );
|
||||
|
||||
renderer->SetPipeline(outputs);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user