Differences From Artifact [d20e5d1984]:
- File
src/rendercubes.m
— part of check-in
[75e920ae30]
at
2025-03-29 14:25:43
on branch trunk
— Switch from clang-format to manual formatting
clang-format does too many weird things. (user: js, size: 10643) [annotate] [blame] [check-ins using]
To Artifact [ee90f3d4f5]:
- File src/rendercubes.m — part of check-in [c634a689e7] at 2025-03-29 17:13:40 on branch trunk — More style fixes (user: js, size: 9989) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
27 28 29 30 31 32 33 | setarraypointers(); } // generating the actual vertices is done dynamically every frame and sits at // the leaves of all these functions, and are part of the cpu bottleneck on // really slow machines, hence the macros. | | | | | | | | | | | | | | | | | | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | setarraypointers(); } // generating the actual vertices is done dynamically every frame and sits at // the leaves of all these functions, and are part of the cpu bottleneck on // really slow machines, hence the macros. #define vertcheck() \ { \ if (curvert >= curmaxverts) \ reallocv(); \ } #define vertf(v1, v2, v3, ls, t1, t2) \ { \ struct vertex *v = &verts[curvert++]; \ v->u = t1; \ v->v = t2; \ v->x = v1; \ v->y = v2; \ v->z = v3; \ v->r = ls->r; \ v->g = ls->g; \ v->b = ls->b; \ v->a = 255; \ } #define vert(v1, v2, v3, ls, t1, t2) \ { \ vertf((float)(v1), (float)(v2), (float)(v3), ls, t1, t2); \ } int nquads; const float TEXTURESCALE = 32.0f; bool floorstrip = false, deltastrip = false; int oh, oy, ox, ogltex; // the o* vars are used by the stripification |
︙ | ︙ | |||
71 72 73 74 75 76 77 | void mipstats(int a, int b, int c) { if (showm) conoutf(@"1x1/2x2/4x4: %d / %d / %d", a, b, c); } | | | | | | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | void mipstats(int a, int b, int c) { if (showm) conoutf(@"1x1/2x2/4x4: %d / %d / %d", a, b, c); } #define stripend() \ { \ if (floorstrip || deltastrip) { \ addstrip(ogltex, firstindex, curvert - firstindex); \ floorstrip = deltastrip = false; \ } \ } void finishstrips() { stripend(); } |
︙ | ︙ | |||
134 135 136 137 138 139 140 141 | ol3b = l1->b; ol4r = l2->r; ol4g = l2->g; ol4b = l2->b; } else // continue strip { int lighterr = lighterror * 2; if ((abs(ol3r - l3->r) < lighterr && | > | < | | | | < | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | ol3b = l1->b; ol4r = l2->r; ol4g = l2->g; ol4b = l2->b; } else // continue strip { int lighterr = lighterror * 2; // skip vertices if light values are close enough if ((abs(ol3r - l3->r) < lighterr && abs(ol4r - l4->r) < lighterr && abs(ol3g - l3->g) < lighterr && abs(ol4g - l4->g) < lighterr && abs(ol3b - l3->b) < lighterr && abs(ol4b - l4->b) < lighterr) || !wtex) { curvert -= 2; nquads--; } else { unsigned char *p3 = (unsigned char *)(&verts[curvert - 1].r); ol3r = p3[0]; ol3g = p3[1]; |
︙ | ︙ |