mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 01:00:25 +00:00
fixed some guards (in progress)
This commit is contained in:
parent
cbd0c1f934
commit
89585f004b
@ -110,6 +110,7 @@ void geometry_information::shift_shape_orthogonally(hpcshape& sh, ld z) {
|
||||
extern renderbuffer *floor_textures;
|
||||
|
||||
void geometry_information::add_texture(hpcshape& sh) {
|
||||
#if CAP_GL
|
||||
if(!floor_textures) return;
|
||||
auto& utt = models_texture;
|
||||
sh.tinf = &utt;
|
||||
@ -121,6 +122,7 @@ void geometry_information::add_texture(hpcshape& sh) {
|
||||
ld factor = 0.50 + (0.17 * h[2] + 0.13 * h[1] + 0.15 * h[0]) / rad;
|
||||
utt.tvertices.push_back(glhr::makevertex(0, factor, 0));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
vector<hyperpoint> scaleshape(const vector<hyperpoint>& vh, ld s) {
|
||||
@ -834,12 +836,14 @@ void geometry_information::make_3d_models() {
|
||||
eyepos = WDIM == 2 ? 0.875 : 0.925;
|
||||
DEBBI(DF_POLY, ("make_3d_models"));
|
||||
shcenter = C0;
|
||||
|
||||
|
||||
#if CAP_GL
|
||||
if(floor_textures) {
|
||||
auto& utt = models_texture;
|
||||
utt.tvertices.clear();
|
||||
utt.texture_id = floor_textures->renderedTexture;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(WDIM == 2) {
|
||||
DEBB(DF_POLY, ("shadows"));
|
||||
|
@ -216,6 +216,12 @@ EX color_t darkena(color_t c, int lev, int a) {
|
||||
void setcameraangle(bool b) { }
|
||||
#endif
|
||||
|
||||
#if !CAP_GL
|
||||
EX void reset_projection() { }
|
||||
EX void glflush() { }
|
||||
EX bool model_needs_depth() { return false; }
|
||||
#endif
|
||||
|
||||
#if CAP_GL
|
||||
|
||||
#if CAP_VR
|
||||
@ -1034,7 +1040,7 @@ EX void do_setfsize() {
|
||||
}
|
||||
|
||||
EX void disable_vsync() {
|
||||
#if !ISMOBWEB
|
||||
#if CAP_SDL && CAP_GL && !ISMOBWEB
|
||||
SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 0 );
|
||||
#endif
|
||||
}
|
||||
|
@ -154,7 +154,9 @@ int arg::readCommon() {
|
||||
else if(argis("-rsrc")) { PHASE(1); shift(); rsrcdir = args(); }
|
||||
else if(argis("-nogui")) { PHASE(1); noGUI = true; }
|
||||
#ifndef EMSCRIPTEN
|
||||
#if CAP_SDL
|
||||
else if(argis("-font")) { PHASE(1); shift(); fontpath = args(); }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
else if(argis("-test"))
|
||||
|
@ -910,7 +910,9 @@ string solhelp() {
|
||||
}
|
||||
|
||||
EX void edit_sightrange() {
|
||||
#if CAP_RUG
|
||||
USING_NATIVE_GEOMETRY_IN_RUG;
|
||||
#endif
|
||||
if(vid.use_smart_range) {
|
||||
ld& det = WDIM == 2 ? vid.smart_range_detail : vid.smart_range_detail_3;
|
||||
dialog::editNumber(det, 1, 50, 1, WDIM == 2 ? 8 : 30, XLAT("minimum visible cell in pixels"), "");
|
||||
@ -2403,8 +2405,10 @@ EX int read_config_args() {
|
||||
|
||||
// non-configurable options
|
||||
else if(argis("-vsync_off")) {
|
||||
#if CAP_SDL && CAP_GL
|
||||
vsync_off = true;
|
||||
if(curphase == 3) setvideomode();
|
||||
#endif
|
||||
}
|
||||
else if(argis("-aura")) {
|
||||
PHASEFROM(2);
|
||||
|
@ -342,7 +342,7 @@ EX void full_rotate_camera(int dir, ld val) {
|
||||
history::lvspeed += (dir?1:-1) * val / 2;
|
||||
else if(GDIM == 3 && rshiftclick)
|
||||
shift_view(ctangent(dir, -val)), didsomething = true, playermoved = false; /* -val because shift reverses */
|
||||
#if CAP_CRYSTAL
|
||||
#if CAP_CRYSTAL && CAP_RUG
|
||||
else if(rug::rug_control() && rug::in_crystal())
|
||||
crystal::apply_rotation(cspin(dir, 2, val));
|
||||
#endif
|
||||
@ -385,7 +385,9 @@ EX void handlePanning(int sym, int uni) {
|
||||
if(sym == PSEUDOKEY_WHEELDOWN) shift_view(ztangent(0.05*shiftmul)), didsomething = true, playermoved = false;
|
||||
}
|
||||
|
||||
#if CAP_RUG
|
||||
rug::using_rugview urv;
|
||||
#endif
|
||||
|
||||
#if !ISPANDORA
|
||||
if(!smooth_scrolling) {
|
||||
|
@ -1182,6 +1182,7 @@ EX void flip_z() {
|
||||
crug_rotation[i][2] *= -1;
|
||||
}
|
||||
|
||||
#if CAP_RUG
|
||||
hyperpoint coord_to_flat(ldcoord co, int dim = 3) {
|
||||
auto& cs = crystal_map()->cs;
|
||||
hyperpoint res = Hypc;
|
||||
@ -1314,6 +1315,7 @@ EX void build_rugdata() {
|
||||
|
||||
println(hlog, "cut ", cut_level, "r ", crug_rotation);
|
||||
}
|
||||
#endif
|
||||
|
||||
EX void set_land(cell *c) {
|
||||
setland(c, specialland);
|
||||
@ -1481,6 +1483,7 @@ EX void show() {
|
||||
dialog::editNumber(compass_probability, 0, 1, 0.1, 1, XLAT("compass probability"), compass_help());
|
||||
dialog::bound_low(0);
|
||||
});
|
||||
#if CAP_RUG
|
||||
if(cryst && WDIM == 2) {
|
||||
dialog::addBoolItem(XLAT("3D display"), rug::rugged, 'r');
|
||||
dialog::add_action_push(rug::show);
|
||||
@ -1499,6 +1502,7 @@ EX void show() {
|
||||
});
|
||||
}
|
||||
else dialog::addBreak(100);
|
||||
#endif
|
||||
dialog::addSelItem(XLAT("Crystal torus"), its(crystal_period), 'C');
|
||||
dialog::add_action([] {
|
||||
dialog::editNumber(crystal_period, 0, 16, 2, 0, XLAT("Crystal torus"),
|
||||
|
@ -858,7 +858,9 @@ int read_cheat_args() {
|
||||
shift(); steplimit = argi();
|
||||
}
|
||||
else if(argis("-dgl")) {
|
||||
#if CAP_GL
|
||||
glhr::debug_gl = true;
|
||||
#endif
|
||||
}
|
||||
else if(argis("-mgen-off")) {
|
||||
PHASEFROM(3);
|
||||
|
17
drawing.cpp
17
drawing.cpp
@ -240,7 +240,7 @@ EX void glflush() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !ISMOBILE
|
||||
#if CAP_SDL && !ISMOBILE
|
||||
SDL_Surface *aux;
|
||||
#endif
|
||||
|
||||
@ -743,7 +743,9 @@ EX void set_width(ld w) {
|
||||
#if MINIMIZE_GL_CALLS
|
||||
if(w != glhr::current_linewidth) glflush();
|
||||
#endif
|
||||
#if CAP_GL
|
||||
glhr::set_linewidth(w);
|
||||
#endif
|
||||
}
|
||||
|
||||
// this part makes cylindrical projections on the sphere work
|
||||
@ -1400,10 +1402,12 @@ void dqi_poly::draw() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CAP_GL
|
||||
if(in_s2xe() && vid.usingGL && pmodel == mdPerspective && (current_display->set_all(global_projection), (get_shader_flags() & SF_DIRECT))) {
|
||||
s2xe::draw_s2xe(this);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
dynamicval<ld> bs(hr::band_shift, band_shift);
|
||||
if(!hyperbolic && among(pmodel, mdPolygonal, mdPolynomial)) {
|
||||
@ -1990,6 +1994,7 @@ EX void draw_main() {
|
||||
if(stretch::factor) return;
|
||||
}
|
||||
|
||||
#if CAP_GL
|
||||
for(int p: {1, 0, 2, 3}) {
|
||||
if(elliptic && p < 2) continue;
|
||||
glhr::set_depthwrite(true);
|
||||
@ -2021,6 +2026,7 @@ EX void draw_main() {
|
||||
}
|
||||
// glflush();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
DEBB(DF_GRAPH, ("draw_main1"));
|
||||
@ -2043,6 +2049,7 @@ EX void draw_main() {
|
||||
}
|
||||
glflush();
|
||||
|
||||
#if CAP_RAY
|
||||
if(ray::in_use && ray::comparison_mode) {
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
#ifdef GLES_ONLY
|
||||
@ -2053,6 +2060,7 @@ EX void draw_main() {
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
ray::cast();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -2136,15 +2144,20 @@ EX void drawqueue() {
|
||||
#if CAP_VR
|
||||
if(callhandlers(false, hooks_vr)) {} else
|
||||
#endif
|
||||
#if CAP_GL
|
||||
if(model_needs_depth() && current_display->stereo_active()) {
|
||||
global_projection = -1;
|
||||
draw_main();
|
||||
#if CAP_GL
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
#endif
|
||||
global_projection = +1;
|
||||
draw_main();
|
||||
global_projection = 0;
|
||||
}
|
||||
else {
|
||||
else
|
||||
#endif
|
||||
{
|
||||
draw_main();
|
||||
}
|
||||
|
||||
|
@ -1012,7 +1012,13 @@ auto floor_hook =
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
#if MAXMDIM < 4 || !CAP_GL
|
||||
EX void ensure_vertex_number(basic_textureinfo& bti, int qty) {}
|
||||
EX void ensure_vertex_number(hpcshape& sh) {}
|
||||
EX void bind_floor_texture(hpcshape& li, int id) {}
|
||||
#endif
|
||||
|
||||
#if MAXMDIM >= 4 && CAP_GL
|
||||
|
||||
EX ld floor_texture_square_size;
|
||||
|
||||
|
@ -902,7 +902,9 @@ EX void apply_always3() {
|
||||
#if MAXMDIM >= 4
|
||||
EX void switch_always3() {
|
||||
if(dual::split(switch_always3)) return;
|
||||
#if CAP_GL
|
||||
if(rug::rugged) rug::close();
|
||||
#endif
|
||||
vid.always3 = !vid.always3;
|
||||
apply_always3();
|
||||
swapmatrix(View);
|
||||
@ -933,7 +935,9 @@ EX void switch_always3() {
|
||||
|
||||
EX void switch_fpp() {
|
||||
#if MAXMDIM >= 4
|
||||
#if CAP_GL
|
||||
if(rug::rugged) rug::close();
|
||||
#endif
|
||||
if(dual::split(switch_fpp)) return;
|
||||
check_cgi(); cgi.require_basics();
|
||||
View = inverse(models::rotmatrix()) * View;
|
||||
|
67
glhr.cpp
67
glhr.cpp
@ -11,6 +11,41 @@
|
||||
#include "hyper.h"
|
||||
namespace hr {
|
||||
|
||||
EX namespace glhr {
|
||||
EX glvertex pointtogl(const hyperpoint& t) {
|
||||
glvertex h;
|
||||
h[0] = t[0]; h[1] = t[1]; h[2] = t[2];
|
||||
if(SHDIM == 4) h[3] = (MDIM == 4) ? t[3] : 1;
|
||||
return h;
|
||||
}
|
||||
|
||||
EX hyperpoint gltopoint(const glvertex& t) {
|
||||
hyperpoint h;
|
||||
h[0] = t[0]; h[1] = t[1]; h[2] = t[2];
|
||||
if(SHDIM == 4 && MAXMDIM == 4) h[3] = t[3];
|
||||
return h;
|
||||
}
|
||||
|
||||
#if CAP_SHADER
|
||||
EX bool noshaders = false;
|
||||
#endif
|
||||
#if !CAP_SHADER
|
||||
EX bool noshaders = true;
|
||||
#endif
|
||||
|
||||
#if HDR
|
||||
inline glvertex makevertex(GLfloat x, GLfloat y, GLfloat z) {
|
||||
#if SHDIM == 3
|
||||
return make_array(x, y, z);
|
||||
#else
|
||||
return make_array<GLfloat>(x, y, z, 1);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
EX }
|
||||
|
||||
#if CAP_GL
|
||||
#ifndef DEBUG_GL
|
||||
#define DEBUG_GL 0
|
||||
#endif
|
||||
@ -55,16 +90,6 @@ struct glmatrix {
|
||||
const array<float, 16>& as_stdarray() const { return *(array<float, 16>*)this; }
|
||||
};
|
||||
|
||||
glvertex pointtogl(const hyperpoint& t);
|
||||
|
||||
inline glvertex makevertex(GLfloat x, GLfloat y, GLfloat z) {
|
||||
#if SHDIM == 3
|
||||
return make_array(x, y, z);
|
||||
#else
|
||||
return make_array<GLfloat>(x, y, z, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
struct colored_vertex {
|
||||
glvertex coords;
|
||||
glvec4 color;
|
||||
@ -105,12 +130,6 @@ glvertex pointtogl(const hyperpoint& t);
|
||||
|
||||
#endif
|
||||
|
||||
#if CAP_SHADER
|
||||
EX bool noshaders = false;
|
||||
#else
|
||||
EX bool noshaders = true;
|
||||
#endif
|
||||
|
||||
bool glew = false;
|
||||
|
||||
bool current_depthtest, current_depthwrite;
|
||||
@ -647,20 +666,6 @@ void init() {
|
||||
#endif
|
||||
}
|
||||
|
||||
EX hyperpoint gltopoint(const glvertex& t) {
|
||||
hyperpoint h;
|
||||
h[0] = t[0]; h[1] = t[1]; h[2] = t[2];
|
||||
if(SHDIM == 4 && MAXMDIM == 4) h[3] = t[3];
|
||||
return h;
|
||||
}
|
||||
|
||||
EX glvertex pointtogl(const hyperpoint& t) {
|
||||
glvertex h;
|
||||
h[0] = t[0]; h[1] = t[1]; h[2] = t[2];
|
||||
if(SHDIM == 4) h[3] = (MDIM == 4) ? t[3] : 1;
|
||||
return h;
|
||||
}
|
||||
|
||||
#if CAP_VERTEXBUFFER
|
||||
template<class T> void bindbuffer(T& v) {
|
||||
if(current_vertices == buffered_vertices || current_vertices == nullptr) {
|
||||
@ -839,7 +844,7 @@ EX void oldvertices(GLfloat *f, int qty) {
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#define glMatrixMode DISABLED
|
||||
|
@ -2943,9 +2943,11 @@ void sumaura(int v) {
|
||||
aurac[AURA][v] = aurac[0][v];
|
||||
}
|
||||
|
||||
#if CAP_GL
|
||||
vector<glhr::colored_vertex> auravertices;
|
||||
#endif
|
||||
|
||||
void drawaura() {
|
||||
EX void drawaura() {
|
||||
DEBBI(DF_GRAPH, ("draw aura"));
|
||||
if(!haveaura()) return;
|
||||
if(vid.stereo_mode) return;
|
||||
|
@ -227,7 +227,7 @@ template<class... T> void print(hstream& hs, const tuple<T...> & t) {
|
||||
inline void special_log(char c) { if(debugfile) fputc(c, debugfile); putchar(c); }
|
||||
#endif
|
||||
|
||||
#if !CAP_SDL && !ISFAKEMOBILE
|
||||
#if !CAP_SDL && CAP_TIMEOFDAY
|
||||
int SDL_GetTicks();
|
||||
#endif
|
||||
|
||||
|
4
hyper.h
4
hyper.h
@ -687,7 +687,11 @@ enum orbAction { roMouse, roKeyboard, roCheck, roMouseForce, roMultiCheck, roMul
|
||||
#define MODELCOUNT ((int) mdGUARD)
|
||||
|
||||
#define pconf vid.projection_config
|
||||
#if CAP_RUG
|
||||
#define vpconf (rug::rugged ? vid.rug_config : vid.projection_config)
|
||||
#else
|
||||
#define vpconf pconf
|
||||
#endif
|
||||
#define pmodel (pconf.model)
|
||||
|
||||
color_t darkena(color_t c, int lev, int a);
|
||||
|
@ -33,7 +33,11 @@ EX bool non_spatial_model() {
|
||||
return true;
|
||||
if(pmodel == mdSpiral && euclid)
|
||||
return true;
|
||||
#if CAP_GL
|
||||
return pmodel && vid.consider_shader_projection && (get_shader_flags() & SF_DIRECT);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
EX hyperpoint perspective_to_space(hyperpoint h, ld alpha IS(pconf.alpha), eGeometryClass gc IS(ginf[geometry].cclass)) {
|
||||
@ -1345,7 +1349,7 @@ EX void centerpc(ld aspd) {
|
||||
if(subscreens::split([=] () {centerpc(aspd);})) return;
|
||||
if(dual::split([=] () { centerpc(aspd); })) return;
|
||||
|
||||
#if CAP_CRYSTAL
|
||||
#if CAP_CRYSTAL && CAP_RUG
|
||||
if(cryst)
|
||||
crystal::centerrug(aspd);
|
||||
#endif
|
||||
@ -1555,7 +1559,9 @@ EX eModel flat_model() { return MDIM == 4 ? mdPixel : mdDisk; }
|
||||
|
||||
/** \brief enable the 'flat' model for drawing HUD. See hr::flat_model_enabler */
|
||||
EX void enable_flat_model() {
|
||||
#if CAP_GL
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
#endif
|
||||
pmodel = flat_model();
|
||||
pconf.alpha = 1;
|
||||
pconf.scale = 1;
|
||||
|
@ -1607,7 +1607,6 @@ namespace mapeditor {
|
||||
|
||||
void drawHandleKey(int sym, int uni);
|
||||
|
||||
#if CAP_TEXTURE
|
||||
static ld brush_sizes[10] = {
|
||||
0.001, 0.002, 0.005, 0.0075, 0.01, 0.015, 0.02, 0.05, 0.075, 0.1};
|
||||
|
||||
@ -1626,7 +1625,6 @@ namespace mapeditor {
|
||||
0x404040FF,
|
||||
0x804000FF
|
||||
};
|
||||
#endif
|
||||
|
||||
bool area_in_pi = false;
|
||||
|
||||
@ -2367,11 +2365,13 @@ namespace mapeditor {
|
||||
else if(mousekey == 'l' || mousekey == 'c') {
|
||||
if(!holdmouse) lstart = mouseh, lstartcell = mouseover, holdmouse = true;
|
||||
}
|
||||
#if CAP_TEXTURE
|
||||
else if(intexture) {
|
||||
if(!holdmouse) texture::config.data.undoLock();
|
||||
texture::drawPixel(mouseover, mouseh, tcolor);
|
||||
holdmouse = true; lstartcell = NULL;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
dt_add_free(mouseh);
|
||||
holdmouse = true;
|
||||
@ -2380,6 +2380,7 @@ namespace mapeditor {
|
||||
|
||||
if(sym == PSEUDOKEY_RELEASE) {
|
||||
printf("release\n");
|
||||
#if CAP_TEXTURE
|
||||
if(mousekey == 'l' && intexture) {
|
||||
texture::config.data.undoLock();
|
||||
texture::where = mouseover;
|
||||
@ -2387,10 +2388,13 @@ namespace mapeditor {
|
||||
texture::drawLine(mouseh, lstart, tcolor);
|
||||
lstartcell = NULL;
|
||||
}
|
||||
else if(mousekey == 'l') {
|
||||
else
|
||||
#endif
|
||||
if(mousekey == 'l') {
|
||||
dt_add_line(mouseh, lstart, 10);
|
||||
lstartcell = NULL;
|
||||
}
|
||||
#if CAP_TEXTURE
|
||||
else if(mousekey == 'c' && intexture) {
|
||||
texture::config.data.undoLock();
|
||||
ld rad = hdist(lstart, mouseh);
|
||||
@ -2402,6 +2406,7 @@ namespace mapeditor {
|
||||
texture::drawPixel(T * xspinpush0(2 * M_PI * i / circp, rad), tcolor);
|
||||
lstartcell = NULL;
|
||||
}
|
||||
#endif
|
||||
else if(mousekey == 'c') {
|
||||
dt_add_circle(lstart, mouseh);
|
||||
lstartcell = NULL;
|
||||
@ -2418,12 +2423,14 @@ namespace mapeditor {
|
||||
if(uni >= 2000 && uni < 2010)
|
||||
dtwidth = brush_sizes[uni - 2000];
|
||||
|
||||
#if CAP_TEXTURE
|
||||
if(uni == '0')
|
||||
texture::texturesym = !texture::texturesym;
|
||||
|
||||
if(uni == 'u') {
|
||||
texture::config.data.undo();
|
||||
}
|
||||
#endif
|
||||
|
||||
if(uni == 'p') {
|
||||
if(!clickused)
|
||||
|
@ -343,7 +343,9 @@ EX namespace models {
|
||||
cmode = sm::SIDE | sm::MAYDARK | sm::CENTER;
|
||||
gamescreen(0);
|
||||
dialog::init(XLAT("models & projections"));
|
||||
#if CAP_RUG
|
||||
USING_NATIVE_GEOMETRY_IN_RUG;
|
||||
#endif
|
||||
|
||||
for(int i=0; i<mdGUARD; i++) {
|
||||
eModel m = eModel(i);
|
||||
@ -399,7 +401,9 @@ EX namespace models {
|
||||
EX void model_menu() {
|
||||
cmode = sm::SIDE | sm::MAYDARK | sm::CENTER;
|
||||
gamescreen(0);
|
||||
#if CAP_RUG
|
||||
USING_NATIVE_GEOMETRY_IN_RUG;
|
||||
#endif
|
||||
dialog::init(XLAT("models & projections"));
|
||||
|
||||
auto vpmodel = vpconf.model;
|
||||
@ -660,6 +664,7 @@ EX namespace models {
|
||||
});
|
||||
}
|
||||
|
||||
#if CAP_GL
|
||||
dialog::addBoolItem(XLAT("use GPU to compute projections"), vid.consider_shader_projection, 'G');
|
||||
bool shaderside_projection = get_shader_flags() & SF_DIRECT;
|
||||
if(vid.consider_shader_projection && !shaderside_projection)
|
||||
@ -667,6 +672,7 @@ EX namespace models {
|
||||
if(vid.consider_shader_projection && shaderside_projection && vpmodel)
|
||||
dialog::lastItem().value += XLAT(" (2D only)");
|
||||
dialog::add_action([] { vid.consider_shader_projection = !vid.consider_shader_projection; });
|
||||
#endif
|
||||
|
||||
menuitem_sightrange('R');
|
||||
|
||||
|
@ -209,7 +209,7 @@ EX namespace netgen {
|
||||
void blackline(vec v1, vec v2, color_t col = 0x000000FF) {
|
||||
#if CAP_SDLGFX
|
||||
aalineColor(s, int(v1.x), int(v1.y), int(v2.x), int(v2.y), col);
|
||||
#else
|
||||
#elseif CAP_SDL
|
||||
SDL_LockSurface(s);
|
||||
int len = abs(v1.x-v2.x) + abs(v1.y-v2.y);
|
||||
for(int i=0; i<=len; i++)
|
||||
@ -227,7 +227,7 @@ EX namespace netgen {
|
||||
polyy[1] = int(v2.y);
|
||||
polyy[2] = int(v3.y);
|
||||
filledPolygonColorI(s, polyx, polyy, 3, col);
|
||||
#else
|
||||
#elseif CAP_SDL
|
||||
SDL_LockSurface(s);
|
||||
int len = abs(v1.x-v2.x) + abs(v1.y-v2.y);
|
||||
for(int i=0; i<=len; i++) for(int j=0; j<=len; j++) if(i+j <= len)
|
||||
|
@ -70,21 +70,24 @@ void geometry_information::shift(hpcshape& sh, double dx, double dy, double dz)
|
||||
}
|
||||
|
||||
void geometry_information::initPolyForGL() {
|
||||
|
||||
#if CAP_GL
|
||||
ourshape.clear();
|
||||
|
||||
for(auto& h: hpc)
|
||||
ourshape.push_back(glhr::pointtogl(h));
|
||||
|
||||
glhr::store_in_buffer(ourshape);
|
||||
#endif
|
||||
}
|
||||
|
||||
void geometry_information::extra_vertices() {
|
||||
#if CAP_GL
|
||||
while(isize(ourshape) < isize(hpc))
|
||||
ourshape.push_back(glhr::pointtogl(hpc[isize(ourshape)]));
|
||||
glhr::store_in_buffer(ourshape);
|
||||
glhr::current_vertices = NULL;
|
||||
prehpc = isize(hpc);
|
||||
#endif
|
||||
}
|
||||
|
||||
transmatrix geometry_information::ddi(int a, ld x) { return xspinpush(a * M_PI / S42, x); }
|
||||
|
21
rug.cpp
21
rug.cpp
@ -1838,16 +1838,21 @@ auto rug_hook =
|
||||
|
||||
EX }
|
||||
|
||||
#else
|
||||
#endif
|
||||
|
||||
#if !CAP_RUG
|
||||
|
||||
// fake for mobile
|
||||
namespace rug {
|
||||
bool rugged = false;
|
||||
bool renderonce = false;
|
||||
bool rendernogl = true;
|
||||
int texturesize = 512;
|
||||
ld scale = 1.0f;
|
||||
}
|
||||
EX namespace rug {
|
||||
EX bool rugged = false;
|
||||
EX bool renderonce = false;
|
||||
EX bool rendernogl = true;
|
||||
EX int texturesize = 512;
|
||||
EX ld scale = 1.0f;
|
||||
EX bool rug_control() { return false; }
|
||||
EX bool in_crystal() { return false; }
|
||||
EX void reset_view() { }
|
||||
EX }
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -455,6 +455,7 @@ EX always_false in;
|
||||
for(auto& d: tdata) d[0] = x;
|
||||
}
|
||||
|
||||
#if CAP_GL
|
||||
if(tt == 3) {
|
||||
int tp = texture_position[texid(p)];
|
||||
auto xy = make_array<int>(tp % fts_row, tp / fts_row);
|
||||
@ -465,6 +466,7 @@ EX always_false in;
|
||||
d[c] = ((d[c] - zero[c])*sca + xy[c] + .5) * fts_int / fts;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for(auto& d: tdata) ad.second.push_back(d);
|
||||
}
|
||||
@ -482,6 +484,7 @@ EX always_false in;
|
||||
int gps = 0;
|
||||
for(auto& p: gradient_position) p.second = gps++;
|
||||
|
||||
#if CAP_TEXTURE
|
||||
fts_int = floor_texture_square_size * FLOORTEXTURESIZE + 4;
|
||||
fts = 64;
|
||||
|
||||
@ -490,6 +493,7 @@ EX always_false in;
|
||||
|
||||
fts_row = (fts-gps)/fts_int;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for(auto& p: ptds) {
|
||||
auto p2 = dynamic_cast<dqi_poly*>(&*p);
|
||||
@ -642,9 +646,7 @@ void set_shotx() {
|
||||
}
|
||||
}
|
||||
|
||||
#if CAP_SDL
|
||||
EX int shot_aa = 1;
|
||||
#endif
|
||||
|
||||
EX void default_screenshot_content() {
|
||||
#if CAP_RUG
|
||||
@ -664,9 +666,11 @@ EX void default_screenshot_content() {
|
||||
drawStats();
|
||||
}
|
||||
|
||||
#if CAP_SDL
|
||||
EX SDL_Surface *empty_surface(int x, int y, bool alpha) {
|
||||
return SDL_CreateRGBSurface(SDL_SWSURFACE,x,y,32,0xFF<<16,0xFF<<8,0xFF, (alpha) ? (0xFF<<24) : 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CAP_PNG
|
||||
|
||||
@ -957,12 +961,18 @@ EX void menu() {
|
||||
#if CAP_WRL
|
||||
if(!models::is_3d(vpconf) && !rug::rugged) {
|
||||
dialog::addInfo("this format is for 3D projections", 0xFF0000);
|
||||
#if CAP_RUG
|
||||
if(GDIM == 2) {
|
||||
dialog::addItem(XLAT("hypersian rug mode"), 'u');
|
||||
dialog::add_action_push(rug::show);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if CAP_RUG
|
||||
else if(rug::rugged ? rug::perspective() : models::is_perspective(vpconf.model)) {
|
||||
#else
|
||||
else if(models::is_perspective(vpconf.model)) {
|
||||
#endif
|
||||
dialog::addInfo("this does not work well in perspective projections", 0xFF8000);
|
||||
dialog::addSelItem(XLAT("projection"), current_proj_name(), '1');
|
||||
dialog::add_action_push(models::model_menu);
|
||||
@ -1825,12 +1835,14 @@ startanim rug { "Hypersian Rug", [] {
|
||||
pick();
|
||||
#endif
|
||||
}, [] {
|
||||
#if CAP_RUG
|
||||
dynamicval<bool> b(rug::rugged, true);
|
||||
rug::physics();
|
||||
dynamicval<transmatrix> t(rug::rugView, cspin(1, 2, ticks / 3000.) * rug::rugView);
|
||||
gamescreen(2);
|
||||
if(!rug::rugged) current = &null_animation;
|
||||
explorable([] { rug::rugged = true; pushScreen(rug::show); });
|
||||
#endif
|
||||
}};
|
||||
|
||||
startanim spin_around { "spinning around", no_init, [] {
|
||||
|
@ -11,6 +11,7 @@ namespace hr {
|
||||
EX ld levellines;
|
||||
EX bool disable_texture;
|
||||
|
||||
#if CAP_GL
|
||||
#if HDR
|
||||
constexpr flagtype GF_TEXTURE = 1;
|
||||
constexpr flagtype GF_VARCOLOR = 2;
|
||||
@ -546,5 +547,5 @@ EX void glapplymatrix(const transmatrix& V) {
|
||||
glhr::set_modelview(glhr::as_glmatrix(mat));
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
2
sky.cpp
2
sky.cpp
@ -2,7 +2,7 @@
|
||||
|
||||
namespace hr {
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
#if MAXMDIM >= 4 && CAP_GL
|
||||
EX ld camera_level;
|
||||
|
||||
EX int get_skybrightness(int mul IS(1)) {
|
||||
|
@ -8,9 +8,9 @@
|
||||
*/
|
||||
|
||||
#include "hyper.h"
|
||||
#if CAP_SURFACE
|
||||
namespace hr {
|
||||
|
||||
#if CAP_SURFACE
|
||||
EX namespace surface {
|
||||
|
||||
ld sech(ld d) { return 1 / cosh(d); }
|
||||
@ -841,9 +841,9 @@ int surface_args() {
|
||||
else return 1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
auto surface_hook = addHook(hooks_args, 100, surface_args);
|
||||
#endif
|
||||
|
||||
void display_coverage() {
|
||||
|
||||
@ -860,5 +860,6 @@ void display_coverage() {
|
||||
|
||||
auto surface_hook2 = addHook(hooks_frame, 0, display_coverage);
|
||||
|
||||
}}
|
||||
EX }
|
||||
#endif
|
||||
}
|
||||
|
@ -186,7 +186,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef CAP_MODEL
|
||||
#define CAP_MODEL (!ISMOBWEB && !ISMINI)
|
||||
#define CAP_MODEL (!ISMOBWEB && !ISMINI && CAP_SDL)
|
||||
#endif
|
||||
|
||||
#ifndef CAP_SAVE
|
||||
@ -399,6 +399,7 @@ extern "C" {
|
||||
#define CAP_GLEW (CAP_GL && !ISMOBILE && !ISMAC && !ISLINUX && !ISWEB)
|
||||
#endif
|
||||
|
||||
#if CAP_GL
|
||||
#if CAP_GLEW
|
||||
#include <GL/glew.h>
|
||||
#else
|
||||
@ -422,6 +423,10 @@ extern "C" {
|
||||
#include <GL/glext.h>
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
typedef int GLint;
|
||||
typedef unsigned GLuint;
|
||||
#endif
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
@ -560,7 +565,7 @@ union SDL_Event;
|
||||
#endif
|
||||
|
||||
#ifndef CAP_RAY
|
||||
#define CAP_RAY (MAXMDIM >= 4 && !ISWEB && !ISMOBILE)
|
||||
#define CAP_RAY (MAXMDIM >= 4 && !ISWEB && !ISMOBILE && CAP_GL)
|
||||
#endif
|
||||
|
||||
#ifndef CAP_MEMORY_RESERVE
|
||||
|
@ -57,7 +57,7 @@ void geometry_information::pushShape(usershapelayer& ds) {
|
||||
|
||||
if(GDIM == 2) hpcpush(T * ds.list[0]);
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
#if MAXMDIM >= 4 && CAP_GL
|
||||
if(GDIM == 3) {
|
||||
auto& utt = user_triangles_texture;
|
||||
utt.texture_id = floor_textures->renderedTexture;
|
||||
|
Loading…
Reference in New Issue
Block a user