1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-20 16:37:40 +00:00

2D3D:: better stars

This commit is contained in:
Zeno Rogue
2019-05-29 01:59:01 +02:00
parent 42dd86f650
commit 88d6c0d144
3 changed files with 42 additions and 20 deletions

View File

@@ -642,6 +642,38 @@ void geometry_information::make_ball(hpcshape& sh, ld rad, int lev) {
add_texture(sh);
}
void geometry_information::hpcsquare(hyperpoint h1, hyperpoint h2, hyperpoint h3, hyperpoint h4) {
last->flags |= POLY_TRIANGLES;
hpcpush(h1);
hpcpush(h2);
hpcpush(h3);
hpcpush(h2);
hpcpush(h3);
hpcpush(h4);
}
void geometry_information::make_star(hpcshape& sh, ld rad) {
bshape(sh, sh.prio);
rad = sinh(rad);
sh.flags |= POLY_TRIANGLES | POLY_INTENSE;
for(int a=0; a<64; a++) {
ld z0 = (a-32)/32.;
ld z1 = (a-31)/32.;
ld r0 = sqrt(1 - z0*z0) * rad;
ld r1 = sqrt(1 - z1*z1) * rad;
z0 *= rad;
z1 *= rad;
for(int b=0; b<360; b+=15) {
ld b0 = b * degree;
ld b1 = (b+15) * degree;
hpcsquare(
hpxy3(r0 * cos(b0), r0 * sin(b0), z0), hpxy3(r0 * cos(b1), r0 * sin(b1), z0),
hpxy3(r1 * cos(b0), r1 * sin(b0), z1), hpxy3(r1 * cos(b1), r1 * sin(b1), z1)
);
}
}
}
hyperpoint psmin(hyperpoint H) {
hyperpoint res;
res[2] = asin_auto(H[2]);
@@ -978,8 +1010,8 @@ void geometry_information::make_3d_models() {
if(euclid)
make_ball(shSun, 0.5, 2);
else
make_ball(shSun, 3, 5);
make_ball(shNightStar, 0.75, 2);
make_star(shSun, 3);
make_star(shNightStar, 0.75);
if(WDIM == 2) {
for(int i=0; i<3; i++) {