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)
|
||||
ifeq ($(strip $(WINCHECK)),)
|
||||
WINDOWS := 0
|
||||
else
|
||||
WINDOWS := 1
|
||||
endif
|
||||
export SCONSFLAGS := -Q
|
||||
|
||||
ifeq ($(WINDOWS),1)
|
||||
GLLIBS := -lopengl32 -lglu32
|
||||
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
|
||||
all:
|
||||
@scons
|
||||
|
||||
clean:
|
||||
make -C TextureCache clean
|
||||
make -C wfobj clean
|
||||
-rm -f *.o *~ $(TARGET)
|
||||
@scons -c
|
||||
|
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 <iostream>
|
||||
#include "wfobj/WFObj.h"
|
||||
#include "TextureCache/TextureCache.h"
|
||||
using namespace std;
|
||||
|
||||
/* Some definitions */
|
||||
@ -13,18 +12,6 @@ using namespace std;
|
||||
#define HEIGHT 800
|
||||
#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
|
||||
{
|
||||
public:
|
||||
@ -36,6 +23,7 @@ private:
|
||||
void display();
|
||||
void setProjection();
|
||||
|
||||
WFObj m_obj;
|
||||
GLuint m_list;
|
||||
float m_rotationMatrix[16];
|
||||
int m_startx, m_starty;
|
||||
@ -80,10 +68,7 @@ Viewer::Viewer(const char * filename)
|
||||
{
|
||||
m_dist = 5.0;
|
||||
m_dragging = false;
|
||||
LoadTexture lt;
|
||||
WFObj m_obj(lt);
|
||||
m_obj.load(FileLoader::Path(filename, ""));
|
||||
m_list = m_obj.render();
|
||||
m_obj.load(filename);
|
||||
|
||||
/* Print out the object's size */
|
||||
const float * aabb = m_obj.getAABB();
|
||||
@ -127,8 +112,7 @@ void Viewer::display()
|
||||
glLoadIdentity();
|
||||
gluLookAt(0, -m_dist, 0, 0, 0, 0, 0, 0, 1);
|
||||
glMultMatrixf(m_rotationMatrix);
|
||||
if (m_list)
|
||||
glCallList(m_list);
|
||||
m_obj.draw();
|
||||
SDL_GL_SwapBuffers();
|
||||
}
|
||||
|
||||
@ -196,5 +180,4 @@ void Viewer::run()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user