From 322a793217747dcba07746dbe23006dcb50492a2 Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 11 Jul 2003 07:44:17 +0000 Subject: [PATCH] added a note about another kind of terrain strip and documented code for generating the strips git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3227 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_backend.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/gl_backend.c b/gl_backend.c index 833bdb1b..fe474eac 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -91,6 +91,7 @@ note: here's strip order for a terrain row: |\ |\ |\ |\ | | \| \| \| \| A--B--C--D--E +clockwise A0B, 01B, B1C, 12C, C2D, 23D, D3E, 34E @@ -100,6 +101,42 @@ A0B, 01B, B1C, 12C, C2D, 23D, D3E, 34E *elements++ = i; *elements++ = i + 1; *elements++ = i + row + 1; + + +for (y = 0;y < rows - 1;y++) +{ + for (x = 0;x < columns - 1;x++) + { + i = y * rows + x; + *elements++ = i + columns; + *elements++ = i; + *elements++ = i + columns + 1; + *elements++ = i; + *elements++ = i + 1; + *elements++ = i + columns + 1; + } +} + +alternative: +0--1--2--3--4 +| /| /|\ | /| +|/ |/ | \|/ | +A--B--C--D--E +counterclockwise + +for (y = 0;y < rows - 1;y++) +{ + for (x = 0;x < columns - 1;x++) + { + i = y * rows + x; + *elements++ = i; + *elements++ = i + columns; + *elements++ = i + columns + 1; + *elements++ = i + columns; + *elements++ = i + columns + 1; + *elements++ = i + 1; + } +} */ int polygonelements[768]; -- 2.39.2