Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
a6f4630
Fixed issue causing intellisense not to understand CUDA types.
bcrusco Oct 5, 2015
6e2a86d
Some of the basic parts of the first run pipeline.
bcrusco Oct 5, 2015
7268161
Merge remote-tracking branch 'upstream/master'
bcrusco Oct 7, 2015
f3488ec
Updated getAABBForTriangle to take in a Triangle instead of an array …
bcrusco Oct 7, 2015
e35a3b6
Added files for a scene class and updated the build script.
bcrusco Oct 7, 2015
f12a04a
Rough version of scene class.
bcrusco Oct 7, 2015
bb2f1de
Basic pipeline for triangles, works with cow models.
bcrusco Oct 9, 2015
a8ec35f
Added the shared memory work efficient stream compaction to the proje…
bcrusco Oct 9, 2015
8623ff8
Working culling.
bcrusco Oct 9, 2015
4701a82
Slightly buggy mouse controls.
bcrusco Oct 9, 2015
9e9e0ff
Point rasterization.
bcrusco Oct 9, 2015
a95ae68
Turn point rasterization off by default.
bcrusco Oct 9, 2015
b433101
Rough line segment implementation. Still a bit buggy. Will sometimes …
bcrusco Oct 9, 2015
5b718cb
Fixed culling so that it actually works. Implemented a pretty rough s…
bcrusco Oct 9, 2015
cfc060b
Switch to a lighting model where there's one light coming from the ca…
bcrusco Oct 10, 2015
3ee691f
Revert to original depth test stuff without mutex lock.
bcrusco Oct 10, 2015
c48bd6a
Update README.md
bcrusco Oct 10, 2015
94ba53d
Dragon render
bcrusco Oct 10, 2015
e173351
Update README.md
bcrusco Oct 10, 2015
586dced
Update README.md
bcrusco Oct 10, 2015
10d5405
Update README.md
bcrusco Oct 10, 2015
a6f4408
Update README.md
bcrusco Oct 10, 2015
2552aa2
Update README.md
bcrusco Oct 10, 2015
a3d167a
Added image of scissoring test effect.
bcrusco Oct 10, 2015
31d494e
Update README.md
bcrusco Oct 10, 2015
c6626d9
Update README.md
bcrusco Oct 10, 2015
7821d5a
Update README.md
bcrusco Oct 10, 2015
0a7d5db
Images for dragon renders as lines and points.
bcrusco Oct 10, 2015
5837657
Update README.md
bcrusco Oct 10, 2015
1399220
Update README.md
bcrusco Oct 10, 2015
c3cea53
Update README.md
bcrusco Oct 10, 2015
0d9dbfc
Update README.md
bcrusco Oct 10, 2015
34348af
Nonsmooth dragon render
bcrusco Oct 10, 2015
eb3e226
Update README.md
bcrusco Oct 10, 2015
7089835
Update README.md
bcrusco Oct 10, 2015
acf1149
Dragon interpolation comparison.
bcrusco Oct 10, 2015
e5165fc
Update README.md
bcrusco Oct 10, 2015
9d3a890
Update README.md
bcrusco Oct 10, 2015
70025ac
Update README.md
bcrusco Oct 10, 2015
47e7849
Update README.md
bcrusco Oct 10, 2015
f237f6e
How renders comparison with normals to better show interpolation.
bcrusco Oct 10, 2015
a670245
Update README.md
bcrusco Oct 10, 2015
4f6e8d4
Update README.md
bcrusco Oct 10, 2015
e6beab6
Update README.md
bcrusco Oct 10, 2015
368adc4
Update README.md
bcrusco Oct 10, 2015
a9a3aeb
Update README.md
bcrusco Oct 10, 2015
29e04eb
Disable scissor, default render color is more interesting.
bcrusco Oct 10, 2015
6a64252
Merge branch 'master' of https://github.com/bcrusco/Project4-CUDA-Ras…
bcrusco Oct 10, 2015
e1f31e1
Modifications to vertexShader by reducing register size and playing w…
bcrusco Oct 10, 2015
8cd56f8
Dramatically reduced register count for primitive assembly Occupation…
bcrusco Oct 10, 2015
2d40c67
Bary centric coordinate functions now support triangles as input. Thi…
bcrusco Oct 10, 2015
96997cc
Final optimizations to rasterization step.
bcrusco Oct 10, 2015
443b383
Backface culling optimizations.
bcrusco Oct 10, 2015
fc7afcc
Reduced register count for scissor test kernel.
bcrusco Oct 10, 2015
c42590b
Better camera placement.
bcrusco Oct 10, 2015
fa66a14
Images for charts.
bcrusco Oct 10, 2015
63ac6fc
Changed directory of data images.
bcrusco Oct 10, 2015
b2f622c
Update README.md
bcrusco Oct 10, 2015
ec37944
Update README.md
bcrusco Oct 10, 2015
9515ca7
Update README.md
bcrusco Oct 10, 2015
88b0361
Update README.md
bcrusco Oct 10, 2015
2736c4f
Update README.md
bcrusco Oct 11, 2015
a7a81c2
NSight data images
bcrusco Oct 11, 2015
b8c2c03
Update README.md
bcrusco Oct 11, 2015
c6c4669
Update README.md
bcrusco Oct 11, 2015
6069722
Update README.md
bcrusco Oct 11, 2015
24efa2b
Update README.md
bcrusco Oct 11, 2015
c56a64a
Update README.md
bcrusco Oct 11, 2015
997e4c2
Update README.md
bcrusco Oct 11, 2015
ec7aa7f
Update README.md
bcrusco Oct 11, 2015
79355fb
Update README.md
bcrusco Oct 11, 2015
98c51c8
Update README.md
bcrusco Oct 11, 2015
1137df4
Update README.md
bcrusco Oct 11, 2015
9d9803e
Update README.md
bcrusco Oct 11, 2015
6b5e4d0
Update README.md
bcrusco Oct 11, 2015
8845668
Additional renders
bcrusco Oct 11, 2015
e9b1212
Revert obj color
bcrusco Oct 11, 2015
1a8f1f5
Another dragon render.
bcrusco Oct 11, 2015
ca1e1c6
Revert camera location
bcrusco Oct 11, 2015
9743217
Removed some comments.
bcrusco Oct 11, 2015
aede60f
Fake youtube embed thumbnail for readme.
bcrusco Oct 11, 2015
8d7804e
Update README.md
bcrusco Oct 11, 2015
eb833f1
Update README.md
bcrusco Oct 11, 2015
b02ff25
Removed unneeded code and comments.
bcrusco Oct 11, 2015
15eff01
Update README.md
bcrusco Oct 11, 2015
b5b7570
Update README.md
bcrusco Oct 11, 2015
0388bc0
Update README.md
bcrusco Oct 11, 2015
91beba8
Update README.md
bcrusco Oct 11, 2015
37ce195
Update README.md
bcrusco Oct 11, 2015
981d2ac
Update README.md
bcrusco Oct 11, 2015
30dfb5c
Update README.md
bcrusco Oct 11, 2015
9d68c68
Annotated version.
bcrusco Oct 11, 2015
e783788
Update README.md
bcrusco Oct 12, 2015
1462764
Update README.md
bcrusco Oct 12, 2015
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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ find_package(CUDA REQUIRED)
set(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE ON)
set(CUDA_SEPARABLE_COMPILATION ON)

