Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"array": "cpp",
"deque": "cpp",
"iterator": "cpp",
"stack": "cpp"
"stack": "cpp",
"random": "cpp"
}
}
35 changes: 34 additions & 1 deletion img/init_dark.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,40 @@
1.0,
1.0,
0.0
]
],
"wave3d" :
{
"begin" :
[
0.0,
0.0,
1.0
],
"end" :
[
1.0,
0.0,
0.0
],
"fourth" :
[
1.0,
1.0,
0.0
],
"second" :
[
0.0,
1.0,
1.0
],
"third" :
[
0.0,
1.0,
0.0
]
}
},
"debug" :
[
Expand Down
97 changes: 66 additions & 31 deletions img/init_light.json
Original file line number Diff line number Diff line change
@@ -1,55 +1,90 @@
{
"color" :
{
"background" :
[
1.0,
1.0,
1.0
"rate": 65,
"color": {
"background": [
0.9921,
0.9647,
0.8901
],
"bordor" :
[
"bordor": [
0.1,
0.1,
0.1
],
"grid" :
[
"grid": [
0.3,
0.3,
0.3
],
"icon" :
[
0.6,
0.6,
0.6,
1.0
],
"iconClick" :
[
"icon": [
1.0,
1.0,
1.0,
0.0
],
"text" :
[
"iconClick": [
0.6,
0.6,
0.6,
1.0
],
"text": [
0.1,
0.1,
0.1
],
"trig" :
[
"trig": [
1.0,
0.0,
0.0
],
"wave" :
[
0.95,
0.65,
0.136
]
}
"wave": [
0.1921,
0.4196,
0.8039
],
"wave3d" :
{
"begin" :
[
1.0,
1.0,
0.0
],
"second" :
[
0.0,
1.0,
0.0
],
"third" :
[
0.0,
1.0,
1.0
],
"fourth" :
[
0.0,
0.0,
1.0
],
"end" :
[
1.0,
0.0,
1.0
]
}
},
"scroll": 1,
"auto": [
6,
3
],
"debug": [
1200,
200,
6
]
}
5 changes: 4 additions & 1 deletion include/draw_background.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class BackgroundRender
Shader dashedShader;
TextRenderer valueText;
Texture2D iconTexture;
InputBox volBox, timeBox;
InputBox volBox, timeBox, gradeBox;
BackgroundRender() {}
void BackgroundRenderInit(float scrWidth, float scrHeight);
void drawBackground(float xStep, float yScale, float offset, float trigLevel);
Expand All @@ -35,6 +35,9 @@ class BackgroundRender
bool ifTrig;
bool ifOverSampling;
bool ifTrigAverage;
bool ifThreeDim;
bool ifMultiColor;
int maxColorGrade;
glm::vec3 borderColor;
glm::vec3 gridColor;
glm::vec3 trigLineColor;
Expand Down
3 changes: 2 additions & 1 deletion include/input_box.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define INPUT_BOX_H

#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
Expand All @@ -20,7 +21,7 @@ class InputBox
void InputBoxInit();
void setPosition(float scrW, float scrH, float posX, float posY, float posW, float posH);
void RenderInputBox();
void TypeInCharacter(char key);
void TypeIn(int key);
float getInputValue();
void exitInputBox();

Expand Down
34 changes: 34 additions & 0 deletions include/three_dim_wave_renderer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#ifndef THREE_DIM_WAVE_RENDERER_H
#define THREE_DIM_WAVE_RENDERER_H

#include <glad/glad.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>

#include "shader.h"

class ThreeDimWaveRenderer
{
public:
Shader SingleColorWaveShader;
Shader MultiColorWaveShader;
ThreeDimWaveRenderer() {}
void WaveRenderInit();
void SetWaveAttribute(GLuint viewSize, float dataMin, float dataMax);
void SetBackgroundColor(glm::vec3 backgroundColor);
void SetColorGrade(int maxColorGrade);
void SetColorAttribute(glm::vec3 beginColor, glm::vec3 endColor);
void SetColorAttribute(glm::vec3 beginColor, glm::vec3 secondColor, glm::vec3 thirdColor,
glm::vec3 fourthColor, glm::vec3 endColor);
void ResetWaveData(float *waveFormData, unsigned int size);
void RenderWave(glm::vec2 offset, float xStep, float yScale, bool ifMultiColor);

private:
// Render state
GLuint VAO, VBO, EBO;
GLuint dataSize, viewSize; //横轴分viewSize格
float dataMin, dataMax;
};

#endif
37 changes: 35 additions & 2 deletions init.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,40 @@
0.1921,
0.4196,
0.8039
]
],
"wave3d" :
{
"begin" :
[
1.0,
1.0,
0.0
],
"second" :
[
0.0,
1.0,
0.0
],
"third" :
[
0.0,
1.0,
1.0
],
"fourth" :
[
0.0,
0.0,
1.0
],
"end" :
[
1.0,
0.0,
1.0
]
}
},
"scroll": 1,
"auto": [
Expand All @@ -52,6 +85,6 @@
"debug": [
1200,
200,
60
6
]
}
Loading