Last active
April 3, 2025 20:48
-
-
Save cdwfs/2cab675b333632d940cf to your computer and use it in GitHub Desktop.
Rendering a cube as a 14-index triangle strip
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; How to render a cube using a single 14-index triangle strip | |
; (Reposted from http://www.asmcommunity.net/forums/topic/?id=6284#post-45209) | |
; Drawbacks: no support for per-vertex normals, UVs, etc. | |
; | |
; 1-------3-------4-------2 Cube = 8 vertices | |
; | E __/|\__ A | H __/| ================= | |
; | __/ | \__ | __/ | Single Strip: 4 3 7 8 5 3 1 4 2 7 6 5 2 1 | |
; |/ D | B \|/ I | 12 triangles: A B C D E F G H I J K L | |
; 5-------8-------7-------6 | |
; | C __/| | |
; | __/ | | |
; |/ J | | |
; 5-------6 | |
; |\__ K | | |
; | \__ | | |
; | L \| Left D+E | |
; 1-------2 Right H+I | |
; |\__ G | Back K+L | |
; | \__ | Front A+B | |
; | F \| Top F+G | |
; 3-------4 Bottom C+J | |
; | |
D3DXVECTOR3 \ | |
{ 0.5, 0.5, 0.5 }, ;4 | |
{ -0.5, 0.5, 0.5 }, ;3 | |
{ 0.5,-0.5, 0.5 }, ;7 A front | |
{ -0.5,-0.5, 0.5 }, ;8 B front | |
{ -0.5,-0.5,-0.5 }, ;5 C bottom | |
{ -0.5, 0.5, 0.5 }, ;3 D right | |
{ -0.5, 0.5,-0.5 }, ;1 E right | |
{ 0.5, 0.5, 0.5 }, ;4 F top | |
{ 0.5, 0.5,-0.5 }, ;2 G top | |
{ 0.5,-0.5, 0.5 }, ;7 H left | |
{ 0.5,-0.5,-0.5 }, ;6 I left | |
{ -0.5,-0.5,-0.5 }, ;5 J bottom | |
{ 0.5, 0.5,-0.5 }, ;2 K back | |
{ -0.5, 0.5,-0.5 } ;1 L back |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment