fuckmess
what is this nonsense
BIN
Debug/libsndfile-1.dll
Normal file
BIN
Debug/music.mp3
Normal file
BIN
Debug/openal32.dll
Normal file
BIN
Debug/sfml20test.exe
Normal file
BIN
Debug/sfml20test.ilk
Normal file
BIN
Debug/sfml20test.pdb
Normal file
14
Release/AlecGL.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
#ifndef ALECGL
|
||||
#define ALECGL
|
||||
|
||||
#include "Common.h"
|
||||
#include "Camera.h"
|
||||
#include "Mesh.h"
|
||||
#include "NoiseReader.h"
|
||||
#include "ShaderManager.h"
|
||||
//#include "Texture.h"
|
||||
#include "MatrixStack.h"
|
||||
#include "Map.h"
|
||||
#include "DebugRect.h"
|
||||
|
||||
#endif
|
107
Release/Camera.cpp
Normal file
|
@ -0,0 +1,107 @@
|
|||
#include "Camera.h"
|
||||
|
||||
void agl::Camera::updateMatrix() {
|
||||
matrixToBeUpdated = true;
|
||||
}
|
||||
|
||||
void agl::Camera::updateCamera() {
|
||||
if(matrixToBeUpdated) {
|
||||
camToWorld = glm::rotate(glm::mat4(1.0), -rotation.y, glm::vec3(1.0, 0.0, 0.0)) * glm::rotate(glm::mat4(1.0), -rotation.x, glm::vec3(0.0, 1.0, 0.0)) * glm::translate(glm::mat4(1.0f), -position);
|
||||
lookVector = glm::normalize(glm::vec3(glm::rotate(glm::mat4(1.0), rotation.x, glm::vec3(0.0, 1.0, 0.0)) * glm::rotate(glm::mat4(1.0), rotation.y, glm::vec3(1.0, 0.0, 0.0)) * glm::vec4(0.0,0.0,-1.0,0.0)));
|
||||
}
|
||||
|
||||
matrixToBeUpdated = false;
|
||||
}
|
||||
|
||||
agl::Camera::Camera() {
|
||||
rotation = glm::vec3(0.0);
|
||||
position = glm::vec3(0.0);
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
agl::Camera::Camera(glm::vec3 pos, glm::vec3 rot) {
|
||||
setCamera(pos, rot);
|
||||
}
|
||||
|
||||
agl::Camera::Camera(float px, float py, float pz, float rx, float ry, float rz) {
|
||||
setCamera(px, py, pz, rx, ry, rz);
|
||||
}
|
||||
|
||||
void agl::Camera::setCamera(glm::vec3 pos, glm::vec3 rot) {
|
||||
rotation = rot;
|
||||
position = pos;
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::setCamera(float px, float py, float pz, float rx, float ry, float rz) {
|
||||
rotation = glm::vec3(rx, ry, rz);
|
||||
position = glm::vec3(px, py, pz);
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::setPosition(glm::vec3 pos) {
|
||||
position = pos;
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::setPosition(float x, float y, float z) {
|
||||
position = glm::vec3(x,y,z);
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::setRotation(glm::vec3 ang) {
|
||||
rotation = ang;
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::setRotation(float x, float y, float z) {
|
||||
rotation = glm::vec3(x,y,z);
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::rotateCamera(glm::vec3 ang) {
|
||||
rotation += ang;
|
||||
rotation.y = (rotation.y>90)?90:((rotation.y<-90)?-90:rotation.y);
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::rotateCamera(float x, float y, float z) {
|
||||
rotation += glm::vec3(x,y,z);
|
||||
rotation.y = (rotation.y>90)?90:((rotation.y<-90)?-90:rotation.y);
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::moveCamera(glm::vec3 pos) {
|
||||
position += pos;
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::moveCamera(float x, float y, float z) {
|
||||
position += glm::vec3(x,y,z);
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::move(float dist) {
|
||||
position -= dist*glm::vec3(sin(degToRad(rotation.x)), 0, cos(degToRad(rotation.x)));
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::strafe(float dist) {
|
||||
position -= dist*glm::vec3(sin(degToRad(rotation.x+90)), 0, cos(degToRad(rotation.x+90)));
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
glm::mat4 agl::Camera::getMatrix() {
|
||||
return camToWorld;
|
||||
}
|
||||
|
||||
glm::vec3 agl::Camera::getLookVector() {
|
||||
return lookVector;
|
||||
}
|
||||
|
||||
glm::vec3 agl::Camera::getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
agl::Camera::~Camera() {
|
||||
}
|
54
Release/Camera.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
#include <SFML/Graphics.hpp>
|
||||
#include <GL/glew.h>
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <vector>
|
||||
#include <stdarg.h>
|
||||
#include "Common.h"
|
||||
|
||||
namespace agl {
|
||||
class Camera {
|
||||
glm::mat4 camToWorld;
|
||||
glm::vec3 lookVector;
|
||||
|
||||
glm::vec3 position;
|
||||
glm::vec3 rotation;
|
||||
|
||||
bool matrixToBeUpdated;
|
||||
|
||||
void updateMatrix();
|
||||
|
||||
float degToRad(float deg) {return deg*(M_PI/180);}
|
||||
float radToDeg(float rad) {return rad*(180/M_PI);}
|
||||
public:
|
||||
Camera();
|
||||
Camera(glm::vec3, glm::vec3=glm::vec3(0.0));
|
||||
Camera(float, float, float, float=0.0, float=0.0, float=0.0);
|
||||
|
||||
void setCamera(glm::vec3, glm::vec3=glm::vec3(0.0));
|
||||
void setCamera(float, float, float, float=0.0, float=0.0, float=0.0);
|
||||
|
||||
void setPosition(glm::vec3);
|
||||
void setPosition(float, float, float);
|
||||
|
||||
void setRotation(glm::vec3);
|
||||
void setRotation(float, float, float);
|
||||
|
||||
void rotateCamera(glm::vec3);
|
||||
void rotateCamera(float, float, float);
|
||||
|
||||
void moveCamera(glm::vec3);
|
||||
void moveCamera(float, float, float);
|
||||
|
||||
void move(float); // positive is forward
|
||||
void strafe(float); // positive is right
|
||||
|
||||
void updateCamera();
|
||||
|
||||
glm::mat4 getMatrix();
|
||||
glm::vec3 getLookVector();
|
||||
glm::vec3 getPosition();
|
||||
|
||||
~Camera();
|
||||
};
|
||||
};
|
14
Release/Common.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
#ifndef COMMONH
|
||||
#define COMMONH
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#define M_PI 3.14159
|
||||
|
||||
namespace agl {
|
||||
};
|
||||
|
||||
#endif
|
107
Release/DebugRect.cpp
Normal file
|
@ -0,0 +1,107 @@
|
|||
#include "DebugRect.h"
|
||||
|
||||
GLuint agl::DebugRect::vbuf;
|
||||
GLuint agl::DebugRect::tbuf;
|
||||
GLuint agl::DebugRect::vao;
|
||||
GLuint agl::DebugRect::sample;
|
||||
GLint agl::DebugRect::uDepthMap;
|
||||
float *agl::DebugRect::vdata;
|
||||
float *agl::DebugRect::tdata;
|
||||
agl::ShaderProgram agl::DebugRect::sp;
|
||||
agl::Texture agl::DebugRect::tx;
|
||||
|
||||
void agl::DebugRect::initShader() {
|
||||
agl::DebugRect::vdata = new float[12];
|
||||
/*agl::DebugRect::vdata[0] = 0.5;
|
||||
agl::DebugRect::vdata[1] = 0.5;
|
||||
agl::DebugRect::vdata[2] = 1.0;
|
||||
agl::DebugRect::vdata[3] = 0.5;
|
||||
agl::DebugRect::vdata[4] = 1.0;
|
||||
agl::DebugRect::vdata[5] = 1.0;
|
||||
agl::DebugRect::vdata[6] = 1.0;
|
||||
agl::DebugRect::vdata[7] = 1.0;
|
||||
agl::DebugRect::vdata[8] = 0.5;
|
||||
agl::DebugRect::vdata[9] = 1.0;
|
||||
agl::DebugRect::vdata[10] = 0.5;
|
||||
agl::DebugRect::vdata[11] = 0.5;*/
|
||||
agl::DebugRect::vdata[0] = -1.0;
|
||||
agl::DebugRect::vdata[1] = -1.0;
|
||||
agl::DebugRect::vdata[2] = 1.0;
|
||||
agl::DebugRect::vdata[3] = -1.0;
|
||||
agl::DebugRect::vdata[4] = 1.0;
|
||||
agl::DebugRect::vdata[5] = 1.0;
|
||||
agl::DebugRect::vdata[6] = 1.0;
|
||||
agl::DebugRect::vdata[7] = 1.0;
|
||||
agl::DebugRect::vdata[8] = -1.0;
|
||||
agl::DebugRect::vdata[9] = 1.0;
|
||||
agl::DebugRect::vdata[10] = -1.0;
|
||||
agl::DebugRect::vdata[11] = -1.0;
|
||||
|
||||
agl::DebugRect::tdata = new float[12];
|
||||
agl::DebugRect::tdata[0] = 0.0;
|
||||
agl::DebugRect::tdata[1] = 0.0;
|
||||
agl::DebugRect::tdata[2] = 1.0;
|
||||
agl::DebugRect::tdata[3] = 0.0;
|
||||
agl::DebugRect::tdata[4] = 1.0;
|
||||
agl::DebugRect::tdata[5] = 1.0;
|
||||
agl::DebugRect::tdata[6] = 1.0;
|
||||
agl::DebugRect::tdata[7] = 1.0;
|
||||
agl::DebugRect::tdata[8] = 0.0;
|
||||
agl::DebugRect::tdata[9] = 1.0;
|
||||
agl::DebugRect::tdata[10] = 0.0;
|
||||
agl::DebugRect::tdata[11] = 0.0;
|
||||
|
||||
agl::DebugRect::sp = agl::ShaderProgram();
|
||||
int err = agl::DebugRect::sp.initProgram(2, "dvert.vert", GL_VERTEX_SHADER,
|
||||
"dfrag.frag", GL_FRAGMENT_SHADER);
|
||||
|
||||
if(err == -1) {
|
||||
printf("%s\n", agl::DebugRect::sp.getLastError());
|
||||
getchar();
|
||||
return;
|
||||
}
|
||||
|
||||
uDepthMap = sp.getVariable("depthMap");
|
||||
|
||||
tx = agl::Texture("gabe.png");
|
||||
glGenSamplers(1, &sample);
|
||||
glSamplerParameteri(sample, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glSamplerParameteri(sample, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glSamplerParameteri(sample, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glSamplerParameteri(sample, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
|
||||
glGenBuffers(1, &agl::DebugRect::vbuf);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, agl::DebugRect::vbuf);
|
||||
glBufferData(GL_ARRAY_BUFFER, 12*sizeof(float), agl::DebugRect::vdata, GL_STATIC_DRAW);
|
||||
|
||||
glGenBuffers(1, &agl::DebugRect::tbuf);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, agl::DebugRect::tbuf);
|
||||
glBufferData(GL_ARRAY_BUFFER, 12*sizeof(float), agl::DebugRect::tdata, GL_STATIC_DRAW);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
glGenVertexArrays(1, &agl::DebugRect::vao);
|
||||
glBindVertexArray(agl::DebugRect::vao);
|
||||
glEnableVertexAttribArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, agl::DebugRect::vbuf);
|
||||
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, (void*)0);
|
||||
|
||||
glEnableVertexAttribArray(1);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, agl::DebugRect::tbuf);
|
||||
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, (void*)0);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
void agl::DebugRect::render() {
|
||||
agl::DebugRect::sp.StartProgram();
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindSampler(0, sample);
|
||||
|
||||
tx.bindTexture();
|
||||
|
||||
glBindVertexArray(agl::DebugRect::vao);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
glBindVertexArray(0);
|
||||
agl::DebugRect::sp.EndProgram();
|
||||
}
|
35
Release/DebugRect.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
#ifndef DEBUGRECTH
|
||||
#define DEBUGRECTH
|
||||
|
||||
#define SFML_STATIC
|
||||
#define GLEW_STATIC
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <GL/glew.h>
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "Texture.h"
|
||||
#include "ShaderManager.h"
|
||||
|
||||
namespace agl {
|
||||
class DebugRect {
|
||||
static GLuint vbuf, tbuf, vao, sample;
|
||||
static GLint uDepthMap;
|
||||
|
||||
static float *vdata;
|
||||
static float *tdata;
|
||||
|
||||
static agl::ShaderProgram sp;
|
||||
static agl::Texture tx;
|
||||
|
||||
public:
|
||||
static void initShader();
|
||||
static void render();
|
||||
static void destroy();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
162
Release/Map.cpp
Normal file
|
@ -0,0 +1,162 @@
|
|||
#include "Map.h"
|
||||
|
||||
agl::Map::Map(char *file, std::vector<GLuint> texlist) {
|
||||
loadFromFile(file, texlist);
|
||||
}
|
||||
|
||||
std::vector<std::string> agl::Map::explode(std::string str, std::string params) {
|
||||
std::vector<std::string> list;
|
||||
|
||||
int currentOffset = 0;
|
||||
while(true) {
|
||||
int distFromStart = -1;
|
||||
|
||||
for(int i = 0; i < params.length(); i++) {
|
||||
int pos = str.find(params[i], currentOffset);
|
||||
if((pos < distFromStart || distFromStart == -1) && pos != std::string::npos)
|
||||
distFromStart = pos;
|
||||
}
|
||||
|
||||
if(distFromStart == -1) break;
|
||||
|
||||
list.push_back(str.substr(currentOffset, distFromStart-currentOffset));
|
||||
currentOffset = distFromStart+1;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
int agl::Map::loadFromFile(char *file, std::vector<GLuint> texlist) {
|
||||
FILE *fp;
|
||||
if((fp = fopen(file, "rb")) == NULL) return -1;
|
||||
|
||||
texs = texlist;
|
||||
vertices.resize(texlist.size());
|
||||
normals.resize(texlist.size());
|
||||
textices.resize(texlist.size());
|
||||
|
||||
char buffer[1024];
|
||||
|
||||
while(fgets(buffer, 1024, fp) != NULL) {
|
||||
if(buffer[0] != '#') {
|
||||
auto parameters = explode(buffer, ",;");
|
||||
|
||||
if(parameters.size() != 0) {
|
||||
if(parameters[0][0] == 'f') {
|
||||
glm::vec3 v[] = {
|
||||
glm::vec3(atof(parameters[2].c_str()),atof(parameters[3].c_str()),atof(parameters[4].c_str())),
|
||||
glm::vec3(atof(parameters[2].c_str()),atof(parameters[3].c_str()),atof(parameters[7].c_str())),
|
||||
glm::vec3(atof(parameters[5].c_str()),atof(parameters[6].c_str()),atof(parameters[7].c_str())),
|
||||
glm::vec3(atof(parameters[5].c_str()),atof(parameters[6].c_str()),atof(parameters[4].c_str()))
|
||||
};
|
||||
|
||||
glm::vec2 t[] = {
|
||||
glm::vec2(0.0,0.0),
|
||||
glm::vec2(0.0,16.0),
|
||||
glm::vec2(16.0,16.0),
|
||||
glm::vec2(16.0,0.0)
|
||||
};
|
||||
|
||||
glm::vec3 n = glm::normalize(-glm::cross(v[0]-v[1],v[2]-v[1]));
|
||||
|
||||
int index = atoi(parameters[1].c_str());
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*for(int i = 0; i < 3; i++)
|
||||
vertices[index].push_back(v1[i]);
|
||||
for(int i = 0; i < 3; i++)
|
||||
normals[index].push_back(norm[i]);
|
||||
textices[index].push_back(0.0);
|
||||
textices[index].push_back(0.0);
|
||||
|
||||
vertices[index].push_back(v1[0]);
|
||||
vertices[index].push_back(v1[1]);
|
||||
vertices[index].push_back(v2[2]);
|
||||
for(int i = 0; i < 3; i++)
|
||||
normals[index].push_back(norm[i]);
|
||||
textices[index].push_back(0.0);
|
||||
textices[index].push_back(1.0);
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
vertices[index].push_back(v2[i]);
|
||||
for(int i = 0; i < 3; i++)
|
||||
normals[index].push_back(norm[i]);
|
||||
textices[index].push_back(1.0);
|
||||
textices[index].push_back(1.0);
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
vertices[index].push_back(v2[i]);
|
||||
for(int i = 0; i < 3; i++)
|
||||
normals[index].push_back(norm[i]);
|
||||
textices[index].push_back(1.0);
|
||||
textices[index].push_back(1.0);
|
||||
|
||||
vertices[index].push_back(v2[0]);
|
||||
vertices[index].push_back(v2[1]);
|
||||
vertices[index].push_back(v1[2]);
|
||||
for(int i = 0; i < 3; i++)
|
||||
normals[index].push_back(norm[i]);
|
||||
textices[index].push_back(1.0);
|
||||
textices[index].push_back(0.0);
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
vertices[index].push_back(v1[i]);
|
||||
for(int i = 0; i < 3; i++)
|
||||
normals[index].push_back(norm[i]);
|
||||
textices[index].push_back(0.0);
|
||||
textices[index].push_back(0.0);*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*GLuint vbuf, nbuf, tbuf;
|
||||
|
||||
glGenBuffers(1, &vbuf);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbuf);
|
||||
glBufferData(GL_ARRAY_BUFFER, (vertices[0].size())*sizeof(float), &vertices[0][0], GL_STATIC_DRAW);
|
||||
|
||||
glGenBuffers(1, &nbuf);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, nbuf);
|
||||
glBufferData(GL_ARRAY_BUFFER, (normals[0].size())*sizeof(float), &normals[0][0], GL_STATIC_DRAW);
|
||||
|
||||
glGenBuffers(1, &tbuf);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, tbuf);
|
||||
glBufferData(GL_ARRAY_BUFFER, (textices[0].size())*sizeof(float), &textices[0][0], GL_STATIC_DRAW);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
GLuint vao;
|
||||
|
||||
glGenVertexArrays(1, &vao);
|
||||
glBindVertexArray(vao);
|
||||
glEnableVertexAttribArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbuf);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
|
||||
|
||||
glEnableVertexAttribArray(1);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, nbuf);
|
||||
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
|
||||
|
||||
glEnableVertexAttribArray(2);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, tbuf);
|
||||
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 0, (void*)0);
|
||||
glBindVertexArray(0);
|
||||
|
||||
vaos.push_back(vao);*/
|
||||
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void agl::Map::render() {
|
||||
/*printf("%i\n", vertices[0].size()/3);
|
||||
glBindVertexArray(vaos[0]);
|
||||
glDrawArrays(GL_TRIANGLES, 0, vertices[0].size()/3);
|
||||
glBindVertexArray(0);*/
|
||||
}
|
||||
|
||||
agl::Map::~Map() {
|
||||
|
||||
}
|
47
Release/Map.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
#ifndef MAPH
|
||||
#define MAPH
|
||||
|
||||
#include <stdio.h>
|
||||
#include <GL/glew.h>
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace agl {
|
||||
struct floor {
|
||||
glm::vec3 v1;
|
||||
glm::vec3 v2;
|
||||
GLuint texture;
|
||||
};
|
||||
|
||||
struct wall {
|
||||
glm::vec3 v1;
|
||||
glm::vec3 v2;
|
||||
GLuint texture;
|
||||
};
|
||||
|
||||
class Map {
|
||||
std::vector<floor> floors;
|
||||
std::vector<wall> walls;
|
||||
std::vector<GLuint> texs;
|
||||
|
||||
std::vector<std::vector<float>> vertices;
|
||||
std::vector<std::vector<float>> normals;
|
||||
std::vector<std::vector<float>> textices;
|
||||
|
||||
std::vector<GLuint> vaos;
|
||||
|
||||
std::vector<std::string> explode(std::string, std::string);
|
||||
public:
|
||||
Map();
|
||||
Map(char*, std::vector<GLuint>);
|
||||
|
||||
int loadFromFile(char*, std::vector<GLuint>);
|
||||
|
||||
void render();
|
||||
|
||||
~Map();
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
63
Release/MatrixStack.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
#include "MatrixStack.h"
|
||||
|
||||
agl::MatrixStack::MatrixStack(bool loadWithIdentity) {
|
||||
if(loadWithIdentity)
|
||||
loadIdentity();
|
||||
}
|
||||
|
||||
void agl::MatrixStack::multTopByMatrix(glm::mat4 mat) {
|
||||
glm::mat4 top = stack.top();
|
||||
stack.pop();
|
||||
stack.push(mat * top);
|
||||
}
|
||||
|
||||
void agl::MatrixStack::push() {
|
||||
stack.push(stack.top());
|
||||
}
|
||||
|
||||
void agl::MatrixStack::pop() {
|
||||
if(!stack.empty())
|
||||
stack.pop();
|
||||
else
|
||||
printf("no");
|
||||
}
|
||||
|
||||
void agl::MatrixStack::translate(float x, float y, float z) {
|
||||
multTopByMatrix(glm::translate(glm::mat4(1.0), glm::vec3(x,y,z)));
|
||||
}
|
||||
|
||||
void agl::MatrixStack::translate(glm::vec3 vec) {
|
||||
multTopByMatrix(glm::translate(glm::mat4(1.0), vec));
|
||||
}
|
||||
|
||||
void agl::MatrixStack::scale(float x, float y, float z) {
|
||||
multTopByMatrix(glm::scale(glm::mat4(1.0), glm::vec3(x,y,z)));
|
||||
}
|
||||
|
||||
void agl::MatrixStack::scale(glm::vec3 vec) {
|
||||
multTopByMatrix(glm::scale(glm::mat4(1.0), vec));
|
||||
}
|
||||
|
||||
void agl::MatrixStack::rotatex(float ang) {
|
||||
multTopByMatrix(glm::rotate(glm::mat4(1.0), ang, glm::vec3(1,0,0)));
|
||||
}
|
||||
|
||||
void agl::MatrixStack::rotatey(float ang) {
|
||||
multTopByMatrix(glm::rotate(glm::mat4(1.0), ang, glm::vec3(0,1,0)));
|
||||
}
|
||||
|
||||
void agl::MatrixStack::rotatez(float ang) {
|
||||
multTopByMatrix(glm::rotate(glm::mat4(1.0), ang, glm::vec3(0,0,1)));
|
||||
}
|
||||
|
||||
void agl::MatrixStack::loadIdentity() {
|
||||
stack.push(glm::mat4(1.0));
|
||||
}
|
||||
|
||||
glm::mat4 agl::MatrixStack::top() {
|
||||
if(!stack.empty())
|
||||
return stack.top();
|
||||
}
|
||||
|
||||
agl::MatrixStack::~MatrixStack() {
|
||||
}
|
37
Release/MatrixStack.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
#ifndef MATSTACKH
|
||||
#define MATSTACKH
|
||||
|
||||
#include <stack>
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
namespace agl {
|
||||
class MatrixStack {
|
||||
std::stack<glm::mat4> stack;
|
||||
|
||||
void multTopByMatrix(glm::mat4);
|
||||
public:
|
||||
MatrixStack(bool=true);
|
||||
|
||||
void loadIdentity();
|
||||
|
||||
void push();
|
||||
void pop();
|
||||
|
||||
void translate(float, float, float);
|
||||
void translate(glm::vec3);
|
||||
|
||||
void rotatex(float);
|
||||
void rotatey(float);
|
||||
void rotatez(float);
|
||||
|
||||
void scale(float, float, float);
|
||||
void scale(glm::vec3);
|
||||
|
||||
glm::mat4 top();
|
||||
|
||||
~MatrixStack();
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
43
Release/Mesh.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
#ifndef MESHH
|
||||
#define MESHH
|
||||
|
||||
#define SFML_STATIC
|
||||
#define GLEW_STATIC
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <GL/glew.h>
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace agl {
|
||||
struct Index {
|
||||
int vertexIndex, normalIndex, texIndex;
|
||||
};
|
||||
|
||||
class Mesh {
|
||||
GLuint vao, vbuf, nbuf, tbuf;
|
||||
|
||||
float *vertexData;
|
||||
float *normalData;
|
||||
float *texData;
|
||||
|
||||
int rnum;
|
||||
|
||||
std::vector<glm::vec3> vertices;
|
||||
std::vector<glm::vec3> normals;
|
||||
std::vector<glm::vec2> textices;
|
||||
std::vector<Index> indices;
|
||||
public:
|
||||
Mesh(){};
|
||||
Mesh(char *);
|
||||
int loadFromFile(char *);
|
||||
void Render();
|
||||
void test();
|
||||
~Mesh();
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
135
Release/NoiseReader.cpp
Normal file
|
@ -0,0 +1,135 @@
|
|||
#include "NoiseReader.h"
|
||||
|
||||
agl::NoiseReader::NoiseReader(char *filename) {
|
||||
loadFromFile(filename);
|
||||
}
|
||||
|
||||
float agl::NoiseReader::avgPixel(sf::Color c) {
|
||||
return (c.r+c.g+c.b)/3;
|
||||
}
|
||||
|
||||
int agl::NoiseReader::loadFromFile(char *filename) {
|
||||
sf::Image tmp;
|
||||
tmp.loadFromFile(filename);
|
||||
|
||||
rnum = ((tmp.getSize().x-1)*2)*(tmp.getSize().y-1);
|
||||
|
||||
vertexData = new float[rnum*3*3];
|
||||
normalData = new float[rnum*3*3];
|
||||
texData = new float[rnum*3*2];
|
||||
|
||||
printf("%i %i\n", tmp.getSize().x, tmp.getSize().y);
|
||||
|
||||
glm::vec3 *tmpv = new glm::vec3[3],
|
||||
tmpn;
|
||||
glm::vec2 *tmpt = new glm::vec2[3];
|
||||
|
||||
const float wmult = 1, hmult = .15;
|
||||
|
||||
int i = 0;
|
||||
int ti = 0;
|
||||
for(int y = 0; y < tmp.getSize().y-1; y++) {
|
||||
for(int x = 0; x < tmp.getSize().x-1; x++) {
|
||||
float h[] = {avgPixel(tmp.getPixel(x+1,y)), avgPixel(tmp.getPixel(x,y)), avgPixel(tmp.getPixel(x,y+1))};
|
||||
|
||||
tmpv[0] = glm::vec3((x+1)*wmult,h[0]*hmult,y*wmult);
|
||||
tmpv[1] = glm::vec3(x*wmult,h[1]*hmult,y*wmult);
|
||||
tmpv[2] = glm::vec3(x*wmult,h[2]*hmult,(y+1)*wmult);
|
||||
|
||||
int a = 2;
|
||||
float b = 1.0f/float(a);
|
||||
tmpt[0] = glm::vec2(b+b*(x%a), b+b*(y%a));
|
||||
tmpt[1] = glm::vec2(b*(x%a), b+b*(y%a));
|
||||
tmpt[2] = glm::vec2(b*(x%a), b*(y%a));
|
||||
|
||||
tmpn = -glm::cross(tmpv[0]-tmpv[1],tmpv[2]-tmpv[1]);
|
||||
|
||||
for(int w = 0; w < 3; w++) {
|
||||
vertexData[i] = tmpv[w].x;
|
||||
normalData[i] = tmpn.x;
|
||||
texData[ti] = tmpt[w].x;
|
||||
i++; ti++;
|
||||
|
||||
vertexData[i] = tmpv[w].y;
|
||||
normalData[i] = tmpn.y;
|
||||
texData[ti] = tmpt[w].y;
|
||||
i++; ti++;
|
||||
|
||||
vertexData[i] = tmpv[w].z;
|
||||
normalData[i] = tmpn.z;
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
h[0] = avgPixel(tmp.getPixel(x+1,y));
|
||||
h[1] = avgPixel(tmp.getPixel(x,y+1));
|
||||
h[2] = avgPixel(tmp.getPixel(x+1,y+1));
|
||||
|
||||
tmpv[0] = glm::vec3((x+1)*wmult,h[0]*hmult,y*wmult);
|
||||
tmpv[1] = glm::vec3(x*wmult,h[1]*hmult,(y+1)*wmult);
|
||||
tmpv[2] = glm::vec3((x+1)*wmult,h[2]*hmult,(y+1)*wmult);
|
||||
|
||||
tmpt[0] = glm::vec2(b+b*(x%a), b+b*(y%a));
|
||||
tmpt[1] = glm::vec2(b*(x%a), b*(y%a));
|
||||
tmpt[2] = glm::vec2(b+b*(x%a), b*(y%a));
|
||||
|
||||
tmpn = glm::cross(tmpv[0]-tmpv[2],tmpv[1]-tmpv[2]);
|
||||
|
||||
for(int w = 0; w < 3; w++) {
|
||||
vertexData[i] = tmpv[w].x;
|
||||
normalData[i] = tmpn.x;
|
||||
texData[ti] = tmpt[w].x;
|
||||
i++; ti++;
|
||||
|
||||
vertexData[i] = tmpv[w].y;
|
||||
normalData[i] = tmpn.y;
|
||||
texData[ti] = tmpt[w].y;
|
||||
i++; ti++;
|
||||
|
||||
vertexData[i] = tmpv[w].z;
|
||||
normalData[i] = tmpn.z;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glGenBuffers(1, &vbuf);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbuf);
|
||||
glBufferData(GL_ARRAY_BUFFER, (rnum*3*3)*sizeof(float), vertexData, GL_STATIC_DRAW);
|
||||
|
||||
glGenBuffers(1, &nbuf);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, nbuf);
|
||||
glBufferData(GL_ARRAY_BUFFER, (rnum*3*3)*sizeof(float), normalData, GL_STATIC_DRAW);
|
||||
|
||||
glGenBuffers(1, &tbuf);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, tbuf);
|
||||
glBufferData(GL_ARRAY_BUFFER, (rnum*3*2)*sizeof(float), texData, GL_STATIC_DRAW);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
glGenVertexArrays(1, &vao);
|
||||
glBindVertexArray(vao);
|
||||
glEnableVertexAttribArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbuf);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
|
||||
|
||||
glEnableVertexAttribArray(1);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, nbuf);
|
||||
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
|
||||
|
||||
glEnableVertexAttribArray(2);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, tbuf);
|
||||
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 0, (void*)0);
|
||||
glBindVertexArray(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void agl::NoiseReader::Render() {
|
||||
glBindVertexArray(vao);
|
||||
glDrawArrays(GL_TRIANGLES, 0, rnum*3);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
agl::NoiseReader::~NoiseReader() {
|
||||
}
|
34
Release/NoiseReader.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
#ifndef NOISEH
|
||||
#define NOISEH
|
||||
|
||||
#define SFML_STATIC
|
||||
#define GLEW_STATIC
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <GL/glew.h>
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace agl {
|
||||
class NoiseReader {
|
||||
GLuint vao, vbuf, nbuf, tbuf;
|
||||
|
||||
int rnum;
|
||||
|
||||
float *vertexData;
|
||||
float *normalData;
|
||||
float *texData;
|
||||
float avgPixel(sf::Color);
|
||||
public:
|
||||
NoiseReader(){};
|
||||
NoiseReader(char *);
|
||||
int loadFromFile(char *);
|
||||
void Render();
|
||||
~NoiseReader();
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
37
Release/ShaderManager.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
#ifndef SHADERMANH
|
||||
#define SHADERMANH
|
||||
|
||||
#define SFML_STATIC
|
||||
#define GLEW_STATIC
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <glm/glm.hpp>
|
||||
#include <String>
|
||||
#include <map>
|
||||
#include <stdarg.h>
|
||||
|
||||
namespace agl {
|
||||
class ShaderProgram {
|
||||
GLuint program;
|
||||
char *err;
|
||||
|
||||
std::map<std::string, GLint> uniformMap;
|
||||
char* readFile(char*);
|
||||
public:
|
||||
ShaderProgram() { program = 0; };
|
||||
|
||||
int initProgram(int, ...);
|
||||
|
||||
void StartProgram();
|
||||
void EndProgram();
|
||||
|
||||
GLint getVariable(char *varname);
|
||||
|
||||
char* getLastError();
|
||||
GLuint getProgram();
|
||||
|
||||
~ShaderProgram();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
109
Release/Texture.cpp
Normal file
|
@ -0,0 +1,109 @@
|
|||
#include "Texture.h"
|
||||
|
||||
agl::Texture::Texture(char *file) {
|
||||
loadFromFile(file);
|
||||
}
|
||||
|
||||
int agl::Texture::loadFromFile(char *file) {
|
||||
fps = 1;
|
||||
index = 0;
|
||||
clk = new sf::Clock();
|
||||
|
||||
img.push_back(new sf::Image());
|
||||
if(img[img.size()-1]->loadFromFile(file) == false) return -1;
|
||||
img[img.size()-1]->flipVertically();
|
||||
|
||||
texids.push_back(0);
|
||||
glGenTextures(1, &texids[texids.size()-1]);
|
||||
glBindTexture(GL_TEXTURE_2D, texids[texids.size()-1]);
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img[img.size()-1]->getSize().x,
|
||||
img[img.size()-1]->getSize().y, 0, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
img[img.size()-1]->getPixelsPtr());
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
agl::Texture::Texture(float ifps, int imageCount, ...) {
|
||||
fps = ifps;
|
||||
index = 0;
|
||||
clk = new sf::Clock();
|
||||
|
||||
va_list args;
|
||||
va_start(args, imageCount);
|
||||
for(int i = 0; i < imageCount; i++) {
|
||||
img.push_back(new sf::Image());
|
||||
img[img.size()-1]->loadFromFile(va_arg(args, char*));
|
||||
img[img.size()-1]->flipVertically();
|
||||
|
||||
texids.push_back(0);
|
||||
glGenTextures(1, &texids[texids.size()-1]);
|
||||
glBindTexture(GL_TEXTURE_2D, texids[texids.size()-1]);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img[img.size()-1]->getSize().x,
|
||||
img[img.size()-1]->getSize().y, 0, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
img[img.size()-1]->getPixelsPtr());
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
}
|
||||
|
||||
GLuint agl::Texture::getTextureId() {
|
||||
return texids[0];
|
||||
}
|
||||
|
||||
int agl::Texture::addImageFromFile(char *file) {
|
||||
img.push_back(new sf::Image());
|
||||
if(img[img.size()-1]->loadFromFile(file) == false) return -1;
|
||||
img[img.size()-1]->flipVertically();
|
||||
|
||||
texids.push_back(0);
|
||||
glGenTextures(1, &texids[texids.size()-1]);
|
||||
glBindTexture(GL_TEXTURE_2D, texids[texids.size()-1]);
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img[img.size()-1]->getSize().x,
|
||||
img[img.size()-1]->getSize().y, 0, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
img[img.size()-1]->getPixelsPtr());
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int agl::Texture::loadFromFile(float ifps, int imageCount, ...) {
|
||||
fps = ifps;
|
||||
index = 0;
|
||||
clk = new sf::Clock();
|
||||
|
||||
va_list args;
|
||||
va_start(args, imageCount);
|
||||
for(int i = 0; i < imageCount; i++) {
|
||||
img.push_back(new sf::Image());
|
||||
img[img.size()-1]->loadFromFile(va_arg(args, char*));
|
||||
img[img.size()-1]->flipVertically();
|
||||
|
||||
texids.push_back(0);
|
||||
glGenTextures(1, &texids[texids.size()-1]);
|
||||
glBindTexture(GL_TEXTURE_2D, texids[texids.size()-1]);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img[img.size()-1]->getSize().x,
|
||||
img[img.size()-1]->getSize().y, 0, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
img[img.size()-1]->getPixelsPtr());
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void agl::Texture::bindTexture() {
|
||||
if(clk->getElapsedTime().asSeconds() >= 1.f/fps) {
|
||||
index++;
|
||||
clk->restart();
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, texids[index%img.size()]);
|
||||
}
|
||||
|
||||
void agl::Texture::unbindTexture() {
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
|
||||
agl::Texture::~Texture() {
|
||||
}
|
27
Release/Texture.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include <SFML/Graphics.hpp>
|
||||
#include <GL/glew.h>
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <vector>
|
||||
#include <stdarg.h>
|
||||
|
||||
namespace agl {
|
||||
class Texture {
|
||||
std::vector<sf::Image*> img;
|
||||
std::vector<GLuint> texids;
|
||||
sf::Clock *clk;
|
||||
int index;
|
||||
float fps;
|
||||
public:
|
||||
Texture() {};
|
||||
Texture(char*);
|
||||
Texture(float, int, ...);
|
||||
int addImageFromFile(char*);
|
||||
int loadFromFile(char*);
|
||||
int loadFromFile(float, int, ...);
|
||||
void bindTexture();
|
||||
void unbindTexture();
|
||||
GLuint getTextureId();
|
||||
~Texture();
|
||||
};
|
||||
};
|
BIN
Release/arial.ttf
Normal file
2575
Release/ball.obj
Normal file
BIN
Release/ball.png
Normal file
After ![]() (image error) Size: 41 KiB |
BIN
Release/bramdan.png
Normal file
After ![]() (image error) Size: 141 KiB |
BIN
Release/bricks.png
Normal file
After ![]() (image error) Size: 654 KiB |
BIN
Release/carpet.png
Normal file
After ![]() (image error) Size: 2.7 MiB |
16718
Release/cone.obj
Normal file
37
Release/cube.obj
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Blender v2.67 (sub 0) OBJ File: ''
|
||||
# www.blender.org
|
||||
mtllib cube.mtl
|
||||
o Cube
|
||||
v 1.000000 -1.000000 -1.000000
|
||||
v 1.000000 -1.000000 1.000000
|
||||
v -1.000000 -1.000000 1.000000
|
||||
v -1.000000 -1.000000 -1.000000
|
||||
v 1.000000 1.000000 -1.000000
|
||||
v 1.000000 1.000000 1.000000
|
||||
v -1.000000 1.000000 1.000000
|
||||
v -1.000000 1.000000 -1.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 0.000000
|
||||
vn 0.000000 -1.000000 0.000000
|
||||
vn -0.000000 1.000000 0.000000
|
||||
vn 1.000000 -0.000000 0.000000
|
||||
vn -0.000000 -0.000000 1.000000
|
||||
vn -1.000000 -0.000000 -0.000000
|
||||
vn 0.000000 0.000000 -1.000000
|
||||
vn 1.000000 0.000000 -0.000000
|
||||
usemtl Material
|
||||
s off
|
||||
f 1/1/1 2/2/1 3/3/1
|
||||
f 5/1/2 8/2/2 7/3/2
|
||||
f 1/1/3 5/2/3 6/3/3
|
||||
f 2/1/4 6/2/4 3/4/4
|
||||
f 3/1/5 7/2/5 4/4/5
|
||||
f 5/1/6 1/2/6 4/3/6
|
||||
f 4/4/1 1/1/1 3/3/1
|
||||
f 6/4/2 5/1/2 7/3/2
|
||||
f 2/4/7 1/1/7 6/3/7
|
||||
f 6/2/4 7/3/4 3/4/4
|
||||
f 7/2/5 8/3/5 4/4/5
|
||||
f 8/4/6 5/1/6 4/3/6
|
71211
Release/cyl.obj
Normal file
10
Release/dfrag.frag
Normal file
|
@ -0,0 +1,10 @@
|
|||
#version 330
|
||||
|
||||
in vec2 textex;
|
||||
out vec4 frag;
|
||||
uniform sampler2D depthMap;
|
||||
|
||||
void main() {
|
||||
//frag = vec4(0.0,0.0,0.0,1.0);
|
||||
frag = texture(depthMap, textex);
|
||||
}
|
10
Release/dvert.vert
Normal file
|
@ -0,0 +1,10 @@
|
|||
#version 330
|
||||
|
||||
layout(location = 0) in vec2 position;
|
||||
layout(location = 1) in vec2 tex;
|
||||
out vec2 textex;
|
||||
|
||||
void main() {
|
||||
textex = tex;
|
||||
gl_Position = vec4(position, 0.0, 1.0);
|
||||
}
|
BIN
Release/empty.png
Normal file
After ![]() (image error) Size: 1.6 KiB |
54
Release/fragment.frag
Normal file
|
@ -0,0 +1,54 @@
|
|||
#version 330
|
||||
#define M_PI 3.1415926535897932384626433832795
|
||||
|
||||
in vec2 ftextex;
|
||||
in vec3 vnorm;
|
||||
in vec3 vpos;
|
||||
|
||||
out vec4 cout;
|
||||
|
||||
uniform sampler2D texcol;
|
||||
|
||||
uniform bool enableFlashlight;
|
||||
|
||||
uniform mat4 modelToCam;
|
||||
uniform vec3 lightPos;
|
||||
uniform vec4 lightIntensity;
|
||||
uniform vec4 ambIntensity;
|
||||
|
||||
uniform vec3 lookPos;
|
||||
uniform vec3 lookVector;
|
||||
|
||||
uniform vec3 flashLightPos;
|
||||
uniform vec3 flashLightDir;
|
||||
uniform vec4 flashLightIntensity;
|
||||
|
||||
vec4 getLightIntensity(in float dist) {
|
||||
return lightIntensity * (1/(1 + .1 * dist));
|
||||
}
|
||||
|
||||
float deg2Rad(float deg) {
|
||||
return (deg*M_PI)/180;
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
vec3 vcpos = vec3(modelToCam * vec4(vpos, 1.0));
|
||||
|
||||
vec3 fragToLight = lightPos - vcpos;
|
||||
float uccostheta = dot(vnorm, normalize(fragToLight));
|
||||
float costheta = clamp(uccostheta, 0, 1);
|
||||
|
||||
vec3 fragToFlashlight = vcpos - flashLightPos;
|
||||
float component = 1-clamp(abs(acos(dot(normalize(fragToFlashlight),normalize(flashLightDir))))/(deg2Rad(10)),0,1);
|
||||
component = pow(component, 4.0/3.0);
|
||||
int check = (dot(vnorm,-normalize(fragToFlashlight))>=0)?1:0;
|
||||
float distFactor = 1/(1+.001*dot(fragToFlashlight,fragToFlashlight));
|
||||
|
||||
vec4 tcol = texture(texcol, ftextex);
|
||||
vec4 coutt = tcol*getLightIntensity(dot(fragToLight,fragToLight))*costheta
|
||||
+ ((enableFlashlight) ? tcol*flashLightIntensity*component*check*distFactor : vec4(0.0))
|
||||
+ tcol*ambIntensity;
|
||||
//cout = vec4(coutt.rgb, tcol.a);
|
||||
cout = vec4(coutt.r, coutt.g, coutt.b, tcol.a);
|
||||
//cout = vec4(ftextex.x/8,ftextex.x/8,ftextex.x/8,1.0);
|
||||
}
|
BIN
Release/gabe.JPG
Normal file
After (image error) Size: 5.4 MiB |
BIN
Release/grass.png
Normal file
After ![]() (image error) Size: 741 KiB |
BIN
Release/karaoke.mp3
Normal file
17
Release/level.map
Normal file
|
@ -0,0 +1,17 @@
|
|||
# FORMAT:
|
||||
# - TYPE
|
||||
# - F is Floor
|
||||
# - W is Wall
|
||||
# - C is Ceiling
|
||||
#
|
||||
# seperated by commas
|
||||
#
|
||||
# - TEXTURE ID
|
||||
# - 1: grass
|
||||
# - 2: wall thing
|
||||
#
|
||||
# - VERTEX 1
|
||||
# - X, Y, Z
|
||||
# - Z is carried over to other vertex on that edge
|
||||
|
||||
f,0,25,0,25,-25,0,-25,20,20,30,30;
|
BIN
Release/libsndfile-1.dll
Normal file
204
Release/main - Copy.cpp
Normal file
|
@ -0,0 +1,204 @@
|
|||
#define SFML_STATIC
|
||||
#define GLEW_STATIC
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <GL/glew.h>
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include "ShaderManager.h"
|
||||
#define PI 3.14159
|
||||
|
||||
double degToRad(double deg) {return deg*(PI/180.f);}
|
||||
double radToDeg(double rad) {return rad*(180.f/PI);}
|
||||
|
||||
glm::mat4 calcCameraMatrix(glm::vec3 &camTarget, glm::vec3 &camSphere);
|
||||
|
||||
int main() {
|
||||
sf::RenderWindow window(sf::VideoMode(200, 200), "opengl or something", sf::Style::Default, sf::ContextSettings(32));
|
||||
window.setVerticalSyncEnabled(true);
|
||||
|
||||
if(glewInit() != GLEW_OK) return -1;
|
||||
|
||||
agl::ShaderProgram shader;
|
||||
int err = shader.initProgram(2, "vertex.vert" , GL_VERTEX_SHADER,
|
||||
"fragment.frag" , GL_FRAGMENT_SHADER);
|
||||
|
||||
if(err == -1) {
|
||||
printf("%s\n", shader.getLastError());
|
||||
getchar();
|
||||
return -1;
|
||||
}
|
||||
|
||||
GLuint sp = shader.getProgram();
|
||||
|
||||
GLint camToClip = glGetUniformLocation(sp, "camToClip"),
|
||||
worldToCam = glGetUniformLocation(sp, "worldToCam"),
|
||||
modelToWorld = glGetUniformLocation(sp, "modelToWorld");
|
||||
|
||||
glm::mat4 frustum = glm::perspective<float>(90.0f, window.getSize().x/window.getSize().y, 1.0, 1000.0);
|
||||
|
||||
//glm::vec3 camTarget(-38.f, -104.f, -94.f);
|
||||
glm::vec3 camTarget(0, .4f, 0);
|
||||
glm::vec3 camSphereCoords(67.5f, -46.0f, 150.0f);
|
||||
|
||||
GLuint vao, vbuf, vabuf;
|
||||
|
||||
const float vertexData[] = {
|
||||
+1.0f, +1.0f, +1.0f, // 0
|
||||
+1.0f, +1.0f, -1.0f, // 1
|
||||
+1.0f, -1.0f, +1.0f, // 2
|
||||
+1.0f, -1.0f, -1.0f, // 3
|
||||
-1.0f, +1.0f, +1.0f, // 4
|
||||
-1.0f, +1.0f, -1.0f, // 5
|
||||
-1.0f, -1.0f, +1.0f, // 6
|
||||
-1.0f, -1.0f, -1.0f // 7
|
||||
|
||||
+0.0f, +0.0f, +0.0f,
|
||||
+0.0f, +0.0f, +1.0f,
|
||||
+0.0f, +1.0f, +0.0f,
|
||||
+0.0f, +1.0f, +1.0f,
|
||||
+1.0f, +0.0f, +0.0f,
|
||||
+1.0f, +0.0f, +1.0f,
|
||||
+1.0f, +1.0f, +0.0f,
|
||||
+1.0f, +1.0f, +1.0f
|
||||
};
|
||||
|
||||
const GLshort indexData[] = {
|
||||
// front
|
||||
4, 0, 6,
|
||||
0, 2, 6,
|
||||
|
||||
// right
|
||||
0, 1, 2,
|
||||
1, 3, 2,
|
||||
|
||||
// back
|
||||
1, 5, 3,
|
||||
5, 7, 3,
|
||||
|
||||
// left
|
||||
5, 4, 7,
|
||||
4, 6, 7,
|
||||
|
||||
// top
|
||||
5, 1, 4,
|
||||
1, 0, 4,
|
||||
|
||||
// bottom
|
||||
3, 7, 2,
|
||||
7, 6, 2
|
||||
};
|
||||
|
||||
glGenBuffers(1, &vbuf);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbuf);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(vertexData), vertexData, GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
glGenBuffers(1, &vabuf);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vabuf);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indexData), indexData, GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
glGenVertexArrays(1, &vao);
|
||||
glBindVertexArray(vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbuf);
|
||||
size_t cpos = sizeof(float)*24; // 3*8
|
||||
|
||||
glEnableVertexAttribArray(0);
|
||||
glEnableVertexAttribArray(1);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
|
||||
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, (void*)cpos);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vabuf);
|
||||
glBindVertexArray(0);
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_BACK);
|
||||
glFrontFace(GL_CW);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_TRUE);
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
glDepthRange(0.0, 1.0);
|
||||
|
||||
sf::Clock clk;
|
||||
|
||||
shader.StartProgram();
|
||||
glUniformMatrix4fv(camToClip, 1, GL_FALSE, &frustum[0][0]);
|
||||
shader.EndProgram();
|
||||
|
||||
while (window.isOpen()) {
|
||||
glClearColor(0.0,0.0,0.0,0.0);
|
||||
glClearDepth(1.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
shader.StartProgram();
|
||||
glBindVertexArray(vao);
|
||||
|
||||
glm::mat4 model = glm::scale(glm::mat4(1.0f), glm::vec3(50.f, 50.f, 50.f));
|
||||
printf("camtarget %f %f %f\n", camTarget.x, camTarget.y, camTarget.z);
|
||||
glUniformMatrix4fv(worldToCam, 1, GL_FALSE, &(calcCameraMatrix(camTarget, camSphereCoords))[0][0]);
|
||||
glUniformMatrix4fv(modelToWorld, 1, GL_FALSE, &model[0][0]);
|
||||
glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, 0);
|
||||
|
||||
glBindVertexArray(0);
|
||||
shader.EndProgram();
|
||||
|
||||
window.display();
|
||||
|
||||
sf::Event event;
|
||||
while (window.pollEvent(event)) {
|
||||
if (event.type == sf::Event::Closed)
|
||||
window.close();
|
||||
else if(event.type == sf::Event::Resized) {
|
||||
glViewport(0, 0, event.size.width, event.size.height);
|
||||
frustum = glm::perspective<float>(90.0f, float(event.size.width)/float(event.size.height), 0.5, 100.0);
|
||||
shader.StartProgram();
|
||||
glUniformMatrix4fv(camToClip, 1, GL_FALSE, &frustum[0][0]);
|
||||
shader.EndProgram();
|
||||
}
|
||||
}
|
||||
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::A)) camTarget.x -= .1f;
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::D)) camTarget.x += .1f;
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::W)) camTarget.z -= .1f;
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::S)) camTarget.z += .1f;
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Q)) camTarget.y -= .1f;
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::E)) camTarget.y += .1f;
|
||||
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::I)) camSphereCoords.y -= .1f;
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::K)) camSphereCoords.y += .1f;
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::J)) camSphereCoords.x -= .1f;
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::L)) camSphereCoords.x += .1f;
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::U)) camSphereCoords.z -= .1f;
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::O)) camSphereCoords.z += .1f;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
glm::mat4 calcCameraMatrix(glm::vec3 &camTarget, glm::vec3 &camSphere) {
|
||||
float phi = degToRad(camSphere.x);
|
||||
float theta = degToRad(camSphere.y + 90.f);
|
||||
float radius = camSphere.z;
|
||||
|
||||
glm::vec3 dirToCam(sin(theta)*cos(phi), cos(theta), sin(theta)*sin(phi));
|
||||
glm::vec3 camPt = (dirToCam * radius) + camTarget;
|
||||
printf("%f %f %f\n", camPt.x, camPt.y, camPt.z);
|
||||
|
||||
glm::vec3 lookDir = glm::normalize(camTarget - camPt);
|
||||
glm::vec3 upDir = glm::normalize(glm::vec3(0.0f, 1.0, 0.0f));
|
||||
|
||||
glm::vec3 rightDir = glm::normalize(glm::cross(lookDir, upDir));
|
||||
glm::vec3 perpUpDir = glm::cross(rightDir, lookDir);
|
||||
|
||||
glm::mat4 rotMat(1.0f);
|
||||
rotMat[0] = glm::vec4(rightDir, 0.0f);
|
||||
rotMat[1] = glm::vec4(perpUpDir, 0.0f);
|
||||
rotMat[2] = glm::vec4(-lookDir, 0.0f);
|
||||
|
||||
rotMat = glm::transpose(rotMat);
|
||||
|
||||
glm::mat4 transMat(1.0f);
|
||||
transMat[3] = glm::vec4(-camPt, 1.0f);
|
||||
|
||||
return rotMat * transMat;
|
||||
}
|
282
Release/main.cpp
Normal file
|
@ -0,0 +1,282 @@
|
|||
#define SFML_STATIC
|
||||
#define GLEW_STATIC
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <SFML/Audio.hpp>
|
||||
#include <GL/glew.h>
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include "AlecGL.h"
|
||||
#define PI 3.14159
|
||||
|
||||
float degToRad(float deg) {return deg*(PI/180);}
|
||||
float radToDeg(float rad) {return rad*(180/PI);}
|
||||
|
||||
int main() {
|
||||
sf::RenderWindow window(sf::VideoMode(1024, 512), "opengl or something", sf::Style::Default, sf::ContextSettings(32));
|
||||
window.setVerticalSyncEnabled(true);
|
||||
|
||||
HWND__ *wnd = window.getSystemHandle();
|
||||
//ShowWindow(wnd, SW_MAXIMIZE);
|
||||
|
||||
if(glewInit() != GLEW_OK) return -1;
|
||||
|
||||
agl::ShaderProgram shader;
|
||||
int err = shader.initProgram(2, "vertex.vert" , GL_VERTEX_SHADER,
|
||||
"fragment.frag" , GL_FRAGMENT_SHADER);
|
||||
|
||||
if(err == -1) {
|
||||
printf("%s\n", shader.getLastError());
|
||||
getchar();
|
||||
return -1;
|
||||
}
|
||||
|
||||
GLuint sampid = 0;
|
||||
|
||||
GLint modelToCam = shader.getVariable("modelToCam"),
|
||||
camToWorld = shader.getVariable("camToWorld"),
|
||||
worldToClip = shader.getVariable("worldToClip"),
|
||||
utime = shader.getVariable("time"),
|
||||
texcol = shader.getVariable("texcol"),
|
||||
lPos = shader.getVariable("lightPos"),
|
||||
aInt = shader.getVariable("ambIntensity"),
|
||||
lInt = shader.getVariable("lightIntensity"),
|
||||
tScale = shader.getVariable("texScaleFactor"),
|
||||
tOff = shader.getVariable("texOffsetFactor"),
|
||||
flPos = shader.getVariable("flashLightPos"),
|
||||
flDir = shader.getVariable("flashLightDir"),
|
||||
flInt = shader.getVariable("flashLightIntensity"),
|
||||
enFlash = shader.getVariable("enableFlashlight"),
|
||||
loVec = shader.getVariable("lookVector"),
|
||||
loPos = shader.getVariable("lookPos");
|
||||
|
||||
glm::mat4 frustum = glm::perspective<float>(45.0f, window.getSize().x/window.getSize().y, 1.0, 1000.0);
|
||||
|
||||
sf::Music big;
|
||||
if(!big.openFromFile("weed.ogg")) return -1;
|
||||
big.setLoop(true);
|
||||
big.setVolume(0);
|
||||
|
||||
agl::Mesh test("cube.obj"),
|
||||
sphere("monkey.obj"),
|
||||
plane("plane.obj");
|
||||
|
||||
agl::DebugRect::initShader();
|
||||
|
||||
//agl::NoiseReader test("noise.png");
|
||||
|
||||
/*agl::Texture tex(20.f, 1, "head/0000.png");
|
||||
char cbuf[255];
|
||||
for(int i = 1; i < 19; i++) {
|
||||
sprintf(cbuf, "head/00%s%i.png", ((i<10)?"0":""), i);
|
||||
tex.addImageFromFile(cbuf);
|
||||
}*/
|
||||
|
||||
agl::Texture grass("grass.png");
|
||||
agl::Texture wall("wall.png");
|
||||
agl::Texture tex("ball.png");
|
||||
|
||||
std::vector<GLuint> texlist;
|
||||
texlist.push_back(grass.getTextureId());
|
||||
texlist.push_back(wall.getTextureId());
|
||||
|
||||
agl::Map testmap("level.map", texlist);
|
||||
|
||||
agl::Camera cam(0,0,0);
|
||||
|
||||
agl::MatrixStack stack;
|
||||
|
||||
glGenSamplers(1, &sampid);
|
||||
glSamplerParameteri(sampid, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glSamplerParameteri(sampid, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glSamplerParameteri(sampid, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glSamplerParameteri(sampid, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_BACK);
|
||||
glFrontFace(GL_CCW);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_TRUE);
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
glDepthRange(0.0, 1.0);
|
||||
|
||||
sf::Clock clk;
|
||||
|
||||
glm::mat4 offset(1.0f), model(1.0f);
|
||||
glm::vec3 displacement(-0.f, -0.f, 4.f),
|
||||
lookVector(0.0,0.0,0.0),
|
||||
flvec(0.0),
|
||||
soundpos(0.0);
|
||||
float rot = 180, vrot = 0;
|
||||
|
||||
bool flashlightEnabled = true;
|
||||
bool mouseLock = true;
|
||||
|
||||
shader.StartProgram();
|
||||
glUniform1i(texcol, 0);
|
||||
glUniformMatrix4fv(worldToClip, 1, GL_FALSE, &frustum[0][0]);
|
||||
glUniform4f(aInt, 0.15, 0.15, 0.15, 1.0);
|
||||
glUniform4f(lInt, 0.9, 0.9, 0.9, 1.0);
|
||||
glUniform4f(flInt, 0.9, 0.9, 0.9, 1.0);
|
||||
shader.EndProgram();
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
big.play();
|
||||
while (window.isOpen()) {
|
||||
window.setMouseCursorVisible(!mouseLock);
|
||||
cam.updateCamera();
|
||||
if(mouseLock) sf::Mouse::setPosition(sf::Vector2i(window.getSize().x/2, window.getSize().y/2));
|
||||
|
||||
glClearColor(0.529,0.808,0.922,1.0);
|
||||
glClearDepth(1.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
float time = clk.getElapsedTime().asSeconds();
|
||||
|
||||
model = cam.getMatrix();//glm::rotate(glm::mat4(1.0), vrot, glm::vec3(1.0, 0.0, 0.0)) * glm::rotate(glm::mat4(1.0), rot, glm::vec3(0.0, 1.0, 0.0)) * glm::translate(glm::mat4(1.0f), displacement);
|
||||
lookVector = cam.getLookVector();//glm::normalize(glm::vec3(glm::rotate(glm::mat4(1.0), -rot, glm::vec3(0.0, 1.0, 0.0)) * glm::rotate(glm::mat4(1.0), -vrot, glm::vec3(1.0, 0.0, 0.0)) * glm::vec4(0.0,0.0,-1.0,0.0)));
|
||||
|
||||
soundpos = glm::vec3(model * glm::vec4(0.0f,0.0f,0.0f,1.0f));
|
||||
big.setPosition(soundpos.x, soundpos.y, soundpos.z);
|
||||
//printf("%f %f %f\n", soundpos.x, soundpos.y, soundpos.z);
|
||||
|
||||
agl::DebugRect::render();
|
||||
|
||||
shader.StartProgram();
|
||||
|
||||
glUniform3f(lPos, 5.5*cos(time), 6, 5.5*sin(3*time));
|
||||
glUniform3f(loPos, cam.getPosition().x, cam.getPosition().y, cam.getPosition().z);//-displacement.x, -displacement.y, -displacement.z);
|
||||
glUniform3f(loVec, lookVector.x, lookVector.y, lookVector.z);
|
||||
glUniform3f(flPos, cam.getPosition().x, cam.getPosition().y, cam.getPosition().z);//-displacement.x, -displacement.y, -displacement.z);
|
||||
glUniform3f(flDir, lookVector.x, lookVector.y, lookVector.z);
|
||||
|
||||
glUniform1i(enFlash, flashlightEnabled);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindSampler(0, sampid);
|
||||
|
||||
glUniform1f(utime, time);
|
||||
glUniformMatrix4fv(camToWorld, 1, GL_FALSE, &model[0][0]);
|
||||
|
||||
/*glBindTexture(GL_TEXTURE_2D, carpetid);
|
||||
|
||||
glUniform2f(tScale, 22.0, 22.0);
|
||||
|
||||
offset = glm::scale(glm::mat4(1.0f), glm::vec3(30, 1, 30));
|
||||
glUniformMatrix4fv(modelToCam, 1, GL_FALSE, &offset[0][0]);
|
||||
plane.Render();
|
||||
|
||||
offset = glm::translate(glm::mat4(1.0f), glm::vec3(0,15,0)) * glm::scale(glm::mat4(1.0f), glm::vec3(30, 1, 30));
|
||||
glUniformMatrix4fv(modelToCam, 1, GL_FALSE, &offset[0][0]);
|
||||
plane.Render();
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, bricksid);
|
||||
|
||||
glUniform2f(tScale, 8.0, 4.0);
|
||||
|
||||
offset = glm::translate(glm::mat4(1.0f), glm::vec3(0,15.0f/2.0f,15)) * glm::rotate(glm::mat4(1.0f), 90.f, glm::vec3(1,0,0)) * glm::scale(glm::mat4(1.0f), glm::vec3(30, 1, 15));
|
||||
glUniformMatrix4fv(modelToCam, 1, GL_FALSE, &offset[0][0]);
|
||||
plane.Render();
|
||||
|
||||
offset = glm::translate(glm::mat4(1.0f), glm::vec3(0,15.0f/2.0f,-15)) * glm::rotate(glm::mat4(1.0f), 90.f, glm::vec3(1,0,0)) * glm::scale(glm::mat4(1.0f), glm::vec3(30, 1, 15));
|
||||
glUniformMatrix4fv(modelToCam, 1, GL_FALSE, &offset[0][0]);
|
||||
plane.Render();
|
||||
|
||||
offset = glm::translate(glm::mat4(1.0f), glm::vec3(15,15.0f/2.0f,0)) * glm::rotate(glm::mat4(1.0f), 90.f, glm::vec3(1,0,0)) * glm::rotate(glm::mat4(1.0f), 90.f, glm::vec3(0,0,1)) * glm::scale(glm::mat4(1.0f), glm::vec3(30, 1, 15));
|
||||
glUniformMatrix4fv(modelToCam, 1, GL_FALSE, &offset[0][0]);
|
||||
plane.Render();
|
||||
|
||||
offset = glm::translate(glm::mat4(1.0f), glm::vec3(-15,15.0f/2.0f,0)) * glm::rotate(glm::mat4(1.0f), 90.f, glm::vec3(1,0,0)) * glm::rotate(glm::mat4(1.0f), 90.f, glm::vec3(0,0,1)) * glm::scale(glm::mat4(1.0f), glm::vec3(30, 1, 15));
|
||||
glUniformMatrix4fv(modelToCam, 1, GL_FALSE, &offset[0][0]);
|
||||
plane.Render();*/
|
||||
|
||||
|
||||
//glBindTexture(GL_TEXTURE_2D, carpetid);
|
||||
|
||||
glUniform2f(tScale, 1.0, 1.0);
|
||||
glUniform2f(tOff, 0.0, 0.0);
|
||||
|
||||
grass.bindTexture();
|
||||
|
||||
glUniformMatrix4fv(modelToCam, 1, GL_FALSE, &glm::mat4(1.0)[0][0]);
|
||||
testmap.render();
|
||||
|
||||
tex.bindTexture();
|
||||
|
||||
stack.push();
|
||||
|
||||
stack.rotatex(time*50);
|
||||
stack.scale(.5, .5, .5);
|
||||
stack.translate(1, 1, 1);
|
||||
|
||||
glUniformMatrix4fv(modelToCam, 1, GL_FALSE, &stack.top()[0][0]);
|
||||
sphere.Render();
|
||||
|
||||
stack.pop();
|
||||
|
||||
|
||||
/*offset = glm::translate(glm::mat4(1.0f), glm::vec3(3, 1, 0)); //glm::translate(glm::mat4(1.0f), glm::vec3(4*cos(time), 4.0, 4*sin(time))) * glm::rotate(glm::mat4(1.0), time*60, glm::vec3(0.0, 1.0, 1.0)) * glm::scale(glm::mat4(1.0f), glm::vec3(.5f, .5f, .5f));
|
||||
glUniformMatrix4fv(modelToCam, 1, GL_FALSE, &offset[0][0]);
|
||||
sphere.Render();*/
|
||||
|
||||
tex.unbindTexture();
|
||||
glBindSampler(0, 0);
|
||||
|
||||
shader.EndProgram();
|
||||
|
||||
window.display();
|
||||
|
||||
sf::Event event;
|
||||
while (window.pollEvent(event)) {
|
||||
if (event.type == sf::Event::Closed)
|
||||
window.close();
|
||||
else if(event.type == sf::Event::KeyPressed) {
|
||||
if(event.key.code == sf::Keyboard::Z)
|
||||
flashlightEnabled = !flashlightEnabled;
|
||||
if(event.key.code == sf::Keyboard::Escape)
|
||||
mouseLock = !mouseLock;
|
||||
} else if(event.type == sf::Event::LostFocus)
|
||||
mouseLock = false;
|
||||
else if(event.type == sf::Event::GainedFocus)
|
||||
mouseLock = true;
|
||||
else if(event.type == sf::Event::Resized) {
|
||||
glViewport(0, 0, event.size.width, event.size.height);
|
||||
frustum = glm::perspective<float>(50.0f, float(event.size.width)/float(event.size.height), 0.5, 1000.0);
|
||||
shader.StartProgram();
|
||||
glUniformMatrix4fv(worldToClip, 1, GL_FALSE, &frustum[0][0]);
|
||||
shader.EndProgram();
|
||||
}
|
||||
}
|
||||
|
||||
float step = .15f;
|
||||
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::LShift)) step = .5f;
|
||||
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::W)) cam.move(step);
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::S)) cam.move(-step);
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::A)) cam.strafe(step);
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::D)) cam.strafe(-step);
|
||||
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Q)) cam.moveCamera(0, step, 0);
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::E)) cam.moveCamera(0, -step, 0);
|
||||
|
||||
if(mouseLock) {
|
||||
float dx = (float(sf::Mouse::getPosition().x) - float(window.getSize().x/2))/5.f;
|
||||
float dy = (float(sf::Mouse::getPosition().y) - float(window.getSize().y/2))/5.f;
|
||||
if(dx != 0 || dy != 0) {
|
||||
cam.rotateCamera(-dx, -dy, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*if(sf::Keyboard::isKeyPressed(sf::Keyboard::A)) rot -= 1.f; old mouse controls
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::D)) rot += 1.f;
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Q)) vrot -= 1.f;
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::E)) vrot += 1.f;*/
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
107
Release/mesh.cpp
Normal file
|
@ -0,0 +1,107 @@
|
|||
#include "Mesh.h"
|
||||
|
||||
agl::Mesh::Mesh(char *filename) {
|
||||
loadFromFile(filename);
|
||||
}
|
||||
|
||||
int agl::Mesh::loadFromFile(char *filename) {
|
||||
char line[1024], *giblet;
|
||||
int bytesRead, count = 0, type = 0;
|
||||
std::string aids;
|
||||
FILE *fp = fopen(filename, "rb");
|
||||
glm::vec3 tmpv;
|
||||
Index tmpix[3];
|
||||
|
||||
while(!feof(fp)) {
|
||||
fgets(line, 1024, fp);
|
||||
|
||||
if(line[0] == 'v' && line[1] == ' ') {
|
||||
sscanf(line, "%*s %f %f %f", &tmpv.x, &tmpv.y, &tmpv.z);
|
||||
vertices.push_back(tmpv);
|
||||
} else if(line[0] == 'v' && line[1] == 'n') {
|
||||
sscanf(line, "%*s %f %f %f", &tmpv.x, &tmpv.y, &tmpv.z);
|
||||
normals.push_back(tmpv);
|
||||
} else if(line[0] == 'v' && line[1] == 't') {
|
||||
sscanf(line, "%*s %f %f", &tmpv.x, &tmpv.y);
|
||||
textices.push_back(glm::vec2(tmpv));
|
||||
} else if(line[0] == 'f' && line[1] == ' ') {
|
||||
sscanf(line, "%*s %i/%i/%i %i/%i/%i %i/%i/%i", &tmpix[0].vertexIndex, &tmpix[0].texIndex, &tmpix[0].normalIndex, &tmpix[1].vertexIndex, &tmpix[1].texIndex, &tmpix[1].normalIndex, &tmpix[2].vertexIndex, &tmpix[2].texIndex, &tmpix[2].normalIndex);
|
||||
indices.push_back(tmpix[0]);
|
||||
indices.push_back(tmpix[1]);
|
||||
indices.push_back(tmpix[2]);
|
||||
} else continue;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
vertexData = new float[indices.size()*3];
|
||||
normalData = new float[indices.size()*3];
|
||||
texData = new float[indices.size()*2];
|
||||
|
||||
for(int i = 0; i < indices.size(); i++) {
|
||||
vertexData[i*3] = vertices[indices[i].vertexIndex - 1].x;
|
||||
vertexData[i*3+1] = vertices[indices[i].vertexIndex - 1].y;
|
||||
vertexData[i*3+2] = vertices[indices[i].vertexIndex - 1].z;
|
||||
|
||||
normalData[i*3] = normals[indices[i].normalIndex - 1].x;
|
||||
normalData[i*3+1] = normals[indices[i].normalIndex - 1].y;
|
||||
normalData[i*3+2] = normals[indices[i].normalIndex - 1].z;
|
||||
|
||||
texData[i*2] = textices[indices[i].texIndex - 1].x;
|
||||
texData[i*2+1] = textices[indices[i].texIndex - 1].y;
|
||||
}
|
||||
|
||||
glGenBuffers(1, &vbuf);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbuf);
|
||||
glBufferData(GL_ARRAY_BUFFER, (indices.size()*3)*sizeof(float), vertexData, GL_STATIC_DRAW);
|
||||
|
||||
glGenBuffers(1, &nbuf);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, nbuf);
|
||||
glBufferData(GL_ARRAY_BUFFER, (indices.size()*3)*sizeof(float), normalData, GL_STATIC_DRAW);
|
||||
|
||||
glGenBuffers(1, &tbuf);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, tbuf);
|
||||
glBufferData(GL_ARRAY_BUFFER, (indices.size()*2)*sizeof(float), texData, GL_STATIC_DRAW);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
glGenVertexArrays(1, &vao);
|
||||
glBindVertexArray(vao);
|
||||
glEnableVertexAttribArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbuf);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
|
||||
|
||||
glEnableVertexAttribArray(1);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, nbuf);
|
||||
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
|
||||
|
||||
glEnableVertexAttribArray(2);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, tbuf);
|
||||
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 0, (void*)0);
|
||||
glBindVertexArray(0);
|
||||
|
||||
rnum = indices.size();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void agl::Mesh::Render() {
|
||||
glBindVertexArray(vao);
|
||||
glDrawArrays(GL_TRIANGLES, 0, rnum);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
void agl::Mesh::test() {
|
||||
printf("VERTICES:\n");
|
||||
for(int i = 0; i < rnum*3; i+=3)
|
||||
printf("(%f, %f, %f)\n", vertexData[i], vertexData[i+1], vertexData[i+2]);
|
||||
printf("\nNORMALS:\n");
|
||||
for(int i = 0; i < rnum*3; i+=3)
|
||||
printf("(%f, %f, %f)\n", normalData[i], normalData[i+1], normalData[i+2]);
|
||||
printf("\nTEXTICES:\n");
|
||||
for(int i = 0; i < rnum*2; i+=2)
|
||||
printf("(%f, %f)\n", texData[i], texData[i+1]);
|
||||
}
|
||||
|
||||
agl::Mesh::~Mesh() {
|
||||
}
|
2978
Release/monkey.obj
Normal file
5820
Release/monkeyshoe.obj
Normal file
BIN
Release/music.mp3
Normal file
BIN
Release/music.ogg
Normal file
BIN
Release/no.png
Normal file
After ![]() (image error) Size: 984 B |
BIN
Release/noise.png
Normal file
After ![]() (image error) Size: 936 B |
BIN
Release/noise2.png
Normal file
After ![]() (image error) Size: 37 KiB |
65
Release/octahedron.obj
Normal file
|
@ -0,0 +1,65 @@
|
|||
# Created with Anim8or 0.95
|
||||
# Object "cone":
|
||||
# ComRec:
|
||||
g mesh01
|
||||
# No. points 6:
|
||||
v 0 2 0
|
||||
v 2 0 0
|
||||
v 0 0 2
|
||||
v -2 0 0
|
||||
v 0 0 -2
|
||||
v 0 -2 0
|
||||
|
||||
# No. normals 32:
|
||||
vn 0.57735 0.57735 0.57735
|
||||
vn -0.57735 0.57735 0.57735
|
||||
vn -0.57735 0.57735 -0.57735
|
||||
vn 0.57735 0.57735 -0.57735
|
||||
vn 0.57735 -0.57735 0.57735
|
||||
vn -0.57735 -0.57735 0.57735
|
||||
vn -0.57735 -0.57735 -0.57735
|
||||
vn 0.57735 -0.57735 -0.57735
|
||||
vn 0.57735 0.57735 0.57735
|
||||
vn 0.57735 0.57735 -0.57735
|
||||
vn -0.57735 0.57735 -0.57735
|
||||
vn -0.57735 0.57735 0.57735
|
||||
vn 0.57735 0.57735 0.57735
|
||||
vn 0.57735 -0.57735 -0.57735
|
||||
vn 0.57735 -0.57735 0.57735
|
||||
vn 0.57735 0.57735 -0.57735
|
||||
vn 0.57735 0.57735 0.57735
|
||||
vn -0.57735 -0.57735 0.57735
|
||||
vn 0.57735 -0.57735 0.57735
|
||||
vn -0.57735 0.57735 0.57735
|
||||
vn -0.57735 0.57735 0.57735
|
||||
vn -0.57735 -0.57735 -0.57735
|
||||
vn -0.57735 -0.57735 0.57735
|
||||
vn -0.57735 0.57735 -0.57735
|
||||
vn -0.57735 0.57735 -0.57735
|
||||
vn 0.57735 -0.57735 -0.57735
|
||||
vn -0.57735 -0.57735 -0.57735
|
||||
vn 0.57735 0.57735 -0.57735
|
||||
vn 0.57735 -0.57735 0.57735
|
||||
vn 0.57735 -0.57735 -0.57735
|
||||
vn -0.57735 -0.57735 -0.57735
|
||||
vn -0.57735 -0.57735 0.57735
|
||||
|
||||
# No. texture coordinates 6:
|
||||
vt 0.50000 1
|
||||
vt 1 0.50000
|
||||
vt 0.50000 0.50000
|
||||
vt 0 0.50000
|
||||
vt 0.50000 0.50000
|
||||
vt 0.50000 0
|
||||
|
||||
# No. faces 8:
|
||||
f 3/3/17 2/2/13 1/1/9
|
||||
f 4/4/21 3/3/20 1/1/12
|
||||
f 5/5/25 4/4/24 1/1/11
|
||||
f 2/2/16 5/5/28 1/1/10
|
||||
f 2/2/15 3/3/19 6/6/29
|
||||
f 3/3/18 4/4/23 6/6/32
|
||||
f 4/4/22 5/5/27 6/6/31
|
||||
f 5/5/26 2/2/14 6/6/30
|
||||
|
||||
|
BIN
Release/openal32.dll
Normal file
30
Release/plane.obj
Normal file
|
@ -0,0 +1,30 @@
|
|||
# Created with Anim8or 0.95
|
||||
# Object "plane":
|
||||
# Begin Group:
|
||||
# ComRec:
|
||||
g mesh01
|
||||
# No. points 4:
|
||||
v -0.50000 0 -0.50000
|
||||
v -0.50000 0 0.50000
|
||||
v 0.50000 0 -0.50000
|
||||
v 0.50000 0 0.50000
|
||||
|
||||
# No. normals 6:
|
||||
vn 0 1 0
|
||||
vn 0 -1 0
|
||||
|
||||
# No. texture coordinates 4:
|
||||
vt 0 0
|
||||
vt 0 1
|
||||
vt 1 0
|
||||
vt 1 1
|
||||
|
||||
# No. faces 2:
|
||||
f 1/1/1 2/2/1 4/4/1
|
||||
f 1/1/1 4/4/1 3/3/1
|
||||
f 4/4/2 2/2/2 1/1/2
|
||||
f 3/3/2 4/4/2 1/1/2
|
||||
|
||||
|
||||
# End Group:
|
||||
|
14
Release/resource.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by shaders.rc
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
BIN
Release/samface2.jpg
Normal file
After ![]() (image error) Size: 54 KiB |
BIN
Release/sfml20test.exe
Normal file
BIN
Release/sfml20test.pdb
Normal file
BIN
Release/shaders.aps
Normal file
1060512
Release/sphere.obj
Normal file
1045
Release/sphere2.obj
Normal file
3613
Release/spherer.obj
Normal file
BIN
Release/test.png
Normal file
After ![]() (image error) Size: 1.5 KiB |
BIN
Release/test2.png
Normal file
After ![]() (image error) Size: 1.5 KiB |
752
Release/thing.obj
Normal file
|
@ -0,0 +1,752 @@
|
|||
# Created with Anim8or 0.95
|
||||
# Object "thing":
|
||||
# Begin Group:
|
||||
# ComRec:
|
||||
g mesh01
|
||||
# No. points 132:
|
||||
v -0.00025 -0.00076 0.60933
|
||||
v 0.50899 -0.00112 0.33451
|
||||
v -0.47710 0.17833 0.33469
|
||||
v 0.38393 -0.33445 0.33497
|
||||
v 0.54138 0.17761 -0.21496
|
||||
v 0.06920 -0.33422 0.50483
|
||||
v -0.56976 0.02373 -0.21431
|
||||
v -0.44471 0.35706 -0.21478
|
||||
v 0.27155 0.20512 0.50407
|
||||
v 0.29126 -0.48905 -0.21403
|
||||
v 0.13398 0.02323 -0.59411
|
||||
v 0.06453 0.35670 -0.48960
|
||||
v -0.33819 -0.48861 0.12568
|
||||
v -0.38743 0.45261 0.12452
|
||||
v -0.18558 -0.30997 -0.48867
|
||||
v -0.58978 -0.08673 0.12528
|
||||
v 0.06651 0.59007 0.12416
|
||||
v 0.08622 -0.10409 -0.59393
|
||||
v 0.31631 0.45211 -0.25528
|
||||
v -0.30580 -0.30988 -0.42379
|
||||
v 0.42869 -0.08745 -0.42437
|
||||
v -0.54323 -0.10365 -0.25423
|
||||
v 0.17907 0.54780 0.18900
|
||||
v 0.38092 -0.21478 -0.42420
|
||||
v -0.22562 -0.53088 0.19051
|
||||
v -0.34089 0.43569 -0.25499
|
||||
v -0.02616 0.43547 -0.42484
|
||||
v -0.05886 -0.54788 -0.25388
|
||||
v 0.05886 0.54788 0.25388
|
||||
v -0.56325 -0.21411 0.08536
|
||||
v 0.28362 -0.53124 -0.08432
|
||||
v -0.17907 -0.54780 -0.18900
|
||||
v 0.54323 0.10365 0.25423
|
||||
v 0.56325 0.21411 -0.08536
|
||||
v 0.34089 -0.43569 0.25499
|
||||
v 0.22562 0.53088 -0.19051
|
||||
v -0.28362 0.53124 0.08432
|
||||
v -0.31631 -0.45211 0.25528
|
||||
v -0.08622 0.10409 0.59393
|
||||
v -0.38092 0.21478 0.42420
|
||||
v 0.02616 -0.43547 0.42484
|
||||
v 0.38743 -0.45261 -0.12452
|
||||
v 0.33819 0.48861 -0.12568
|
||||
v 0.30580 0.30988 0.42379
|
||||
v -0.06651 -0.59007 -0.12416
|
||||
v 0.58978 0.08673 -0.12528
|
||||
v -0.42869 0.08745 0.42437
|
||||
v -0.13398 -0.02323 0.59411
|
||||
v -0.29126 0.48905 0.21403
|
||||
v 0.18558 0.30997 0.48867
|
||||
v 0.56976 -0.02373 0.21431
|
||||
v -0.06920 0.33422 -0.50483
|
||||
v -0.27155 -0.20512 -0.50407
|
||||
v 0.44471 -0.35706 0.21478
|
||||
v -0.06453 -0.35670 0.48960
|
||||
v -0.54138 -0.17761 0.21496
|
||||
v -0.38393 0.33445 -0.33497
|
||||
v 0.47710 -0.17833 -0.33469
|
||||
v -0.50899 0.00112 -0.33451
|
||||
v 0.00025 0.00076 -0.60933
|
||||
v 0.24668 -0.09309 0.45754
|
||||
v -0.00025 -0.00076 0.60933
|
||||
v 0.50899 -0.00112 0.33451
|
||||
v 0.06920 -0.33422 0.50483
|
||||
v 0.27155 0.20512 0.50407
|
||||
v 0.38393 -0.33445 0.33497
|
||||
v -0.49376 0.18500 0.03108
|
||||
v -0.47710 0.17833 0.33469
|
||||
v -0.56976 0.02373 -0.21431
|
||||
v -0.38743 0.45261 0.12452
|
||||
v -0.58978 -0.08673 0.12528
|
||||
v -0.44471 0.35706 -0.21478
|
||||
v 0.29698 0.18444 -0.39567
|
||||
v 0.06453 0.35670 -0.48960
|
||||
v 0.42869 -0.08745 -0.42437
|
||||
v 0.31631 0.45211 -0.25528
|
||||
v 0.13398 0.02323 -0.59411
|
||||
v 0.54138 0.17761 -0.21496
|
||||
v 0.10279 -0.33315 -0.39494
|
||||
v 0.08622 -0.10409 -0.59393
|
||||
v -0.05886 -0.54788 -0.25388
|
||||
v 0.38092 -0.21478 -0.42420
|
||||
v -0.18558 -0.30997 -0.48867
|
||||
v 0.29126 -0.48905 -0.21403
|
||||
v -0.38591 -0.33281 -0.13120
|
||||
v -0.33819 -0.48861 0.12568
|
||||
v -0.30580 -0.30988 -0.42379
|
||||
v -0.56325 -0.21411 0.08536
|
||||
v -0.17907 -0.54780 -0.18900
|
||||
v -0.54323 -0.10365 -0.25423
|
||||
v -0.07171 0.50467 -0.13237
|
||||
v 0.06651 0.59007 0.12416
|
||||
v -0.34089 0.43569 -0.25499
|
||||
v 0.22562 0.53088 -0.19051
|
||||
v -0.28362 0.53124 0.08432
|
||||
v -0.02616 0.43547 -0.42484
|
||||
v 0.38591 0.33281 0.13120
|
||||
v 0.56325 0.21411 -0.08536
|
||||
v 0.30580 0.30988 0.42379
|
||||
v 0.33819 0.48861 -0.12568
|
||||
v 0.54323 0.10365 0.25423
|
||||
v 0.17907 0.54780 0.18900
|
||||
v 0.07171 -0.50467 0.13237
|
||||
v 0.34089 -0.43569 0.25499
|
||||
v -0.06651 -0.59007 -0.12416
|
||||
v 0.02616 -0.43547 0.42484
|
||||
v 0.28362 -0.53124 -0.08432
|
||||
v -0.22562 -0.53088 0.19051
|
||||
v -0.10279 0.33315 0.39494
|
||||
v 0.05886 0.54788 0.25388
|
||||
v -0.08622 0.10409 0.59393
|
||||
v -0.29126 0.48905 0.21403
|
||||
v 0.18558 0.30997 0.48867
|
||||
v -0.38092 0.21478 0.42420
|
||||
v -0.29698 -0.18444 0.39567
|
||||
v -0.31631 -0.45211 0.25528
|
||||
v -0.42869 0.08745 0.42437
|
||||
v -0.06453 -0.35670 0.48960
|
||||
v -0.54138 -0.17761 0.21496
|
||||
v -0.13398 -0.02323 0.59411
|
||||
v 0.49376 -0.18500 -0.03108
|
||||
v 0.56976 -0.02373 0.21431
|
||||
v 0.47710 -0.17833 -0.33469
|
||||
v 0.44471 -0.35706 0.21478
|
||||
v 0.58978 0.08673 -0.12528
|
||||
v 0.38743 -0.45261 -0.12452
|
||||
v -0.24668 0.09309 -0.45754
|
||||
v -0.50899 0.00112 -0.33451
|
||||
v 0.00025 0.00076 -0.60933
|
||||
v -0.38393 0.33445 -0.33497
|
||||
v -0.27155 -0.20512 -0.50407
|
||||
v -0.06920 0.33422 -0.50483
|
||||
|
||||
# No. normals 332:
|
||||
vn 0.17005 0.93412 0.31386
|
||||
vn 0.17005 0.93412 0.31386
|
||||
vn 0.17005 0.93412 0.31386
|
||||
vn 0.17005 0.93412 0.31386
|
||||
vn -0.48622 -0.81626 0.31194
|
||||
vn -0.48622 -0.81626 0.31194
|
||||
vn -0.48622 -0.81626 0.31194
|
||||
vn -0.48622 -0.81626 0.31194
|
||||
vn 0.52762 -0.81648 -0.23447
|
||||
vn 0.52762 -0.81648 -0.23447
|
||||
vn 0.52762 -0.81648 -0.23447
|
||||
vn 0.52762 -0.81648 -0.23447
|
||||
vn 0.93483 0.26779 -0.23320
|
||||
vn 0.93483 0.26779 -0.23320
|
||||
vn 0.93483 0.26779 -0.23320
|
||||
vn 0.93483 0.26779 -0.23320
|
||||
vn -0.70882 0.26685 0.65297
|
||||
vn -0.70882 0.26685 0.65297
|
||||
vn -0.70882 0.26685 0.65297
|
||||
vn -0.70882 0.26685 0.65297
|
||||
vn -0.01593 0.62400 -0.78126
|
||||
vn -0.01593 0.62400 -0.78126
|
||||
vn -0.01593 0.62400 -0.78126
|
||||
vn -0.01593 0.62400 -0.78126
|
||||
vn -0.42182 -0.46055 -0.78100
|
||||
vn -0.42182 -0.46055 -0.78100
|
||||
vn -0.42182 -0.46055 -0.78100
|
||||
vn -0.42182 -0.46055 -0.78100
|
||||
vn -0.64399 0.62374 -0.44296
|
||||
vn -0.64399 0.62374 -0.44297
|
||||
vn -0.64399 0.62374 -0.44297
|
||||
vn -0.64399 0.62374 -0.44297
|
||||
vn -0.12070 0.04667 0.99159
|
||||
vn -0.12070 0.04667 0.99159
|
||||
vn -0.12070 0.04667 0.99159
|
||||
vn -0.12070 0.04667 0.99159
|
||||
vn -0.89496 -0.04737 -0.44363
|
||||
vn -0.89496 -0.04737 -0.44363
|
||||
vn -0.89496 -0.04737 -0.44363
|
||||
vn -0.89496 -0.04737 -0.44363
|
||||
vn 0.89496 0.04737 0.44363
|
||||
vn 0.89496 0.04737 0.44363
|
||||
vn 0.89496 0.04737 0.44363
|
||||
vn 0.89496 0.04737 0.44363
|
||||
vn 0.12070 -0.04667 -0.99159
|
||||
vn 0.12070 -0.04667 -0.99159
|
||||
vn 0.12070 -0.04667 -0.99159
|
||||
vn 0.12070 -0.04667 -0.99159
|
||||
vn 0.64399 -0.62374 0.44296
|
||||
vn 0.64399 -0.62374 0.44297
|
||||
vn 0.64399 -0.62374 0.44297
|
||||
vn 0.64399 -0.62374 0.44297
|
||||
vn 0.01593 -0.62400 0.78126
|
||||
vn 0.01593 -0.62400 0.78126
|
||||
vn 0.01593 -0.62400 0.78126
|
||||
vn 0.01593 -0.62400 0.78126
|
||||
vn 0.70882 -0.26685 -0.65297
|
||||
vn 0.70882 -0.26685 -0.65297
|
||||
vn 0.70882 -0.26685 -0.65297
|
||||
vn 0.70882 -0.26685 -0.65297
|
||||
vn 0.42182 0.46055 0.78100
|
||||
vn 0.42182 0.46055 0.78100
|
||||
vn 0.42182 0.46055 0.78100
|
||||
vn 0.42182 0.46055 0.78100
|
||||
vn -0.93483 -0.26779 0.23320
|
||||
vn -0.93483 -0.26779 0.23320
|
||||
vn -0.93483 -0.26779 0.23320
|
||||
vn -0.93483 -0.26779 0.23320
|
||||
vn -0.52762 0.81648 0.23447
|
||||
vn -0.52762 0.81648 0.23447
|
||||
vn -0.52762 0.81648 0.23447
|
||||
vn -0.52762 0.81648 0.23447
|
||||
vn 0.48622 0.81626 -0.31194
|
||||
vn 0.48622 0.81626 -0.31194
|
||||
vn 0.48622 0.81626 -0.31194
|
||||
vn 0.48622 0.81626 -0.31194
|
||||
vn -0.17005 -0.93412 -0.31386
|
||||
vn -0.17005 -0.93412 -0.31386
|
||||
vn -0.17005 -0.93412 -0.31386
|
||||
vn -0.17005 -0.93412 -0.31386
|
||||
vn 0.46758 -0.17420 0.86662
|
||||
vn 0.46758 -0.17421 0.86662
|
||||
vn 0.46757 -0.17421 0.86662
|
||||
vn 0.46758 -0.17421 0.86662
|
||||
vn 0.46757 -0.17421 0.86662
|
||||
vn -0.93462 0.35073 0.05899
|
||||
vn -0.93462 0.35073 0.05899
|
||||
vn -0.93462 0.35073 0.05899
|
||||
vn -0.93462 0.35073 0.05899
|
||||
vn -0.93462 0.35073 0.05899
|
||||
vn 0.56288 0.35165 -0.74800
|
||||
vn 0.56288 0.35165 -0.74800
|
||||
vn 0.56288 0.35166 -0.74800
|
||||
vn 0.56288 0.35165 -0.74800
|
||||
vn 0.56288 0.35166 -0.74800
|
||||
vn 0.19191 -0.63568 -0.74772
|
||||
vn 0.19191 -0.63568 -0.74772
|
||||
vn 0.19191 -0.63568 -0.74772
|
||||
vn 0.19191 -0.63568 -0.74772
|
||||
vn 0.19191 -0.63568 -0.74772
|
||||
vn -0.73048 -0.63561 -0.24981
|
||||
vn -0.73048 -0.63561 -0.24981
|
||||
vn -0.73048 -0.63561 -0.24980
|
||||
vn -0.73048 -0.63561 -0.24981
|
||||
vn -0.73048 -0.63561 -0.24981
|
||||
vn -0.13305 0.95964 -0.24779
|
||||
vn -0.13305 0.95964 -0.24779
|
||||
vn -0.13305 0.95964 -0.24779
|
||||
vn -0.13305 0.95964 -0.24779
|
||||
vn -0.13305 0.95964 -0.24779
|
||||
vn 0.73048 0.63561 0.24981
|
||||
vn 0.73048 0.63561 0.24981
|
||||
vn 0.73048 0.63561 0.24981
|
||||
vn 0.73048 0.63561 0.24981
|
||||
vn 0.73048 0.63561 0.24980
|
||||
vn 0.13305 -0.95964 0.24779
|
||||
vn 0.13305 -0.95964 0.24779
|
||||
vn 0.13305 -0.95964 0.24779
|
||||
vn 0.13305 -0.95964 0.24779
|
||||
vn 0.13305 -0.95964 0.24779
|
||||
vn -0.19191 0.63568 0.74772
|
||||
vn -0.19191 0.63568 0.74772
|
||||
vn -0.19191 0.63568 0.74772
|
||||
vn -0.19191 0.63568 0.74772
|
||||
vn -0.19191 0.63568 0.74772
|
||||
vn -0.56289 -0.35165 0.74800
|
||||
vn -0.56288 -0.35165 0.74800
|
||||
vn -0.56288 -0.35166 0.74800
|
||||
vn -0.56288 -0.35165 0.74800
|
||||
vn -0.56288 -0.35166 0.74800
|
||||
vn 0.93462 -0.35073 -0.05899
|
||||
vn 0.93462 -0.35073 -0.05899
|
||||
vn 0.93462 -0.35073 -0.05899
|
||||
vn 0.93462 -0.35073 -0.05899
|
||||
vn 0.93462 -0.35073 -0.05899
|
||||
vn -0.46758 0.17420 -0.86662
|
||||
vn -0.46757 0.17421 -0.86662
|
||||
vn -0.46758 0.17421 -0.86662
|
||||
vn -0.46757 0.17421 -0.86662
|
||||
vn -0.46758 0.17421 -0.86662
|
||||
vn 0.17005 0.93412 0.31386
|
||||
vn -0.48622 -0.81626 0.31194
|
||||
vn 0.17005 0.93412 0.31386
|
||||
vn 0.52762 -0.81648 -0.23447
|
||||
vn 0.17005 0.93412 0.31386
|
||||
vn -0.48622 -0.81626 0.31194
|
||||
vn -0.48622 -0.81626 0.31194
|
||||
vn 0.93483 0.26779 -0.23320
|
||||
vn 0.17005 0.93412 0.31386
|
||||
vn 0.52762 -0.81648 -0.23447
|
||||
vn 0.52762 -0.81648 -0.23447
|
||||
vn -0.70882 0.26685 0.65297
|
||||
vn -0.48622 -0.81626 0.31194
|
||||
vn -0.01593 0.62400 -0.78126
|
||||
vn 0.17005 0.93412 0.31386
|
||||
vn -0.42182 -0.46055 -0.78100
|
||||
vn 0.93483 0.26779 -0.23320
|
||||
vn -0.70882 0.26685 0.65297
|
||||
vn -0.48622 -0.81626 0.31194
|
||||
vn 0.93483 0.26779 -0.23320
|
||||
vn 0.52762 -0.81648 -0.23447
|
||||
vn -0.64399 0.62374 -0.44297
|
||||
vn 0.17005 0.93412 0.31386
|
||||
vn -0.42182 -0.46055 -0.78100
|
||||
vn 0.52762 -0.81648 -0.23447
|
||||
vn -0.70882 0.26685 0.65297
|
||||
vn -0.01593 0.62400 -0.78126
|
||||
vn -0.12070 0.04667 0.99159
|
||||
vn -0.48622 -0.81626 0.31194
|
||||
vn -0.01593 0.62400 -0.78126
|
||||
vn -0.42182 -0.46055 -0.78100
|
||||
vn -0.12070 0.04667 0.99159
|
||||
vn 0.93483 0.26779 -0.23320
|
||||
vn -0.70882 0.26685 0.65297
|
||||
vn 0.93483 0.26779 -0.23320
|
||||
vn -0.89496 -0.04737 -0.44363
|
||||
vn -0.64399 0.62374 -0.44296
|
||||
vn 0.89496 0.04737 0.44363
|
||||
vn 0.52762 -0.81648 -0.23447
|
||||
vn -0.64399 0.62374 -0.44297
|
||||
vn -0.42182 -0.46055 -0.78100
|
||||
vn 0.89496 0.04737 0.44363
|
||||
vn -0.70882 0.26685 0.65297
|
||||
vn 0.12070 -0.04667 -0.99159
|
||||
vn -0.01593 0.62400 -0.78126
|
||||
vn -0.12070 0.04667 0.99159
|
||||
vn -0.01593 0.62400 -0.78126
|
||||
vn 0.64399 -0.62374 0.44297
|
||||
vn -0.42182 -0.46055 -0.78100
|
||||
vn -0.12070 0.04667 0.99159
|
||||
vn -0.70882 0.26685 0.65297
|
||||
vn 0.12070 -0.04667 -0.99159
|
||||
vn 0.93483 0.26779 -0.23320
|
||||
vn -0.89496 -0.04737 -0.44363
|
||||
vn -0.89496 -0.04737 -0.44363
|
||||
vn 0.64399 -0.62374 0.44296
|
||||
vn -0.64399 0.62374 -0.44296
|
||||
vn 0.89496 0.04737 0.44363
|
||||
vn -0.64399 0.62374 -0.44297
|
||||
vn 0.01593 -0.62400 0.78126
|
||||
vn -0.42182 -0.46055 -0.78100
|
||||
vn 0.89496 0.04737 0.44363
|
||||
vn 0.12070 -0.04667 -0.99159
|
||||
vn 0.01593 -0.62400 0.78126
|
||||
vn -0.12070 0.04667 0.99159
|
||||
vn 0.70882 -0.26685 -0.65297
|
||||
vn -0.01593 0.62400 -0.78126
|
||||
vn 0.64399 -0.62374 0.44297
|
||||
vn -0.12070 0.04667 0.99159
|
||||
vn 0.70882 -0.26685 -0.65297
|
||||
vn 0.12070 -0.04667 -0.99159
|
||||
vn 0.42182 0.46055 0.78100
|
||||
vn -0.89496 -0.04737 -0.44363
|
||||
vn 0.42182 0.46055 0.78100
|
||||
vn -0.89496 -0.04737 -0.44363
|
||||
vn 0.64399 -0.62374 0.44296
|
||||
vn 0.89496 0.04737 0.44363
|
||||
vn -0.93483 -0.26779 0.23320
|
||||
vn -0.64399 0.62374 -0.44297
|
||||
vn 0.01593 -0.62400 0.78126
|
||||
vn 0.89496 0.04737 0.44363
|
||||
vn -0.93483 -0.26779 0.23320
|
||||
vn 0.12070 -0.04667 -0.99159
|
||||
vn 0.01593 -0.62400 0.78126
|
||||
vn 0.70882 -0.26685 -0.65297
|
||||
vn -0.52762 0.81648 0.23447
|
||||
vn 0.64399 -0.62374 0.44297
|
||||
vn -0.52762 0.81648 0.23447
|
||||
vn 0.70882 -0.26685 -0.65297
|
||||
vn -0.93483 -0.26779 0.23320
|
||||
vn 0.12070 -0.04667 -0.99159
|
||||
vn 0.42182 0.46055 0.78100
|
||||
vn -0.89496 -0.04737 -0.44363
|
||||
vn 0.42182 0.46055 0.78100
|
||||
vn 0.64399 -0.62374 0.44297
|
||||
vn -0.52762 0.81648 0.23447
|
||||
vn -0.93483 -0.26779 0.23320
|
||||
vn 0.48622 0.81626 -0.31194
|
||||
vn 0.01593 -0.62400 0.78126
|
||||
vn 0.48622 0.81626 -0.31194
|
||||
vn 0.01593 -0.62400 0.78126
|
||||
vn 0.48622 0.81626 -0.31194
|
||||
vn 0.70882 -0.26685 -0.65297
|
||||
vn -0.52762 0.81648 0.23447
|
||||
vn 0.70882 -0.26685 -0.65297
|
||||
vn -0.93483 -0.26779 0.23320
|
||||
vn 0.42182 0.46055 0.78100
|
||||
vn -0.17005 -0.93412 -0.31386
|
||||
vn 0.42182 0.46055 0.78100
|
||||
vn -0.17005 -0.93412 -0.31386
|
||||
vn -0.52762 0.81648 0.23447
|
||||
vn -0.17005 -0.93412 -0.31386
|
||||
vn -0.93483 -0.26779 0.23320
|
||||
vn 0.48622 0.81626 -0.31194
|
||||
vn 0.48622 0.81626 -0.31194
|
||||
vn -0.17005 -0.93412 -0.31386
|
||||
vn -0.52762 0.81648 0.23447
|
||||
vn -0.17005 -0.93412 -0.31386
|
||||
vn 0.48622 0.81626 -0.31194
|
||||
vn -0.17005 -0.93412 -0.31386
|
||||
vn 0.46757 -0.17421 0.86662
|
||||
vn 0.46757 -0.17421 0.86662
|
||||
vn 0.46758 -0.17421 0.86662
|
||||
vn 0.46757 -0.17421 0.86662
|
||||
vn 0.46758 -0.17421 0.86662
|
||||
vn 0.46757 -0.17421 0.86662
|
||||
vn -0.93462 0.35073 0.05899
|
||||
vn -0.93462 0.35073 0.05899
|
||||
vn -0.93462 0.35073 0.05899
|
||||
vn -0.93462 0.35073 0.05899
|
||||
vn -0.93462 0.35073 0.05899
|
||||
vn -0.93462 0.35073 0.05899
|
||||
vn 0.56288 0.35165 -0.74800
|
||||
vn 0.56288 0.35165 -0.74800
|
||||
vn 0.56288 0.35165 -0.74800
|
||||
vn 0.56288 0.35165 -0.74800
|
||||
vn 0.56288 0.35165 -0.74800
|
||||
vn 0.56288 0.35165 -0.74800
|
||||
vn 0.19191 -0.63568 -0.74772
|
||||
vn 0.19191 -0.63568 -0.74772
|
||||
vn 0.19191 -0.63568 -0.74772
|
||||
vn 0.19191 -0.63568 -0.74772
|
||||
vn 0.19191 -0.63568 -0.74772
|
||||
vn 0.19191 -0.63568 -0.74772
|
||||
vn -0.73048 -0.63561 -0.24981
|
||||
vn -0.73048 -0.63561 -0.24981
|
||||
vn -0.73048 -0.63561 -0.24981
|
||||
vn -0.73048 -0.63561 -0.24981
|
||||
vn -0.73048 -0.63561 -0.24981
|
||||
vn -0.73048 -0.63561 -0.24981
|
||||
vn -0.13305 0.95964 -0.24779
|
||||
vn -0.13305 0.95964 -0.24779
|
||||
vn -0.13305 0.95964 -0.24779
|
||||
vn -0.13305 0.95964 -0.24779
|
||||
vn -0.13305 0.95964 -0.24779
|
||||
vn -0.13305 0.95964 -0.24779
|
||||
vn 0.73048 0.63561 0.24981
|
||||
vn 0.73048 0.63561 0.24981
|
||||
vn 0.73048 0.63561 0.24981
|
||||
vn 0.73048 0.63561 0.24981
|
||||
vn 0.73048 0.63561 0.24981
|
||||
vn 0.73048 0.63561 0.24981
|
||||
vn 0.13305 -0.95964 0.24779
|
||||
vn 0.13305 -0.95964 0.24779
|
||||
vn 0.13305 -0.95964 0.24779
|
||||
vn 0.13305 -0.95964 0.24779
|
||||
vn 0.13305 -0.95964 0.24779
|
||||
vn 0.13305 -0.95964 0.24779
|
||||
vn -0.19191 0.63568 0.74772
|
||||
vn -0.19191 0.63568 0.74772
|
||||
vn -0.19191 0.63568 0.74772
|
||||
vn -0.19191 0.63568 0.74772
|
||||
vn -0.19191 0.63568 0.74772
|
||||
vn -0.19191 0.63568 0.74772
|
||||
vn -0.56288 -0.35165 0.74800
|
||||
vn -0.56288 -0.35165 0.74800
|
||||
vn -0.56288 -0.35165 0.74800
|
||||
vn -0.56288 -0.35166 0.74800
|
||||
vn -0.56288 -0.35165 0.74800
|
||||
vn -0.56288 -0.35165 0.74800
|
||||
vn 0.93462 -0.35073 -0.05899
|
||||
vn 0.93462 -0.35073 -0.05899
|
||||
vn 0.93462 -0.35073 -0.05899
|
||||
vn 0.93462 -0.35073 -0.05899
|
||||
vn 0.93462 -0.35073 -0.05899
|
||||
vn 0.93462 -0.35073 -0.05899
|
||||
vn -0.46757 0.17421 -0.86662
|
||||
vn -0.46758 0.17421 -0.86662
|
||||
vn -0.46757 0.17421 -0.86662
|
||||
vn -0.46757 0.17421 -0.86662
|
||||
vn -0.46758 0.17421 -0.86662
|
||||
vn -0.46757 0.17421 -0.86662
|
||||
|
||||
# No. texture coordinates 132:
|
||||
vt 0.50000 0.50000
|
||||
vt 0.93157 0.50000
|
||||
vt 0.09590 0.65084
|
||||
vt 0.82517 0.21752
|
||||
vt 0.95904 0.65084
|
||||
vt 0.55845 0.21752
|
||||
vt 0.01698 0.51921
|
||||
vt 0.12338 0.80168
|
||||
vt 0.73060 0.67458
|
||||
vt 0.74625 0.08589
|
||||
vt 0.61339 0.51921
|
||||
vt 0.55495 0.80168
|
||||
vt 0.21280 0.08589
|
||||
vt 0.17216 0.88304
|
||||
vt 0.34215 0.23673
|
||||
vt 0 0.42598
|
||||
vt 0.55711 1
|
||||
vt 0.57275 0.41131
|
||||
vt 0.76857 0.88304
|
||||
vt 0.24027 0.23673
|
||||
vt 0.86314 0.42598
|
||||
vt 0.03930 0.41131
|
||||
vt 0.65250 0.96439
|
||||
vt 0.82250 0.31808
|
||||
vt 0.30819 0.05028
|
||||
vt 0.21146 0.86836
|
||||
vt 0.47819 0.86836
|
||||
vt 0.44938 0.03561
|
||||
vt 0.55062 0.96439
|
||||
vt 0.02232 0.31808
|
||||
vt 0.73976 0.05028
|
||||
vt 0.34750 0.03561
|
||||
vt 0.96070 0.58869
|
||||
vt 0.97768 0.68192
|
||||
vt 0.78854 0.13164
|
||||
vt 0.69181 0.94972
|
||||
vt 0.26024 0.94972
|
||||
vt 0.23143 0.11696
|
||||
vt 0.42725 0.58869
|
||||
vt 0.17750 0.68192
|
||||
vt 0.52181 0.13164
|
||||
vt 0.82784 0.11696
|
||||
vt 0.78720 0.91411
|
||||
vt 0.75973 0.76327
|
||||
vt 0.44289 0
|
||||
vt 1 0.57402
|
||||
vt 0.13686 0.57402
|
||||
vt 0.38661 0.48079
|
||||
vt 0.25375 0.91411
|
||||
vt 0.65785 0.76327
|
||||
vt 0.98302 0.48079
|
||||
vt 0.44155 0.78248
|
||||
vt 0.26940 0.32542
|
||||
vt 0.87662 0.19832
|
||||
vt 0.44505 0.19832
|
||||
vt 0.04096 0.34916
|
||||
vt 0.17483 0.78248
|
||||
vt 0.90410 0.34916
|
||||
vt 0.06843 0.50000
|
||||
vt 0.50000 0.50000
|
||||
vt 0.70916 0.42193
|
||||
vt 0.50000 0.50000
|
||||
vt 0.93157 0.50000
|
||||
vt 0.55845 0.21752
|
||||
vt 0.73060 0.67458
|
||||
vt 0.82517 0.21752
|
||||
vt 0.08168 0.65615
|
||||
vt 0.09590 0.65084
|
||||
vt 0.01698 0.51921
|
||||
vt 0.17216 0.88304
|
||||
vt 0 0.42598
|
||||
vt 0.12338 0.80168
|
||||
vt 0.75182 0.65615
|
||||
vt 0.55495 0.80168
|
||||
vt 0.86314 0.42598
|
||||
vt 0.76857 0.88304
|
||||
vt 0.61339 0.51921
|
||||
vt 0.95904 0.65084
|
||||
vt 0.58661 0.21752
|
||||
vt 0.57275 0.41131
|
||||
vt 0.44938 0.03561
|
||||
vt 0.82250 0.31808
|
||||
vt 0.34215 0.23673
|
||||
vt 0.74625 0.08589
|
||||
vt 0.17244 0.21752
|
||||
vt 0.21280 0.08589
|
||||
vt 0.24027 0.23673
|
||||
vt 0.02232 0.31808
|
||||
vt 0.34750 0.03561
|
||||
vt 0.03930 0.41131
|
||||
vt 0.43976 0.92723
|
||||
vt 0.55711 1
|
||||
vt 0.21146 0.86836
|
||||
vt 0.69181 0.94972
|
||||
vt 0.26024 0.94972
|
||||
vt 0.47819 0.86836
|
||||
vt 0.82756 0.78248
|
||||
vt 0.97768 0.68192
|
||||
vt 0.75973 0.76327
|
||||
vt 0.78720 0.91411
|
||||
vt 0.96070 0.58869
|
||||
vt 0.65250 0.96439
|
||||
vt 0.56024 0.07277
|
||||
vt 0.78854 0.13164
|
||||
vt 0.44289 0
|
||||
vt 0.52181 0.13164
|
||||
vt 0.73976 0.05028
|
||||
vt 0.30819 0.05028
|
||||
vt 0.41339 0.78248
|
||||
vt 0.55062 0.96439
|
||||
vt 0.42725 0.58869
|
||||
vt 0.25375 0.91411
|
||||
vt 0.65785 0.76327
|
||||
vt 0.17750 0.68192
|
||||
vt 0.24818 0.34385
|
||||
vt 0.23143 0.11696
|
||||
vt 0.13686 0.57402
|
||||
vt 0.44505 0.19832
|
||||
vt 0.04096 0.34916
|
||||
vt 0.38661 0.48079
|
||||
vt 0.91832 0.34385
|
||||
vt 0.98302 0.48079
|
||||
vt 0.90410 0.34916
|
||||
vt 0.87662 0.19832
|
||||
vt 1 0.57402
|
||||
vt 0.82784 0.11696
|
||||
vt 0.29084 0.57807
|
||||
vt 0.06843 0.50000
|
||||
vt 0.50000 0.50000
|
||||
vt 0.17483 0.78248
|
||||
vt 0.26940 0.32542
|
||||
vt 0.44155 0.78248
|
||||
|
||||
# No. faces 140:
|
||||
f 12/12/163 8/8/155 3/3/145
|
||||
f 5/5/149 12/12/163 3/3/145
|
||||
f 2/2/143 5/5/149 3/3/145
|
||||
f 1/1/141 2/2/143 3/3/145
|
||||
f 15/15/169 10/10/159 4/4/147
|
||||
f 7/7/153 15/15/169 4/4/147
|
||||
f 3/3/146 7/7/153 4/4/147
|
||||
f 1/1/142 3/3/146 4/4/147
|
||||
f 11/11/161 5/5/150 2/2/144
|
||||
f 20/20/179 11/11/161 2/2/144
|
||||
f 13/13/165 20/20/179 2/2/144
|
||||
f 6/6/151 13/13/165 2/2/144
|
||||
f 17/17/173 9/9/157 4/4/148
|
||||
f 27/27/193 17/17/173 4/4/148
|
||||
f 18/18/175 27/27/193 4/4/148
|
||||
f 10/10/160 18/18/175 4/4/148
|
||||
f 26/26/191 22/22/183 13/13/166
|
||||
f 17/17/174 26/26/191 13/13/166
|
||||
f 9/9/158 17/17/174 13/13/166
|
||||
f 6/6/152 9/9/158 13/13/166
|
||||
f 34/34/207 24/24/187 15/15/170
|
||||
f 23/23/185 34/34/207 15/15/170
|
||||
f 14/14/167 23/23/185 15/15/170
|
||||
f 7/7/154 14/14/167 15/15/170
|
||||
f 31/31/201 25/25/189 16/16/171
|
||||
f 21/21/181 31/31/201 16/16/171
|
||||
f 12/12/164 21/21/181 16/16/171
|
||||
f 8/8/156 12/12/164 16/16/171
|
||||
f 29/29/197 19/19/177 11/11/162
|
||||
f 40/40/219 29/29/197 11/11/162
|
||||
f 30/30/199 40/40/219 11/11/162
|
||||
f 20/20/180 30/30/199 11/11/162
|
||||
f 35/35/209 33/33/205 23/23/186
|
||||
f 25/25/190 35/35/209 23/23/186
|
||||
f 16/16/172 25/25/190 23/23/186
|
||||
f 14/14/168 16/16/172 23/23/186
|
||||
f 37/37/213 27/27/194 18/18/176
|
||||
f 47/47/233 37/37/213 18/18/176
|
||||
f 38/38/215 47/47/233 18/18/176
|
||||
f 28/28/195 38/38/215 18/18/176
|
||||
f 31/31/202 21/21/182 19/19/178
|
||||
f 41/41/221 31/31/202 19/19/178
|
||||
f 39/39/217 41/41/221 19/19/178
|
||||
f 29/29/198 39/39/217 19/19/178
|
||||
f 46/46/231 42/42/223 32/32/203
|
||||
f 36/36/211 46/46/231 32/32/203
|
||||
f 26/26/192 36/36/211 32/32/203
|
||||
f 22/22/184 26/26/192 32/32/203
|
||||
f 38/38/216 28/28/196 24/24/188
|
||||
f 48/48/235 38/38/216 24/24/188
|
||||
f 44/44/227 48/48/235 24/24/188
|
||||
f 34/34/208 44/44/227 24/24/188
|
||||
f 51/51/241 50/50/239 40/40/220
|
||||
f 42/42/224 51/51/241 40/40/220
|
||||
f 32/32/204 42/42/224 40/40/220
|
||||
f 30/30/200 32/32/204 40/40/220
|
||||
f 53/53/245 52/52/243 43/43/225
|
||||
f 45/45/229 53/53/245 43/43/225
|
||||
f 35/35/210 45/45/229 43/43/225
|
||||
f 33/33/206 35/35/210 43/43/225
|
||||
f 55/55/249 54/54/247 46/46/232
|
||||
f 47/47/234 55/55/249 46/46/232
|
||||
f 37/37/214 47/47/234 46/46/232
|
||||
f 36/36/212 37/37/214 46/46/232
|
||||
f 45/45/230 41/41/222 39/39/218
|
||||
f 53/53/246 45/45/230 39/39/218
|
||||
f 57/57/253 53/53/246 39/39/218
|
||||
f 49/49/237 57/57/253 39/39/218
|
||||
f 48/48/236 44/44/228 43/43/226
|
||||
f 56/56/251 48/48/236 43/43/226
|
||||
f 59/59/257 56/56/251 43/43/226
|
||||
f 52/52/244 59/59/257 43/43/226
|
||||
f 58/58/255 60/60/259 57/57/254
|
||||
f 51/51/242 58/58/255 57/57/254
|
||||
f 50/50/240 51/51/242 57/57/254
|
||||
f 49/49/238 50/50/240 57/57/254
|
||||
f 59/59/258 60/60/260 58/58/256
|
||||
f 56/56/252 59/59/258 58/58/256
|
||||
f 55/55/250 56/56/252 58/58/256
|
||||
f 54/54/248 55/55/250 58/58/256
|
||||
f 63/63/263 62/62/262 61/61/261
|
||||
f 64/64/264 63/63/263 61/61/261
|
||||
f 65/65/265 64/64/264 61/61/261
|
||||
f 66/66/266 65/65/265 61/61/261
|
||||
f 62/62/262 66/66/266 61/61/261
|
||||
f 69/69/269 68/68/268 67/67/267
|
||||
f 70/70/270 69/69/269 67/67/267
|
||||
f 71/71/271 70/70/270 67/67/267
|
||||
f 72/72/272 71/71/271 67/67/267
|
||||
f 68/68/268 72/72/272 67/67/267
|
||||
f 75/75/275 74/74/274 73/73/273
|
||||
f 76/76/276 75/75/275 73/73/273
|
||||
f 77/77/277 76/76/276 73/73/273
|
||||
f 78/78/278 77/77/277 73/73/273
|
||||
f 74/74/274 78/78/278 73/73/273
|
||||
f 81/81/281 80/80/280 79/79/279
|
||||
f 82/82/282 81/81/281 79/79/279
|
||||
f 83/83/283 82/82/282 79/79/279
|
||||
f 84/84/284 83/83/283 79/79/279
|
||||
f 80/80/280 84/84/284 79/79/279
|
||||
f 87/87/287 86/86/286 85/85/285
|
||||
f 88/88/288 87/87/287 85/85/285
|
||||
f 89/89/289 88/88/288 85/85/285
|
||||
f 90/90/290 89/89/289 85/85/285
|
||||
f 86/86/286 90/90/290 85/85/285
|
||||
f 93/93/293 92/92/292 91/91/291
|
||||
f 94/94/294 93/93/293 91/91/291
|
||||
f 95/95/295 94/94/294 91/91/291
|
||||
f 96/96/296 95/95/295 91/91/291
|
||||
f 92/92/292 96/96/296 91/91/291
|
||||
f 99/99/299 98/98/298 97/97/297
|
||||
f 100/100/300 99/99/299 97/97/297
|
||||
f 101/101/301 100/100/300 97/97/297
|
||||
f 102/102/302 101/101/301 97/97/297
|
||||
f 98/98/298 102/102/302 97/97/297
|
||||
f 105/105/305 104/104/304 103/103/303
|
||||
f 106/106/306 105/105/305 103/103/303
|
||||
f 107/107/307 106/106/306 103/103/303
|
||||
f 108/108/308 107/107/307 103/103/303
|
||||
f 104/104/304 108/108/308 103/103/303
|
||||
f 111/111/311 110/110/310 109/109/309
|
||||
f 112/112/312 111/111/311 109/109/309
|
||||
f 113/113/313 112/112/312 109/109/309
|
||||
f 114/114/314 113/113/313 109/109/309
|
||||
f 110/110/310 114/114/314 109/109/309
|
||||
f 117/117/317 116/116/316 115/115/315
|
||||
f 118/118/318 117/117/317 115/115/315
|
||||
f 119/119/319 118/118/318 115/115/315
|
||||
f 120/120/320 119/119/319 115/115/315
|
||||
f 116/116/316 120/120/320 115/115/315
|
||||
f 123/123/323 122/122/322 121/121/321
|
||||
f 124/124/324 123/123/323 121/121/321
|
||||
f 125/125/325 124/124/324 121/121/321
|
||||
f 126/126/326 125/125/325 121/121/321
|
||||
f 122/122/322 126/126/326 121/121/321
|
||||
f 129/129/329 128/128/328 127/127/327
|
||||
f 130/130/330 129/129/329 127/127/327
|
||||
f 131/131/331 130/130/330 127/127/327
|
||||
f 132/132/332 131/131/331 127/127/327
|
||||
f 128/128/328 132/132/332 127/127/327
|
||||
|
||||
|
||||
# End Group:
|
||||
|
BIN
Release/trans.png
Normal file
After ![]() (image error) Size: 6 KiB |
26
Release/vertex.vert
Normal file
|
@ -0,0 +1,26 @@
|
|||
#version 330
|
||||
|
||||
layout(location = 0) in vec3 position;
|
||||
layout(location = 1) in vec3 normal;
|
||||
layout(location = 2) in vec2 textex;
|
||||
|
||||
out vec2 ftextex;
|
||||
out vec3 vnorm;
|
||||
out vec3 vpos;
|
||||
|
||||
uniform float time;
|
||||
|
||||
uniform vec2 texScaleFactor;
|
||||
uniform vec2 texOffsetFactor;
|
||||
|
||||
uniform mat4 modelToCam;
|
||||
uniform mat4 camToWorld;
|
||||
uniform mat4 worldToClip;
|
||||
|
||||
void main(void) {
|
||||
gl_Position = (worldToClip * camToWorld * modelToCam) * vec4(position, 1.0);
|
||||
|
||||
ftextex = texOffsetFactor + textex*texScaleFactor;
|
||||
vnorm = normalize(vec3(modelToCam * vec4(normal, 0.0)));
|
||||
vpos = position;
|
||||
}
|
BIN
Release/wall.png
Normal file
After ![]() (image error) Size: 861 KiB |
BIN
Release/weed.mp3
Normal file
BIN
Release/weed.ogg
Normal file
BIN
sfml20test.sdf
Normal file
20
sfml20test.sln
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml20test", "sfml20test\sfml20test.vcxproj", "{D5BD2844-B4EB-494D-B2DD-F010D479C984}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D5BD2844-B4EB-494D-B2DD-F010D479C984}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D5BD2844-B4EB-494D-B2DD-F010D479C984}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D5BD2844-B4EB-494D-B2DD-F010D479C984}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D5BD2844-B4EB-494D-B2DD-F010D479C984}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
BIN
sfml20test.v11.suo
Normal file
BIN
sfml20test.v12.suo
Normal file
14
sfml20test/AlecGL.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
#ifndef ALECGL
|
||||
#define ALECGL
|
||||
|
||||
#include "Common.h"
|
||||
#include "Camera.h"
|
||||
#include "Mesh.h"
|
||||
#include "NoiseReader.h"
|
||||
#include "ShaderManager.h"
|
||||
//#include "Texture.h"
|
||||
#include "MatrixStack.h"
|
||||
#include "Map.h"
|
||||
#include "DebugRect.h"
|
||||
|
||||
#endif
|
111
sfml20test/Camera.cpp
Normal file
|
@ -0,0 +1,111 @@
|
|||
#include "Camera.h"
|
||||
|
||||
void agl::Camera::updateMatrix() {
|
||||
matrixToBeUpdated = true;
|
||||
}
|
||||
|
||||
void agl::Camera::updateCamera() {
|
||||
if(matrixToBeUpdated) {
|
||||
camToWorld = glm::rotate(glm::mat4(1.0), -rotation.y, glm::vec3(1.0, 0.0, 0.0)) * glm::rotate(glm::mat4(1.0), -rotation.x, glm::vec3(0.0, 1.0, 0.0)) * glm::translate(glm::mat4(1.0f), -position);
|
||||
lookVector = glm::normalize(glm::vec3(glm::rotate(glm::mat4(1.0), rotation.x, glm::vec3(0.0, 1.0, 0.0)) * glm::rotate(glm::mat4(1.0), rotation.y, glm::vec3(1.0, 0.0, 0.0)) * glm::vec4(0.0,0.0,-1.0,0.0)));
|
||||
}
|
||||
|
||||
matrixToBeUpdated = false;
|
||||
}
|
||||
|
||||
agl::Camera::Camera() {
|
||||
rotation = glm::vec3(0.0);
|
||||
position = glm::vec3(0.0);
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
agl::Camera::Camera(glm::vec3 pos, glm::vec3 rot) {
|
||||
setCamera(pos, rot);
|
||||
}
|
||||
|
||||
agl::Camera::Camera(float px, float py, float pz, float rx, float ry, float rz) {
|
||||
setCamera(px, py, pz, rx, ry, rz);
|
||||
}
|
||||
|
||||
void agl::Camera::setCamera(glm::vec3 pos, glm::vec3 rot) {
|
||||
rotation = rot;
|
||||
position = pos;
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::setCamera(float px, float py, float pz, float rx, float ry, float rz) {
|
||||
rotation = glm::vec3(rx, ry, rz);
|
||||
position = glm::vec3(px, py, pz);
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::setPosition(glm::vec3 pos) {
|
||||
position = pos;
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::setPosition(float x, float y, float z) {
|
||||
position = glm::vec3(x,y,z);
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::setRotation(glm::vec3 ang) {
|
||||
rotation = ang;
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::setRotation(float x, float y, float z) {
|
||||
rotation = glm::vec3(x,y,z);
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::rotateCamera(glm::vec3 ang) {
|
||||
rotation += ang;
|
||||
rotation.y = (rotation.y>90)?90:((rotation.y<-90)?-90:rotation.y);
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::rotateCamera(float x, float y, float z) {
|
||||
rotation += glm::vec3(x,y,z);
|
||||
rotation.y = (rotation.y>90)?90:((rotation.y<-90)?-90:rotation.y);
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::moveCamera(glm::vec3 pos) {
|
||||
position += pos;
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::moveCamera(float x, float y, float z) {
|
||||
position += glm::vec3(x,y,z);
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::move(float dist) {
|
||||
position -= dist*glm::vec3(sin(degToRad(rotation.x)), 0, cos(degToRad(rotation.x)));
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
void agl::Camera::strafe(float dist) {
|
||||
position -= dist*glm::vec3(sin(degToRad(rotation.x+90)), 0, cos(degToRad(rotation.x+90)));
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
glm::mat4 agl::Camera::getMatrix() {
|
||||
return camToWorld;
|
||||
}
|
||||
|
||||
glm::vec3 agl::Camera::getLookVector() {
|
||||
return lookVector;
|
||||
}
|
||||
|
||||
glm::vec3 agl::Camera::getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
glm::vec3 agl::Camera::getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
agl::Camera::~Camera() {
|
||||
}
|
55
sfml20test/Camera.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
#include <SFML/Graphics.hpp>
|
||||
#include <GL/glew.h>
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <vector>
|
||||
#include <stdarg.h>
|
||||
#include "Common.h"
|
||||
|
||||
namespace agl {
|
||||
class Camera {
|
||||
glm::mat4 camToWorld;
|
||||
glm::vec3 lookVector;
|
||||
|
||||
glm::vec3 position;
|
||||
glm::vec3 rotation;
|
||||
|
||||
bool matrixToBeUpdated;
|
||||
|
||||
void updateMatrix();
|
||||
|
||||
float degToRad(float deg) {return deg*(M_PI/180);}
|
||||
float radToDeg(float rad) {return rad*(180/M_PI);}
|
||||
public:
|
||||
Camera();
|
||||
Camera(glm::vec3, glm::vec3=glm::vec3(0.0));
|
||||
Camera(float, float, float, float=0.0, float=0.0, float=0.0);
|
||||
|
||||
void setCamera(glm::vec3, glm::vec3=glm::vec3(0.0));
|
||||
void setCamera(float, float, float, float=0.0, float=0.0, float=0.0);
|
||||
|
||||
void setPosition(glm::vec3);
|
||||
void setPosition(float, float, float);
|
||||
|
||||
void setRotation(glm::vec3);
|
||||
void setRotation(float, float, float);
|
||||
|
||||
void rotateCamera(glm::vec3);
|
||||
void rotateCamera(float, float, float);
|
||||
|
||||
void moveCamera(glm::vec3);
|
||||
void moveCamera(float, float, float);
|
||||
|
||||
void move(float); // positive is forward
|
||||
void strafe(float); // positive is right
|
||||
|
||||
void updateCamera();
|
||||
|
||||
glm::mat4 getMatrix();
|
||||
glm::vec3 getLookVector();
|
||||
glm::vec3 getPosition();
|
||||
glm::vec3 getRotation();
|
||||
|
||||
~Camera();
|
||||
};
|
||||
};
|
14
sfml20test/Common.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
#ifndef COMMONH
|
||||
#define COMMONH
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#define M_PI 3.14159
|
||||
|
||||
namespace agl {
|
||||
};
|
||||
|
||||
#endif
|
BIN
sfml20test/Debug/CL.read.1.tlog
Normal file
BIN
sfml20test/Debug/CL.write.1.tlog
Normal file
BIN
sfml20test/Debug/Matrix.obj
Normal file
BIN
sfml20test/Debug/ShaderManager.obj
Normal file
BIN
sfml20test/Debug/cl.command.1.tlog
Normal file
1
sfml20test/Debug/link-cvtres.read.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
sfml20test/Debug/link-cvtres.write.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
sfml20test/Debug/link-rc.read.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
sfml20test/Debug/link-rc.write.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
sfml20test/Debug/link.10392-cvtres.read.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
sfml20test/Debug/link.10392-cvtres.write.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
sfml20test/Debug/link.10392-rc.read.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
sfml20test/Debug/link.10392-rc.write.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
sfml20test/Debug/link.10392.read.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
sfml20test/Debug/link.10392.write.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
sfml20test/Debug/link.10484-cvtres.read.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
sfml20test/Debug/link.10484-cvtres.write.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
sfml20test/Debug/link.10484-rc.read.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
sfml20test/Debug/link.10484-rc.write.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
sfml20test/Debug/link.10484.read.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
sfml20test/Debug/link.10484.write.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
sfml20test/Debug/link.10664-cvtres.read.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
sfml20test/Debug/link.10664-cvtres.write.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|