1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 14:37:16 +00:00

3d:: improved floor patterns

This commit is contained in:
Zeno Rogue 2019-03-16 22:15:48 +01:00
parent af25eb1f1f
commit fcedebd0d8
2 changed files with 41 additions and 5 deletions

View File

@ -722,13 +722,31 @@ auto floor_hook =
renderbuffer *floor_textures;
void draw_shape_for_texture(floorshape* sh, int& id) {
ld gx = (id % 8) * 1.5 - 3.5 * 1.5;
ld gy = (id / 8) * 1.5 - 3.5 * 1.5;
id++;
if(1) {
dynamicval<ld> v(vid.linewidth, 8);
curvepoint(eupush(gx+.5, gy-.5) * C0);
curvepoint(eupush(gx+.5, gy+.5) * C0);
curvepoint(eupush(gx-.5, gy+.5) * C0);
curvepoint(eupush(gx-.5, gy-.5) * C0);
curvepoint(eupush(gx+.5, gy-.5) * C0);
queuecurve(0x000000FF, 0xFFFFFFFF - 0x1010100 * (sh->pstrength * 24/10), PPR::LAKELEV);
}
poly_outline = 0xFFFFFFFF - 0x1010100 * (sh->pstrength * 3/2);
for(int a=-1; a<=1; a++)
for(int b=-1; b<=1; b++)
queuepoly(eupush(gx+a/2., gy+b/2.), sh->b[0], 0xFFFFFFFF);
if(sh == &shCrossFloor) {
queuepoly(eupush(gx, gy) * spin(M_PI/4), shCross, 0x808080FF);
}
if(1) {
dynamicval<ld> v(vid.linewidth, 8);
curvepoint(eupush(gx+.25, gy-.25) * C0);
@ -736,7 +754,7 @@ void draw_shape_for_texture(floorshape* sh, int& id) {
curvepoint(eupush(gx-.25, gy+.25) * C0);
curvepoint(eupush(gx-.25, gy-.25) * C0);
curvepoint(eupush(gx+.25, gy-.25) * C0);
queuecurve(0x404040C0, 0, PPR::LINE);
queuecurve(0x40404000 + sh->fstrength * 192/10, 0, PPR::LINE);
}
sh->tinf3.tvertices.clear();
@ -803,20 +821,36 @@ void make_floor_textures() {
current_display->set_viewport(0);
current_display->set_projection(0, true);
current_display->set_mask(0);
floor_textures->clear(0xE8E8E8);
floor_textures->clear(0); // 0xE8E8E8 = 1
shOverFloor.pstrength = 20;
shFeatherFloor.pstrength = 40;
shFeatherFloor.fstrength = 5;
shTrollFloor.pstrength = 25;
shCaveFloor.pstrength = 40;
shCaveFloor.fstrength = 0;
shDesertFloor.pstrength = 30;
shDesertFloor.fstrength =10;
shRoseFloor.pstrength = 30;
shDragonFloor.pstrength = 30;
shBarrowFloor.pstrength = 40;
// all using Tortoise
for(auto v: all_escher_floorshapes) if(v->shapeid2 == 178) v->pstrength = 20;
ptds.clear();
int id = 0;
poly_outline = 0xF0F0F0FF;
for(auto v: all_plain_floorshapes) draw_shape_for_texture(v, id);
for(auto v: all_escher_floorshapes) draw_shape_for_texture(v, id);
drawqueue();
/*
SDL_Surface *sdark = floor_textures->render();
IMAGESAVE(sdark, "texture-test.png");
*/
rb.reset();
}

View File

@ -4174,10 +4174,12 @@ void set_blizzard_frame(cell *c, int frameid);
struct floorshape {
bool is_plain;
int shapeid;
int pstrength; // pattern strength in 3D
int fstrength; // frame strength in 3D
PPR prio;
vector<hpcshape> b, shadow, side[SIDEPARS], gpside[SIDEPARS][MAX_EDGE];
basic_textureinfo tinf3;
floorshape() { prio = PPR::FLOOR; }
floorshape() { prio = PPR::FLOOR; pstrength = fstrength = 10; }
};
extern vector<struct plain_floorshape*> all_plain_floorshapes;