Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 64 additions & 125 deletions README.md

Large diffs are not rendered by default.

Binary file added antia_00.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added antia_01.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added antia_03.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added antia_04.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added back00.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added back01.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added buddha_blinn_0.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added buddha_blinn_1.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added buddha_blinn_2.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added buddha_dot_0.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chart_modes.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cow_blinn_0.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cow_blinn_1.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cow_blinn_2.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cow_dot_0.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cow_wire_0.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dragon_blinn_0.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dragon_blinn_1.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dragon_dot_0.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dragon_flat_0.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dragon_has_antia.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dragon_has_antia2.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dragon_no_antia.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rasterizer_radiumyang.wmv
Binary file not shown.
Binary file added scissor.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 45 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Written by Yining Karl Li, Copyright (c) 2012 University of Pennsylvania

#include "main.h"

//-------------------------------
//-------------MAIN--------------
//-------------------------------
Expand All @@ -18,17 +17,40 @@ int main(int argc, char** argv){
//renderScene = new scene(data);
mesh = new obj();
objLoader* loader = new objLoader(data, mesh);

mesh->buildVBOs();
delete loader;
loadedScene = true;
}
}

if(!loadedScene){
cout << "Usage: mesh=[obj file]" << endl;
cout << "Usage: mesh=[obj file]\n !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
return 0;
}

Mmodel = glm::mat4(1.0);
Mprojection = glm::perspective(fovy, float(width) / float(height), depth_near, depth_far);
Mview = glm::lookAt( Veye, Vcenter, Vup);

// BMP img;
//char* filename = "texture0.bmp";
//img.ReadFromFile(filename);
//texture_width = img.TellWidth();
//texture_height = img.TellHeight();
//textureBMP = new glm::vec3[texture_width * texture_height];
//for(int j = 0; j<texture_height; j++)
// {
// for(int i = 0; i<texture_width; i++)
// {
// float r = img(i,j)->Red/255.0f;
// float g = img(i,j)->Green/255.0f;
// float b = img(i,j)->Blue/255.0f;
// textureBMP[i+j*texture_height] = glm::vec3(r,g,b);
// // printf("r %f, g %f, b%f",r,g,b);
// }
// }

frame = 0;
seconds = time (NULL);
fpstracker = 0;
Expand Down Expand Up @@ -93,14 +115,25 @@ void runCuda(){
ibo = mesh->getIBO();
ibosize = mesh->getIBOsize();

nbo = mesh->getNBO();
nbosize = mesh->getNBOsize();

/////ra
Mmodel = glm::rotate(Mmodel, (float)1.0f, glm::vec3(0,1,0));


cudaGLMapBufferObject((void**)&dptr, pbo);
cudaRasterizeCore(dptr, glm::vec2(width, height), frame, vbo, vbosize, cbo, cbosize, ibo, ibosize);
cudaRasterizeCore(dptr, glm::vec2(width, height), frame, vbo, vbosize, cbo, cbosize, ibo, ibosize, nbo, nbosize, Veye, Mmodel, Mview, Mprojection, depth_near, depth_far, mode);
cudaGLUnmapBufferObject(pbo);

vbo = NULL;
cbo = NULL;
ibo = NULL;

///////ra
nbo = NULL;


frame++;
fpstracker++;

Expand Down Expand Up @@ -281,4 +314,13 @@ void keyCallback(GLFWwindow* window, int key, int scancode, int action, int mods
if(key == GLFW_KEY_ESCAPE && action == GLFW_PRESS){
glfwSetWindowShouldClose(window, GL_TRUE);
}
if(key == GLFW_KEY_1 && action == GLFW_PRESS){
mode = 0;
}
if(key == GLFW_KEY_2 && action == GLFW_PRESS){
mode = 1;
}
if(key == GLFW_KEY_3 && action == GLFW_PRESS){
mode = 2;
}
}
28 changes: 27 additions & 1 deletion src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
#include <stdlib.h>
#include <string>
#include <time.h>

#include <glm/gtc/matrix_transform.hpp>

#include "rasterizeKernels.h"
#include "utilities.h"


using namespace std;

//-------------------------------
Expand Down Expand Up @@ -50,6 +51,29 @@ int cbosize;
int* ibo;
int ibosize;

float* nbo;
int nbosize;

// camera
float fovy = 60.0f;
float depth_near = 0.1f;
float depth_far = 100.0f;


//glm::vec3 Veye(0, 0.5, 2.8f);
glm::vec3 Veye(0, 0.8, 1.0f);
//glm::vec3 Vcenter(0, 1.0f, 0);
glm::vec3 Vcenter(0, 0.3f, 0);
glm::vec3 Vup(0, 1.0f, 0);


glm::mat4 Mmodel;
glm::mat4 Mprojection;
glm::mat4 Mview;

int mode = 2;


//-------------------------------
//----------CUDA STUFF-----------
//-------------------------------
Expand Down Expand Up @@ -85,6 +109,8 @@ void initTextures();
void initVAO();
GLuint initShader();



//-------------------------------
//---------CLEANUP STUFF---------
//-------------------------------
Expand Down
Loading