mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2026-04-21 00:51:22 +00:00
conformal egg model (like in the game Innards)
This commit is contained in:
@@ -1035,7 +1035,7 @@ enum eModel : int {
|
||||
// 39..48
|
||||
mdPoorMan, mdPanini, mdRetroCraig, mdRetroLittrow, mdRetroHammer, mdThreePoint, mdLiePerspective, mdLieOrthogonal, mdRelPerspective, mdRelOrthogonal,
|
||||
// 49..53
|
||||
mdHorocyclicEqa, mdConformalSquare, mdFisheye2, mdPolar,
|
||||
mdHorocyclicEqa, mdConformalSquare, mdFisheye2, mdPolar, mdConformalEgg,
|
||||
// 54..
|
||||
mdGUARD, mdPixel, mdHyperboloidFlat, mdPolynomial, mdManual
|
||||
};
|
||||
@@ -1101,6 +1101,7 @@ EX vector<modelinfo> mdinf = {
|
||||
{X3("conformal square"), mf::orientation | mf::broken | mf::transition},
|
||||
{X3("variant fisheye"), 0},
|
||||
{X3("polar coordinates"), mf::orientation},
|
||||
{X3("conformal egg"), mf::orientation | mf::transition},
|
||||
{X3("guard"), mf::technical},
|
||||
{X3("pixel"), mf::technical},
|
||||
{X3("hypflat"), mf::technical},
|
||||
|
||||
17
hypgraph.cpp
17
hypgraph.cpp
@@ -771,6 +771,23 @@ EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
|
||||
for(int d=0; d<GDIM; d++) ret[d] /= r;
|
||||
return;
|
||||
}
|
||||
|
||||
case mdConformalEgg: {
|
||||
H /= H[GDIM] + 1;
|
||||
models::scr_to_ori(H);
|
||||
|
||||
ld mul = pconf.model_transition / 9;
|
||||
|
||||
auto a = H[0], b = H[1];
|
||||
auto A = a*a;
|
||||
auto B = b*b;
|
||||
ret[0] = a + a * (A - 3*B) * mul;
|
||||
ret[1] = b + b * (3*A - B) * mul;
|
||||
|
||||
models::ori_to_scr(ret);
|
||||
if(GDIM == 2) ret[2] = 0; if(MAXMDIM == 4) ret[3] = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
case mdHalfplane: {
|
||||
if(mproduct) {
|
||||
|
||||
21
shaders.cpp
21
shaders.cpp
@@ -345,6 +345,27 @@ shared_ptr<glhr::GLprogram> write_shader(flagtype shader_flags) {
|
||||
"t.xyz /= -rads; t[3] = 1.0;\n";
|
||||
if(dim3) shader_flags |= SF_ZFOG;
|
||||
}
|
||||
else if(pmodel == mdConformalEgg && hyperbolic) {
|
||||
shader_flags |= SF_ORIENT | SF_BOX | SF_DIRECT;
|
||||
coordinator += "t = uPP * t; ", vsh += "uniform mediump mat4 uPP;";
|
||||
coordinator += dim2 ? "t /= 1. + t.z;\n" : "t /= 1. + t.w;\n";
|
||||
if(pconf.model_transition == 1)
|
||||
coordinator +=
|
||||
"mediump float mul = 1./9.;\n";
|
||||
else {
|
||||
vsh += "uniform mediump float uModelTrans;";
|
||||
coordinator +=
|
||||
"mediump float mul = (1./9.) * uModelTrans;\n";
|
||||
}
|
||||
coordinator +=
|
||||
"mediump float txx = t.x * t.x;\n"
|
||||
"mediump float tyy = t.y * t.y;\n"
|
||||
"t.x = t.x + t.x * (txx - 3.*tyy) * mul;\n"
|
||||
"t.y = t.y + t.y * (3.*txx - tyy) * mul;\n"
|
||||
"t.w = 1.;\n";
|
||||
if(dim2) coordinator += "t.z = 0.;\n";
|
||||
if(dim3) shader_flags |= SF_ZFOG;
|
||||
}
|
||||
else if(pmodel == mdLiePerspective) {
|
||||
shader_flags |= SF_PERS3 | SF_DIRECT;
|
||||
if(hyperbolic) {
|
||||
|
||||
Reference in New Issue
Block a user