📄 cube.c
字号:
#include "cube.h"#include "vertex.h"#include <stdint.h>float cubeVB[32] __attribute__((aligned(16)));vertexP cubeIB[12];uint32_t posCnt = 32;uint32_t ibCnt = 12;int buildCube(void){ vector float *cubePos = (vector float*)cubeVB; cubePos[0] = (vector float) {-1.0f, -1.0f, -1.0f, 1.0f}; cubePos[1] = (vector float) {-1.0f, 1.0f, -1.0f, 1.0f}; cubePos[2] = (vector float) {1.0f, 1.0f, -1.0f, 1.0f}; cubePos[3] = (vector float) {1.0f, -1.0f, -1.0f, 1.0f}; cubePos[4] = (vector float) {-1.0f, -1.0f, 1.0f, 1.0f}; cubePos[5] = (vector float) {-1.0f, 1.0f, 1.0f, 1.0f}; cubePos[6] = (vector float) {1.0f, 1.0f, 1.0f, 1.0f}; cubePos[7] = (vector float) {1.0f, -1.0f, 1.0f, 1.0f}; cubeIB[0].pos1 = 0; cubeIB[0].pos2 = 1; cubeIB[0].pos3 = 2; cubeIB[1].pos1 = 0; cubeIB[1].pos2 = 2; cubeIB[1].pos3 = 3; cubeIB[2].pos1 = 4; cubeIB[2].pos2 = 6; cubeIB[2].pos3 = 5; cubeIB[3].pos1 = 4; cubeIB[3].pos2 = 7; cubeIB[3].pos3 = 6; cubeIB[4].pos1 = 4; cubeIB[4].pos2 = 5; cubeIB[4].pos3 = 1; cubeIB[5].pos1 = 4; cubeIB[5].pos2 = 1; cubeIB[5].pos3 = 0; cubeIB[6].pos1 = 3; cubeIB[6].pos2 = 2; cubeIB[6].pos3 = 6; cubeIB[7].pos1 = 3; cubeIB[7].pos2 = 6; cubeIB[7].pos3 = 7; cubeIB[8].pos1 = 1; cubeIB[8].pos2 = 5; cubeIB[8].pos3 = 6; cubeIB[9].pos1 = 1; cubeIB[9].pos2 = 6; cubeIB[9].pos3 = 2; cubeIB[10].pos1 = 4; cubeIB[10].pos2 = 0; cubeIB[10].pos3 = 3; cubeIB[11].pos1 = 4; cubeIB[11].pos2 = 3; cubeIB[11].pos3 = 7; return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -