build with scons; update to v2.0 interface
This commit is contained in:
parent
e305a264f1
commit
698c7e99b7
39
Makefile
39
Makefile
@ -1,39 +1,8 @@
|
|||||||
|
|
||||||
WINCHECK := $(shell which msys-1.0.dll >/dev/null 2>&1; if [ $$? -eq 0 ]; then echo MSYS; fi)
|
export SCONSFLAGS := -Q
|
||||||
ifeq ($(strip $(WINCHECK)),)
|
|
||||||
WINDOWS := 0
|
|
||||||
else
|
|
||||||
WINDOWS := 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(WINDOWS),1)
|
all:
|
||||||
GLLIBS := -lopengl32 -lglu32
|
@scons
|
||||||
WINDOWSLIBS := -lmingw32
|
|
||||||
else
|
|
||||||
GLLIBS := -lGL -lGLU
|
|
||||||
endif
|
|
||||||
|
|
||||||
export CXXFLAGS := -O2 $(shell sdl-config --cflags) -I$(CURDIR)
|
|
||||||
LDFLAGS := $(GLLIBS) $(WINDOWSLIBS) $(shell sdl-config --libs) -lSDL_image
|
|
||||||
TARGET := wfobj-view
|
|
||||||
|
|
||||||
.PHONY: all clean TextureCache wfobj
|
|
||||||
|
|
||||||
all: $(TARGET)
|
|
||||||
|
|
||||||
$(TARGET): $(TARGET).o TextureCache wfobj
|
|
||||||
$(CXX) -o $(TARGET) $< TextureCache/TextureCache.o wfobj/WFObj.o $(LDFLAGS)
|
|
||||||
|
|
||||||
%.o: %.cc
|
|
||||||
$(CXX) -c -o $@ $< $(CXXFLAGS)
|
|
||||||
|
|
||||||
TextureCache:
|
|
||||||
make -C TextureCache
|
|
||||||
|
|
||||||
wfobj:
|
|
||||||
make -C wfobj
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
make -C TextureCache clean
|
@scons -c
|
||||||
make -C wfobj clean
|
|
||||||
-rm -f *.o *~ $(TARGET)
|
|
||||||
|
6
SConstruct
Normal file
6
SConstruct
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# vim:filetype=python
|
||||||
|
|
||||||
|
env = Environment(LIBS = ['GL', 'GLU'])
|
||||||
|
env.ParseConfig('sdl-config --cflags --libs')
|
||||||
|
|
||||||
|
env.Program('wfobj-view', [Glob('*.cc'), Glob('wfobj/WFObj.cc')])
|
@ -5,7 +5,6 @@
|
|||||||
#include <GL/glu.h>
|
#include <GL/glu.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "wfobj/WFObj.h"
|
#include "wfobj/WFObj.h"
|
||||||
#include "TextureCache/TextureCache.h"
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
/* Some definitions */
|
/* Some definitions */
|
||||||
@ -13,18 +12,6 @@ using namespace std;
|
|||||||
#define HEIGHT 800
|
#define HEIGHT 800
|
||||||
#define TITLE "Josh's Wavefront Object Viewer"
|
#define TITLE "Josh's Wavefront Object Viewer"
|
||||||
|
|
||||||
TextureCache textureCache;
|
|
||||||
|
|
||||||
class LoadTexture : public TextureLoader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
GLuint load(const FileLoader::Path & path,
|
|
||||||
FileLoader & fl, bool mipmaps, int mode, int quality)
|
|
||||||
{
|
|
||||||
return textureCache.load(path.fullPath);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class Viewer
|
class Viewer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -36,6 +23,7 @@ private:
|
|||||||
void display();
|
void display();
|
||||||
void setProjection();
|
void setProjection();
|
||||||
|
|
||||||
|
WFObj m_obj;
|
||||||
GLuint m_list;
|
GLuint m_list;
|
||||||
float m_rotationMatrix[16];
|
float m_rotationMatrix[16];
|
||||||
int m_startx, m_starty;
|
int m_startx, m_starty;
|
||||||
@ -80,10 +68,7 @@ Viewer::Viewer(const char * filename)
|
|||||||
{
|
{
|
||||||
m_dist = 5.0;
|
m_dist = 5.0;
|
||||||
m_dragging = false;
|
m_dragging = false;
|
||||||
LoadTexture lt;
|
m_obj.load(filename);
|
||||||
WFObj m_obj(lt);
|
|
||||||
m_obj.load(FileLoader::Path(filename, ""));
|
|
||||||
m_list = m_obj.render();
|
|
||||||
|
|
||||||
/* Print out the object's size */
|
/* Print out the object's size */
|
||||||
const float * aabb = m_obj.getAABB();
|
const float * aabb = m_obj.getAABB();
|
||||||
@ -127,8 +112,7 @@ void Viewer::display()
|
|||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
gluLookAt(0, -m_dist, 0, 0, 0, 0, 0, 0, 1);
|
gluLookAt(0, -m_dist, 0, 0, 0, 0, 0, 0, 1);
|
||||||
glMultMatrixf(m_rotationMatrix);
|
glMultMatrixf(m_rotationMatrix);
|
||||||
if (m_list)
|
m_obj.draw();
|
||||||
glCallList(m_list);
|
|
||||||
SDL_GL_SwapBuffers();
|
SDL_GL_SwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,5 +180,4 @@ void Viewer::run()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user