-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 055c754
Showing
36 changed files
with
215,336 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.o | ||
a2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "vecmath"] | ||
path = vecmath | ||
url = https://github.com/sherbondy/vecmath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "Joint.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef JOINT_H | ||
#define JOINT_H | ||
|
||
#include <vector> | ||
#include <vecmath.h> | ||
|
||
struct Joint | ||
{ | ||
Matrix4f transform; // transform relative to its parent | ||
std::vector< Joint* > children; // list of children | ||
|
||
// This matrix transforms world space into joint space for the initial ("bind") configuration of the joints. | ||
Matrix4f bindWorldToJointTransform; | ||
|
||
// This matrix maps joint space into world space for the *current* configuration of the joints. | ||
Matrix4f currentJointToWorldTransform; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
UNAME := $(shell uname) | ||
|
||
ifeq ($(UNAME),Darwin) | ||
INCFLAGS = -I vecmath/include/ | ||
|
||
FRAMEWORKS = -framework Glut | ||
FRAMEWORKS += -framework OpenGL | ||
FRAMEWORKS += -framework Cocoa | ||
FRAMEWORKS += -framework AGL | ||
FRAMEWORKS += -framework Carbon | ||
|
||
LINKFLAGS += -L vecmath/lib/ -lvecmath | ||
else | ||
INCFLAGS = -I /usr/include/GL | ||
INCFLAGS += -I /mit/6.837/public/include/vecmath | ||
|
||
LINKFLAGS = -lglut -lGL -lGLU | ||
LINKFLAGS += -L /mit/6.837/public/lib -lvecmath | ||
endif | ||
|
||
LINKFLAGS += -lfltk -lfltk_gl | ||
|
||
CFLAGS = -g | ||
CFLAGS += -DSOLN | ||
CC = g++ | ||
SRCS = bitmap.cpp camera.cpp MatrixStack.cpp modelerapp.cpp modelerui.cpp ModelerView.cpp Joint.cpp SkeletalModel.cpp Mesh.cpp main.cpp | ||
OBJS = $(SRCS:.cpp=.o) | ||
PROG = a2 | ||
|
||
all: $(SRCS) $(PROG) | ||
|
||
$(PROG): $(OBJS) | ||
$(CC) $(CFLAGS) $(OBJS) -o $@ $(LINKFLAGS) $(FRAMEWORKS) | ||
|
||
.cpp.o: | ||
$(CC) $(CFLAGS) $< -c -o $@ $(INCFLAGS) | ||
|
||
depend: | ||
makedepend $(INCFLAGS) -Y $(SRCS) | ||
|
||
clean: | ||
rm $(OBJS) $(PROG) | ||
|
||
bitmap.o: bitmap.h | ||
camera.o: camera.h | ||
Mesh.o: Mesh.h | ||
MatrixStack.o: MatrixStack.h | ||
modelerapp.o: modelerapp.h ModelerView.h modelerui.h bitmap.h camera.h | ||
modelerui.o: modelerui.h ModelerView.h bitmap.h camera.h modelerapp.h | ||
ModelerView.o: ModelerView.h camera.h | ||
SkeletalModel.o: MatrixStack.h ModelerView.h Joint.h modelerapp.h | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "MatrixStack.h" | ||
|
||
MatrixStack::MatrixStack() | ||
{ | ||
// Initialize the matrix stack with the identity matrix. | ||
} | ||
|
||
void MatrixStack::clear() | ||
{ | ||
// Revert to just containing the identity matrix. | ||
} | ||
|
||
Matrix4f MatrixStack::top() | ||
{ | ||
// Return the top of the stack | ||
} | ||
|
||
void MatrixStack::push( const Matrix4f& m ) | ||
{ | ||
// Push m onto the stack. | ||
// Your stack should have OpenGL semantics: | ||
// the new top should be the old top multiplied by m | ||
} | ||
|
||
void MatrixStack::pop() | ||
{ | ||
// Remove the top element from the stack | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef MATRIX_STACK_H | ||
#define MATRIX_STACK_H | ||
|
||
#include <vector> | ||
#include <vecmath.h> | ||
|
||
class MatrixStack | ||
{ | ||
public: | ||
MatrixStack(); | ||
void clear(); | ||
Matrix4f top(); | ||
void push( const Matrix4f& m ); | ||
void pop(); | ||
|
||
private: | ||
|
||
std::vector< Matrix4f > m_matrices; | ||
|
||
}; | ||
|
||
#endif // MATRIX_STACK_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "Mesh.h" | ||
|
||
using namespace std; | ||
|
||
void Mesh::load( const char* filename ) | ||
{ | ||
// 2.1.1. load() should populate bindVertices, currentVertices, and faces | ||
|
||
// Add your code here. | ||
|
||
// make a copy of the bind vertices as the current vertices | ||
currentVertices = bindVertices; | ||
} | ||
|
||
void Mesh::draw() | ||
{ | ||
// Since these meshes don't have normals | ||
// be sure to generate a normal per triangle. | ||
// Notice that since we have per-triangle normals | ||
// rather than the analytical normals from | ||
// assignment 1, the appearance is "faceted". | ||
} | ||
|
||
void Mesh::loadAttachments( const char* filename, int numJoints ) | ||
{ | ||
// 2.2. Implement this method to load the per-vertex attachment weights | ||
// this method should update m_mesh.attachments | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#ifndef MESH_H | ||
#define MESH_H | ||
|
||
#include <vector> | ||
#include <vecmath.h> | ||
#include <cstdlib> | ||
#include <iostream> | ||
#include <fstream> | ||
#include <sstream> | ||
#include "tuple.h" | ||
|
||
#ifdef __APPLE__ | ||
# include <GLUT/glut.h> | ||
#else | ||
# include <GL/glut.h> | ||
#endif | ||
|
||
typedef tuple< unsigned, 3 > Tuple3u; | ||
|
||
struct Mesh | ||
{ | ||
// list of vertices from the OBJ file | ||
// in the "bind pose" | ||
std::vector< Vector3f > bindVertices; | ||
|
||
// each face has 3 indices | ||
// referencing 3 vertices | ||
std::vector< Tuple3u > faces; | ||
|
||
// current vertex positions after animation | ||
std::vector< Vector3f > currentVertices; | ||
|
||
// list of vertex to joint attachments | ||
// each element of attachments is a vector< float > containing | ||
// one attachment weight per joint | ||
std::vector< std::vector< float > > attachments; | ||
|
||
// 2.1.1. load() should populate bindVertices, currentVertices, and faces | ||
void load(const char *filename); | ||
|
||
// 2.1.2. draw the current mesh. | ||
void draw(); | ||
|
||
// 2.2. Implement this method to load the per-vertex attachment weights | ||
// this method should update m_mesh.attachments | ||
void loadAttachments( const char* filename, int numJoints ); | ||
}; | ||
|
||
#endif |
Oops, something went wrong.