Fix windows build.

master
Jeremy Hu 2017-01-22 16:46:16 +09:30 committed by Fog
parent e4fc03e848
commit e8972149ef
8 changed files with 24 additions and 6 deletions

View File

@ -17,6 +17,11 @@ Build
$ cd build
$ qmake -spec macx-xcode
```
*Generate VC Project*
```
$ cd build
$ qmake -tp vc
```
*Generate Makefile*
```
$ cd build

View File

@ -21,12 +21,13 @@ array *arrayCreate(int nodeSize) {
}
int arraySetLength(array *arr, int length) {
char *newNodes;
if (length > arr->capacity) {
int newCapacity = (arr->capacity + 1) * 2;
if (newCapacity < length) {
newCapacity = length;
}
char *newNodes = (char *)realloc(arr->nodes, arr->nodeSize * newCapacity);
newNodes = (char *)realloc(arr->nodes, arr->nodeSize * newCapacity);
if (!newNodes) {
fprintf(stderr, "%s:Insufficient memory.\n", __FUNCTION__);
return -1;

View File

@ -924,8 +924,11 @@ static int bmeshAddWallsBetweenQuadsToModel(bmesh *bm, vec3 *origin, quad *q1,
vec3 o2v;
matchTwoFaces(q1, q2);
for (i = 0; i < 4; ++i) {
quad wall = {{q1->pt[i], q2->pt[i],
q2->pt[(i + 1) % 4], q1->pt[(i + 1) % 4]}};
quad wall;
wall.pt[0] = q1->pt[i];
wall.pt[1] = q2->pt[i];
wall.pt[2] = q2->pt[(i + 1) % 4];
wall.pt[3] = q1->pt[(i + 1) % 4];
vec3Normal(&wall.pt[0], &wall.pt[1], &wall.pt[2], &normal);
vec3Sub(&wall.pt[0], origin, &o2v);
if (vec3DotProduct(&o2v, &normal) < 0) {

View File

@ -118,7 +118,7 @@ int drawPrintf(int x, int y, const char *fmt, ...) {
return drawText(x, y, text);
}
static const float drawDebugColors[][4] {
static const float drawDebugColors[][4] = {
{1.00, 0.00, 1.00, 1.0},
{0.00, 1.00, 1.00, 1.0},
{1.00, 1.00, 0.00, 1.0},

View File

@ -3,7 +3,8 @@
#include "3dstruct.h"
#ifdef __APPLE__
#include <OpenGL/glu.h>
#else
#elif defined(_WIN32)
#include <windows.h>
#include <GL/glu.h>
#endif

View File

@ -2,6 +2,10 @@
#include <string.h>
#include <math.h>
#ifndef M_PI
#define M_PI 3.1415926
#endif
#define DEG2RAD (M_PI / 180.0)
matrix *matrixLoadIdentity(matrix *mat) {

View File

@ -9,7 +9,7 @@
#include "vector3d.h"
#include "subdivide.h"
static const float bmeshBallColors[][4] {
static const float bmeshBallColors[][4] = {
{0.00, 0.78, 1.00, 0.5},
{1.00, 0.00, 0.00, 0.5},
{1.00, 1.00, 1.00, 0.5}

View File

@ -2,6 +2,10 @@
#include "vector3d.h"
#include "matrix.h"
#ifndef M_PI
#define M_PI 3.1415926
#endif
float vec3Length(vec3 *p) {
double mag;
mag = p->x * p->x + p->y * p->y + p->z * p->z;