From be1b80365652fc47bae22ef3ee25a6415266e34c Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Tue, 7 May 2013 10:41:39 -0700 Subject: [PATCH] Noise Test function, adjust chat position --- interface/src/Avatar.cpp | 4 ++-- interface/src/Util.cpp | 23 +++++++++++++++++++++++ interface/src/Util.h | 2 ++ interface/src/main.cpp | 2 ++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/interface/src/Avatar.cpp b/interface/src/Avatar.cpp index b658096ea8..1983de906a 100644 --- a/interface/src/Avatar.cpp +++ b/interface/src/Avatar.cpp @@ -62,8 +62,8 @@ bool usingBigSphereCollisionTest = true; char iris_texture_file[] = "resources/images/green_eye.png"; -float chatMessageScale = 0.001; -float chatMessageHeight = 0.4; +float chatMessageScale = 0.0015; +float chatMessageHeight = 0.45; vector iris_texture; unsigned int iris_texture_width = 512; diff --git a/interface/src/Util.cpp b/interface/src/Util.cpp index e70aabcd2a..58cf1f61ad 100644 --- a/interface/src/Util.cpp +++ b/interface/src/Util.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -112,6 +113,28 @@ void drawVector(glm::vec3 * vector) { } +// Render a 2D set of squares using perlin/fractal noise +void noiseTest(int w, int h) { + const float CELLS = 100; + float xStep = (float) w / CELLS; + float yStep = (float) h / CELLS; + glBegin(GL_QUADS); + for (float x = 0; x < (float)w; x += xStep) { + for (float y = 0; y < (float)h; y += yStep) { + // Generate a vector varying between 0-1 corresponding to the screen location + glm::vec2 position(x / (float) w, y / (float) h); + // Set the cell color using the noise value at that location + float color = glm::simplex(position); + glColor4f(color, color, color, 1.0); + glVertex2f(x, y); + glVertex2f(x + xStep, y); + glVertex2f(x + xStep, y + yStep); + glVertex2f(x, y + yStep); + } + } + glEnd(); +} + void render_world_box() { // Show edge of world glDisable(GL_LIGHTING); diff --git a/interface/src/Util.h b/interface/src/Util.h index b81edd8c87..d4a6ba6b03 100644 --- a/interface/src/Util.h +++ b/interface/src/Util.h @@ -40,6 +40,8 @@ void drawtext(int x, int y, float scale, float rotate, float thick, int mono, void drawvec3(int x, int y, float scale, float rotate, float thick, int mono, glm::vec3 vec, float r=1.0, float g=1.0, float b=1.0); +void noiseTest(int w, int h); + void drawVector(glm::vec3* vector); float angleBetween(glm::vec3 * v1, glm::vec3 * v2); diff --git a/interface/src/main.cpp b/interface/src/main.cpp index a4ef86024b..a341835206 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -893,6 +893,8 @@ void displayOverlay() { audioScope.render(); #endif + // noiseTest(WIDTH, HEIGHT); + if (displayHeadMouse && !::lookingInMirror && statsOn) { // Display small target box at center or head mouse target that can also be used to measure LOD glColor3f(1.0, 1.0, 1.0);