fix
This commit is contained in:
18
src/main.cpp
18
src/main.cpp
@ -27,6 +27,8 @@
|
||||
#endif
|
||||
|
||||
#include "glext.h"
|
||||
#include "fft.h"
|
||||
|
||||
#pragma data_seg(".shader")
|
||||
#include "shaders/fragment.inl"
|
||||
#if POST_PASS
|
||||
@ -34,18 +36,12 @@
|
||||
#include "shaders/post.inl"
|
||||
#endif
|
||||
|
||||
#include "fft.h"
|
||||
|
||||
|
||||
#pragma data_seg(".pids")
|
||||
// static allocation saves a few bytes
|
||||
static int pidMain;
|
||||
static int pidPost;
|
||||
// static HDC hDC;
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef EDITOR_CONTROLS
|
||||
#pragma code_seg(".main")
|
||||
// FFT buffers
|
||||
@ -234,11 +230,11 @@ int __cdecl main(int argc, char* argv[])
|
||||
// Normalize output
|
||||
for (int i = 0; i < (FFT_SIZE / 4); i++)
|
||||
{
|
||||
float gain = 0.025f;
|
||||
float alpha = 0.15f; // "Hidastaa" FFT:n piikkejä
|
||||
float threshhold = 0.015f; // Alin arvo mik<69> p<><70>stet<65><74>n shaderille (v<>hent<6E><74> "noisea")
|
||||
float magnitude = sqrt(signal[i].re * signal[i].re + signal[i].im * signal[i].im);
|
||||
|
||||
float gain = 0.05f;
|
||||
float alpha = 0.10f; // "Hidastaa" FFT:n piikkejä
|
||||
float threshhold = 0.00015f; // Alin arvo mik<69> p<><70>stet<65><74>n shaderille (v<>hent<6E><74> "noisea")
|
||||
// float magnitude = sqrt(signal[i].re * signal[i].re + signal[i].im * signal[i].im); // signal strength
|
||||
float magnitude = (float)signal[i].re;
|
||||
float x_t = (magnitude < threshhold) ? 0.f : magnitude * gain;
|
||||
// Exponential smoothing kaava
|
||||
// s(t) = alpha*x(t)+(1-alpha)*s(t-1)
|
||||
|
||||
@ -117,9 +117,9 @@ vec2 mapScene(in vec3 p) {
|
||||
float res = p.y;
|
||||
float mat = 0.;
|
||||
|
||||
float hexRadius = 0.85;
|
||||
float hexRadius = 0.83;
|
||||
vec3 hexpos = vec3(p.x, p.y - 2.5, p.z);
|
||||
HexData hex = hexTile(hexpos, 1.5);
|
||||
HexData hex = hexTile(hexpos, 1.1);
|
||||
|
||||
float distFromCenter = hexDistance(hex.axial);
|
||||
int fftIndex = int(clamp(distFromCenter + 1.0, 0.0, 511.0));
|
||||
@ -264,7 +264,7 @@ vec3 applyFog(vec3 col, float t, vec3 rd, vec3 lightDir, float fogAmount) {
|
||||
float syncsBass = clamp((syncs[1] + syncs[2] + syncs[3]), 0., 1.);
|
||||
|
||||
float fogAmount2 = 1.0 - exp(-t * fogAmount);
|
||||
float sunAmount = max(dot(rd, lightDir), 0.0);
|
||||
float sunAmount = max(dot(rd, lightDir), 1.0);
|
||||
// highlight color
|
||||
vec3 fogColor = mix(vec3(0.2706, 0.2706, 0.2863), vec3(0.2314, 0.2314, 0.2314), // Main color
|
||||
pow(sunAmount, syncsBass * 1.0));
|
||||
|
||||
Reference in New Issue
Block a user