remove unused cruft and fix float casts

This commit is contained in:
Andrew Meadows 2015-03-06 15:31:27 -08:00
parent e4c68bf31c
commit 6fa1b1c600
2 changed files with 4 additions and 14 deletions

View file

@ -129,18 +129,17 @@ unsigned char* childOctalCode(const unsigned char* parentOctalCode, char childNu
void voxelDetailsForCode(const unsigned char* octalCode, VoxelPositionSize& voxelPositionSize) {
float output[3];
memset(&output[0], 0, 3 * sizeof(float));
float currentScale = 1.0;
float currentScale = 1.0f;
if (octalCode) {
for (int i = 0; i < numberOfThreeBitSectionsInCode(octalCode); i++) {
currentScale *= 0.5;
currentScale *= 0.5f;
int sectionIndex = sectionValue(octalCode + 1 + (BITS_IN_OCTAL * i / BITS_IN_BYTE),
(BITS_IN_OCTAL * i) % BITS_IN_BYTE);
for (int j = 0; j < BITS_IN_OCTAL; j++) {
output[j] += currentScale * (int)oneAtBit(sectionIndex, (BITS_IN_BYTE - BITS_IN_OCTAL) + j);
output[j] += currentScale * (float)oneAtBit(sectionIndex, (BITS_IN_BYTE - BITS_IN_OCTAL) + j);
}
}
}
voxelPositionSize.x = output[0];
@ -152,7 +151,7 @@ void voxelDetailsForCode(const unsigned char* octalCode, VoxelPositionSize& voxe
void copyFirstVertexForCode(const unsigned char* octalCode, float* output) {
memset(output, 0, 3 * sizeof(float));
float currentScale = 0.5;
float currentScale = 0.5f;
for (int i = 0; i < numberOfThreeBitSectionsInCode(octalCode); i++) {
int sectionIndex = sectionValue(octalCode + 1 + (3 * i / 8), (3 * i) % 8);
@ -165,12 +164,6 @@ void copyFirstVertexForCode(const unsigned char* octalCode, float* output) {
}
}
float * firstVertexForCode(const unsigned char* octalCode) {
float * firstVertex = new float[3];
copyFirstVertexForCode(octalCode, firstVertex);
return firstVertex;
}
OctalCodeComparison compareOctalCodes(const unsigned char* codeA, const unsigned char* codeB) {
if (!codeA || !codeB) {
return ILLEGAL_CODE;

View file

@ -43,9 +43,6 @@ const int CHECK_NODE_ONLY = -1;
bool isAncestorOf(const unsigned char* possibleAncestor, const unsigned char* possibleDescendent,
int descendentsChild = CHECK_NODE_ONLY);
// Note: copyFirstVertexForCode() is preferred because it doesn't allocate memory for the return
// but other than that these do the same thing.
float * firstVertexForCode(const unsigned char* octalCode);
void copyFirstVertexForCode(const unsigned char* octalCode, float* output);
struct VoxelPositionSize {