Skip to content

Commit 388115d

Browse files
committed
Merge branch 'Temp' into first_particle_approach
2 parents 06761ff + 186f278 commit 388115d

File tree

10 files changed

+183
-2
lines changed

10 files changed

+183
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
add_executable(
22
SphWaterfall
33
"src/SphWaterfall.cpp"
4-
)
4+
)

SphWaterfall/SphWaterfall/src/visualization/CMakeLists.txt

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#pragma once
2+
#include "Camera.h"
3+
4+
Camera::Camera(Vector3 location, Vector3 direction, unsigned int width, unsigned int height) {
5+
this->width = width;
6+
this->height = height;
7+
8+
this->location = location;
9+
this->direction = direction;
10+
}
11+
12+
void Camera::debugRenderFrame(std::vector<ISphParticle> particles) {
13+
//TODO: render frame in debug rendering
14+
}
15+
16+
void Camera::renderFrame(std::vector<ISphParticle> particles) {
17+
//TODO: implement rendering algorithm
18+
}
19+
20+
void Camera::mergeFramesAndFlushVideo(std::string file) {
21+
//TODO: merge all Frames to a video
22+
}
23+
24+
Vector3 Camera::getLocation() {
25+
return this->location;
26+
}
27+
28+
Vector3 Camera::getDirection() {
29+
return this->direction;
30+
}
31+
32+
Frame Camera::getFrame(unsigned int frameID) {
33+
if (frames.size >= frameID) {
34+
return;
35+
}
36+
return frames.at(frameID);
37+
}
38+
39+
//TODO: Impelement Frame Iterator?
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#pragma once
2+
#include "Frame.h"
3+
#include "Vector3.h"
4+
#include "ISphParticle.h"
5+
#include <vector>
6+
#include <string>
7+
8+
class Camera {
9+
public:
10+
Camera(Vector3 location, Vector3 direction, unsigned int width, unsigned int height);
11+
12+
void debugRenderFrame(std::vector<ISphParticle> particles);
13+
14+
void renderFrame(std::vector<ISphParticle> particles); //Vector is only a placeholder here as the data structure isnt decided yet
15+
16+
void mergeFramesAndFlushVideo(std::string file);
17+
18+
Vector3 getLocation();
19+
Vector3 getDirection();
20+
21+
private:
22+
Vector3 location;
23+
Vector3 direction;
24+
unsigned int width;
25+
unsigned int height;
26+
std::vector<Frame> frames;
27+
28+
Frame getFrame(unsigned int frameID);
29+
};

SphWaterfall/SphWaterfall/src/visualization/Dummy.txt

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#pragma once
2+
#include "Frame.h"
3+
#include "Pixel.h"
4+
5+
Frame::Frame() {
6+
this->width = 0;
7+
this->height = 0;
8+
}
9+
10+
Frame::Frame(unsigned int width, unsigned int height) {
11+
this->width = width;
12+
this->height = height;
13+
}
14+
15+
Pixel Frame::getPixel(unsigned int x, unsigned int y) {
16+
if (pixels.size >= y*height + x) {
17+
return;
18+
}
19+
return pixels.at(y*height + x);
20+
}
21+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#pragma once
2+
#include "Pixel.h"
3+
#include <vector>
4+
5+
class Frame {
6+
public:
7+
Frame(); //To genereate placeholder
8+
Frame(unsigned int width, unsigned int height);
9+
10+
Pixel getPixel(unsigned int x, unsigned int y);
11+
12+
private:
13+
unsigned int width;
14+
unsigned int height;
15+
std::vector<Pixel> pixels;
16+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#pragma once
2+
#include "Pixel.h"
3+
4+
Pixel::Pixel() {
5+
this->red = 0;
6+
this->green = 0;
7+
this->blue = 0;
8+
}
9+
10+
Pixel::Pixel(unsigned short red, unsigned short green, unsigned short blue) {
11+
this->red = red;
12+
this->green = green;
13+
this->blue = blue;
14+
}
15+
16+
void Pixel::setColor(unsigned short red, unsigned short green, unsigned short blue) {
17+
this->red = red;
18+
this->green = green;
19+
this->blue = blue;
20+
}
21+
22+
void Pixel::setRed(unsigned short red) {
23+
this->red = red;
24+
}
25+
26+
void Pixel::setGreen(unsigned short green) {
27+
this->green = green;
28+
}
29+
30+
void Pixel::setBlue(unsigned short blue) {
31+
this->blue = blue;
32+
}
33+
34+
unsigned short Pixel::getRedValue() {
35+
return this->red;
36+
}
37+
38+
unsigned short Pixel::getGreenValue() {
39+
return this->green;
40+
}
41+
42+
unsigned short Pixel::getBlueValue() {
43+
return this->blue;
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#pragma once
2+
3+
class Pixel {
4+
public:
5+
Pixel();
6+
Pixel(unsigned short red, unsigned short green, unsigned short blue);
7+
8+
unsigned short getRedValue();
9+
unsigned short getGreenValue();
10+
unsigned short getBlueValue();
11+
12+
void setColor(unsigned short red, unsigned short green, unsigned short blue);
13+
void setRed(unsigned short red);
14+
void setGreen(unsigned short green);
15+
void setBlue(unsigned short blue);
16+
17+
private:
18+
unsigned short red;
19+
unsigned short green;
20+
unsigned short blue;
21+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include "Camera.h"
2+
3+
std::vector<Camera> cameras;
4+
5+
void init(Vector3 cameraLocation, Vector3 cameraDirection, unsigned int frameWidth, unsigned int frameHeight) {
6+
Camera mainCam = Camera(cameraLocation, cameraDirection, frameWidth, frameHeight);
7+
cameras.emplace_back(mainCam);
8+
}
9+
10+
void debugRenderFrame(std::vector<ISphParticle> particles) {
11+
//TODO: implement debug rendering
12+
}

0 commit comments

Comments
 (0)