Sfoglia il codice sorgente

base: roll our own constants because it’s always a pain in the ass

to get M_PI from the platform headers and cast it to float.
master
Sam Hocevar 11 anni fa
parent
commit
a133d36dfc
4 ha cambiato i file con 12 aggiunte e 54 eliminazioni
  1. +0
    -15
      neercs/neercs.cpp
  2. +3
    -12
      neercs/old/wm.cpp
  3. +4
    -13
      neercs/term/term.cpp
  4. +5
    -14
      neercs/video/render.cpp

+ 0
- 15
neercs/neercs.cpp Vedi File

@@ -8,21 +8,6 @@
# include "config.h"
#endif

#if defined _XBOX
# define _USE_MATH_DEFINES /* for M_PI */
# include <xtl.h>
# undef near /* Fuck Microsoft */
# undef far /* Fuck Microsoft again */
#elif defined _WIN32
# define _USE_MATH_DEFINES /* for M_PI */
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# undef near /* Fuck Microsoft */
# undef far /* Fuck Microsoft again */
#else
# include <cmath>
#endif

#include <time.h>
#include <caca.h>



+ 3
- 12
neercs/old/wm.cpp Vedi File

@@ -15,17 +15,6 @@
# include "config.h"
#endif

#if defined _XBOX
# define _USE_MATH_DEFINES /* for M_PI */
# include <xtl.h>
# undef near /* Fuck Microsoft */
# undef far /* Fuck Microsoft again */
#elif defined _WIN32
# define _USE_MATH_DEFINES /* for M_PI */
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@@ -33,6 +22,8 @@

#include "core.h"

using namespace lol;

extern "C" {
#include "neercs.h"
}
@@ -458,7 +449,7 @@ void wm_refresh_cube(struct screen_list *screen_list)
float angle =
90.0f * ((float)cur_time / (float)screen_list->cube.duration);

angle *= (M_PI / 180.0f);
angle *= (F_PI / 180.0f);

if (screen_list->cube.side == 1)
angle = -angle;


+ 4
- 13
neercs/term/term.cpp Vedi File

@@ -6,15 +6,6 @@
# include "config.h"
#endif

#if defined _XBOX
# define _USE_MATH_DEFINES /* for M_PI */
# include <xtl.h>
#elif defined _WIN32
# define _USE_MATH_DEFINES /* for M_PI */
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif

#include "core.h"

using namespace std;
@@ -207,8 +198,8 @@ void Term::DrawFancyShit()
caca_set_color_argb(m_caca, 0x0f0, bg_color);
for(int i = 0; i < h; i++)
{
float a = M_PI / 180 * i * 16 + m_time * 4;
float b = M_PI / 180 * i * 12;
float a = F_PI / 180 * i * 16 + m_time * 4;
float b = F_PI / 180 * i * 12;
int x = w / 2 - 14 + w / 4 * lol::cos(a) + w / 4 * lol::sin(b);
caca_put_str(m_caca, x, i, "LOL WUT! NEERCS SI TEH RULEZ");
}
@@ -216,8 +207,8 @@ void Term::DrawFancyShit()
caca_set_color_argb(m_caca, 0x444, bg_color);
for(int i = 0; i < w; i++)
{
float a = m_time * 1 + M_PI / 180 * i * 8;
float b = m_time * -2 + M_PI / 180 * i * 5;
float a = m_time * 1 + F_PI / 180 * i * 8;
float b = m_time * -2 + F_PI / 180 * i * 5;
int y = h / 2 + h / 4 * lol::cos(a) + h / 4 * lol::sin(b);
caca_set_color_argb(m_caca, hex_color(0.25f + 0.5f / w * i - 0.25f / h * y, 0.25f, 0.25f + 0.25f / w * i + 0.25f / h * y), bg_color);
caca_draw_line(m_caca, i, y - 1, i, y + 1,'%');


+ 5
- 14
neercs/video/render.cpp Vedi File

@@ -6,15 +6,6 @@
# include "config.h"
#endif

#if defined _XBOX
# define _USE_MATH_DEFINES /* for M_PI */
# include <xtl.h>
#elif defined _WIN32
# define _USE_MATH_DEFINES /* for M_PI */
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif

#include <cmath>
#include <cstdio>
#include <cstdlib>
@@ -44,7 +35,7 @@ LOLFX_RESOURCE_DECLARE(postfx);
LOLFX_RESOURCE_DECLARE(mirror);
LOLFX_RESOURCE_DECLARE(radial);

#define PID M_PI/180.0f // pi ratio
#define PID F_PI/180.0f // pi ratio

/*
* Global variable -- ugly (<rez> sam: c'est toi qui est ugly! \:D/)
@@ -1668,10 +1659,10 @@ void Render::Draw3D()
shader_postfx->SetUniform(shader_postfx_gradient_color, postfx_gradient_color);
shader_postfx->SetUniform(shader_postfx_vignetting, postfx_vignetting);
shader_postfx->SetUniform(shader_postfx_aberration, postfx_aberration);
shader_postfx->SetUniform(shader_postfx_moire_h, vec4(postfx_moire_h.xyz, postfx_moire_h.w * (float)(2 * M_PI)));
shader_postfx->SetUniform(shader_postfx_moire_v, vec4(postfx_moire_v.xyz, postfx_moire_v.w * (float)(2 * M_PI)));
shader_postfx->SetUniform(shader_postfx_scanline_h, vec4(postfx_scanline_h.xyz, postfx_scanline_h.w * (float)(2 * M_PI)));
shader_postfx->SetUniform(shader_postfx_scanline_v, vec4(postfx_scanline_v.xyz, postfx_scanline_v.w * (float)(2 * M_PI)));
shader_postfx->SetUniform(shader_postfx_moire_h, vec4(postfx_moire_h.xyz, postfx_moire_h.w * (2 * F_PI)));
shader_postfx->SetUniform(shader_postfx_moire_v, vec4(postfx_moire_v.xyz, postfx_moire_v.w * (2 * F_PI)));
shader_postfx->SetUniform(shader_postfx_scanline_h, vec4(postfx_scanline_h.xyz, postfx_scanline_h.w * (2 * F_PI)));
shader_postfx->SetUniform(shader_postfx_scanline_v, vec4(postfx_scanline_v.xyz, postfx_scanline_v.w * (2 * F_PI)));
shader_postfx->SetUniform(shader_postfx_corner, postfx_corner);
shader_postfx->SetUniform(shader_postfx_sync, (float)fabs(sync_value * cosf((main_angle - sync_angle) * 6.0f)));
shader_postfx->SetUniform(shader_postfx_beat, (float)fabs(beat_value * cosf((main_angle - beat_angle) * 6.0f)));


Caricamento…
Annulla
Salva