#add_subdirectory(stream_compaction) # TODO: uncomment if using your own stream compaction
add_subdirectory(stream_compaction)
add_subdirectory(src)
add_subdirectory(util)

Expand All @@ -89,7 +89,7 @@ cuda_add_executable(${CMAKE_PROJECT_NAME}
target_link_libraries(${CMAKE_PROJECT_NAME}
src
util
#stream_compaction # TODO: uncomment if using your own stream compaction
stream_compaction
${CORELIBS}
)

Expand Down
451 changes: 108 additions & 343 deletions README.md

Large diffs are not rendered by default.

Binary file added data_images/Cow Pie Chart.png
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 data_images/Culling Execution.png
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 data_images/Culling FPS.png
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 data_images/Dragon Pie Chart.png
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 data_images/Fake Youtube.png
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 data_images/Final Performance Summary.png
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 data_images/Flower Pie Chart.png
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 data_images/Original Performance Summary.png
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 data_images/Scissor Execute.png
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 data_images/Scissor FPS.png
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 objs/dragon_smooth.psd
Binary file not shown.
Binary file added renders/Dragon_norm.png
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 renders/cow.png
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 renders/cow_interp_comp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed renders/cow_zdepth.png
Binary file not shown.
Binary file added renders/dragon.png
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 renders/dragon_interp_comp.png
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 renders/dragon_lines.png
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 renders/dragon_points.png
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 renders/dragon_scissor.png
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 renders/dragon_tri.png
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 renders/flower.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ set(SOURCE_FILES
"rasterize.cu"
"rasterize.h"
"rasterizeTools.h"
"scene.cpp"
"scene.hpp"
)

cuda_add_library(src
Expand Down
83 changes: 81 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#include "main.hpp"

#include <glm/gtx/rotate_vector.hpp>

//-------------------------------
//-------------MAIN--------------
//-------------------------------
Expand Down Expand Up @@ -83,7 +85,6 @@ void runCuda() {

frame++;
fpstracker++;

}

//-------------------------------
Expand All @@ -106,6 +107,9 @@ bool init(obj *mesh) {
}
glfwMakeContextCurrent(window);
glfwSetKeyCallback(window, keyCallback);
glfwSetCursorPosCallback(window, mouseMoveCallback);
glfwSetMouseButtonCallback(window, mousePressCallback);
glfwSetScrollCallback(window, mouseScrollCallback);

// Set up GL context
glewExperimental = GL_TRUE;
Expand Down Expand Up @@ -159,7 +163,10 @@ void initCuda() {
// Use device with highest Gflops/s
cudaGLSetGLDevice(0);

rasterizeInit(width, height);
scene = new Scene();
scene->scissorMax = glm::vec2(width * 0.75f, height * 0.75f);
scene->scissorMin = glm::vec2(width * 0.25f, height * 0.25f);
rasterizeInit(width, height, scene);

// Clean up on program exit
atexit(cleanupCuda);
Expand Down Expand Up @@ -274,3 +281,75 @@ void keyCallback(GLFWwindow *window, int key, int scancode, int action, int mods
glfwSetWindowShouldClose(window, GL_TRUE);
}
}

void mouseMoveCallback(GLFWwindow *window, double x, double y) {
if (!scene->mouseState.initialPositionsSet) {
// Have to set a baseline position for our offsets to base off of
scene->mouseState.x = x;
scene->mouseState.y = y;
scene->mouseState.initialPositionsSet = true;
}
else {
if (scene->mouseState.leftPressed) {
// Holding the left mouse rotates the camera.
glm::vec3 inverseLookAt = scene->camera.position - scene->camera.lookAt;
float xOffset = 0.005f * (scene->mouseState.x - (float)x);
float yOffset = 0.005f * (scene->mouseState.y - (float)y);
glm::vec3 tempInverseLookAt = glm::rotateY(inverseLookAt, glm::atan((float)(xOffset /
(TWO_PI * glm::length(inverseLookAt))), glm::length(inverseLookAt)));

scene->camera.right = glm::normalize(glm::rotateY(glm::vec3(inverseLookAt.x, 0.0f, inverseLookAt.z), (float)(PI / 2.0)));
scene->camera.position = scene->camera.lookAt + glm::rotate(tempInverseLookAt, glm::atan(yOffset /
(float)(TWO_PI * glm::length(inverseLookAt)), glm::length(tempInverseLookAt)), scene->camera.right);
scene->updateModelView();
}
else if (scene->mouseState.middlePressed) {
// Holding middle will translate the camera
float xOffset = 0.0001f * (scene->mouseState.x - (float)x);
float yOffset = 0.0001f * ((float)y - scene->mouseState.y);
glm::vec3 tempPosition = (scene->camera.position + scene->camera.right * xOffset) + (scene->camera.up * yOffset);
glm::vec3 tempLookAt = scene->camera.lookAt - tempPosition;

if (glm::length(tempLookAt) > 1.0f) {
// Restrict amount user can pan to stop going through model
scene->camera.lookAt = scene->camera.lookAt + tempPosition - scene->camera.position;
scene->camera.position = tempPosition;
scene->updateModelView();
}
}
}
}

void mousePressCallback(GLFWwindow *window, int button, int action, int mods) {
if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS) {
// Mark left mouse button as held
scene->mouseState.leftPressed = true;
scene->mouseState.initialPositionsSet = false;
}
else if (button == GLFW_MOUSE_BUTTON_MIDDLE && action == GLFW_PRESS) {
// Mark right mouse button as held
scene->mouseState.middlePressed = true;
scene->mouseState.initialPositionsSet = false;
}
else if (action == GLFW_RELEASE) {
// Reset the flags for which button is held
scene->mouseState.leftPressed = false;
scene->mouseState.middlePressed = false;
scene->mouseState.initialPositionsSet = true;
}
}

void mouseScrollCallback(GLFWwindow *window, double x, double y) {
if (y > 0.0) {
glm::vec3 tempLookAt = scene->camera.lookAt - scene->camera.position;
if (glm::length(tempLookAt) > 1.0) {
// Stop user from zooming in too close and through/past the model
scene->camera.position += glm::normalize(tempLookAt) * 0.1f;
scene->updateModelView();
}
}
else if (y < 0.0) {
scene->camera.position = scene->camera.position + (glm::normalize(scene->camera.position - scene->camera.lookAt) * 0.1f);
scene->updateModelView();
}
}
6 changes: 6 additions & 0 deletions src/main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <util/utilityCore.hpp>
#include <util/objloader.hpp>
#include "rasterize.h"
#include "scene.hpp"

using namespace std;

Expand All @@ -43,6 +44,8 @@ uchar4 *dptr;

GLFWwindow *window;

Scene *scene;

//-------------------------------
//----------CUDA STUFF-----------
//-------------------------------
Expand Down Expand Up @@ -93,3 +96,6 @@ void deleteTexture(GLuint *tex);
void mainLoop();
void errorCallback(int error, const char *description);
void keyCallback(GLFWwindow *window, int key, int scancode, int action, int mods);
void mouseMoveCallback(GLFWwindow *window, double x, double y);
void mousePressCallback(GLFWwindow *window, int button, int action, int mods);
void mouseScrollCallback(GLFWwindow *window, double x, double y);
Loading