| 805 | } |
| 806 | |
| 807 | void MakeBoxGeometry(StructuredBuffer& vtxBuffer, FormattedBuffer& idxBuffer, float scale) |
| 808 | { |
| 809 | Array<Float3> boxVerts(NumBoxVerts); |
| 810 | Array<uint16> boxIndices(NumBoxIndices, 0); |
| 811 | |
| 812 | uint64 vIdx = 0; |
| 813 | |
| 814 | // Top |
| 815 | boxVerts[vIdx++] = Float3(-0.5f, 0.5f, 0.5f) * scale; |
| 816 | boxVerts[vIdx++] = Float3(0.5f, 0.5f, 0.5f) * scale; |
| 817 | boxVerts[vIdx++] = Float3(0.5f, 0.5f, -0.5f) * scale; |
| 818 | boxVerts[vIdx++] = Float3(-0.5f, 0.5f, -0.5f) * scale; |
| 819 | |
| 820 | // Bottom |
| 821 | boxVerts[vIdx++] = Float3(-0.5f, -0.5f, -0.5f) * scale; |
| 822 | boxVerts[vIdx++] = Float3(0.5f, -0.5f, -0.5f) * scale; |
| 823 | boxVerts[vIdx++] = Float3(0.5f, -0.5f, 0.5f) * scale; |
| 824 | boxVerts[vIdx++] = Float3(-0.5f, -0.5f, 0.5f) * scale; |
| 825 | |
| 826 | // Front |
| 827 | boxVerts[vIdx++] = Float3(-0.5f, 0.5f, -0.5f) * scale; |
| 828 | boxVerts[vIdx++] = Float3(0.5f, 0.5f, -0.5f) * scale; |
| 829 | boxVerts[vIdx++] = Float3(0.5f, -0.5f, -0.5f) * scale; |
| 830 | boxVerts[vIdx++] = Float3(-0.5f, -0.5f, -0.5f) * scale; |
| 831 | |
| 832 | // Back |
| 833 | boxVerts[vIdx++] = Float3(0.5f, 0.5f, 0.5f) * scale; |
| 834 | boxVerts[vIdx++] = Float3(-0.5f, 0.5f, 0.5f) * scale; |
| 835 | boxVerts[vIdx++] = Float3(-0.5f, -0.5f, 0.5f) * scale; |
| 836 | boxVerts[vIdx++] = Float3(0.5f, -0.5f, 0.5f) * scale; |
| 837 | |
| 838 | // Left |
| 839 | boxVerts[vIdx++] = Float3(-0.5f, 0.5f, 0.5f) * scale; |
| 840 | boxVerts[vIdx++] = Float3(-0.5f, 0.5f, -0.5f) * scale; |
| 841 | boxVerts[vIdx++] = Float3(-0.5f, -0.5f, -0.5f) * scale; |
| 842 | boxVerts[vIdx++] = Float3(-0.5f, -0.5f, 0.5f) * scale; |
| 843 | |
| 844 | // Right |
| 845 | boxVerts[vIdx++] = Float3(0.5f, 0.5f, -0.5f) * scale; |
| 846 | boxVerts[vIdx++] = Float3(0.5f, 0.5f, 0.5f) * scale; |
| 847 | boxVerts[vIdx++] = Float3(0.5f, -0.5f, 0.5f) * scale; |
| 848 | boxVerts[vIdx++] = Float3(0.5f, -0.5f, -0.5f) * scale; |
| 849 | |
| 850 | uint64 iIdx = 0; |
| 851 | |
| 852 | // Top |
| 853 | boxIndices[iIdx++] = 0; |
| 854 | boxIndices[iIdx++] = 1; |
| 855 | boxIndices[iIdx++] = 2; |
| 856 | boxIndices[iIdx++] = 2; |
| 857 | boxIndices[iIdx++] = 3; |
| 858 | boxIndices[iIdx++] = 0; |
| 859 | |
| 860 | // Bottom |
| 861 | boxIndices[iIdx++] = 4 + 0; |
| 862 | boxIndices[iIdx++] = 4 + 1; |
| 863 | boxIndices[iIdx++] = 4 + 2; |
| 864 | boxIndices[iIdx++] = 4 + 2; |
no test coverage detected