add reading keypoints from file
This commit is contained in:
parent
a500d8febc
commit
312d30ec3e
104
grafika_projekt/keypoints/fishKeyPointsFirst.csv
Normal file
104
grafika_projekt/keypoints/fishKeyPointsFirst.csv
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
12.0,-130.0,33.0
|
||||||
|
12.0,-130.0,26.0
|
||||||
|
12.0,-130.0,19.0
|
||||||
|
12.0,-130.0,12.0
|
||||||
|
19.0,-130.0,5.0
|
||||||
|
26.0,-130.0,-2.0
|
||||||
|
33.0,-130.0,-2.0
|
||||||
|
40.0,-130.0,-9.0
|
||||||
|
33.0,-130.0,-16.0
|
||||||
|
26.0,-130.0,-23.0
|
||||||
|
19.0,-130.0,-30.0
|
||||||
|
19.0,-130.0,-37.0
|
||||||
|
19.0,-130.0,-44.0
|
||||||
|
26.0,-130.0,-51.0
|
||||||
|
33.0,-130.0,-58.0
|
||||||
|
33.0,-130.0,-65.0
|
||||||
|
26.0,-130.0,-72.0
|
||||||
|
19.0,-130.0,-79.0
|
||||||
|
12.0,-130.0,-86.0
|
||||||
|
5.0,-130.0,-86.0
|
||||||
|
-2.0,-130.0,-86.0
|
||||||
|
-9.0,-130.0,-79.0
|
||||||
|
-16.0,-130.0,-72.0
|
||||||
|
-23.0,-130.0,-65.0
|
||||||
|
-30.0,-130.0,-58.0
|
||||||
|
-37.0,-130.0,-51.0
|
||||||
|
-44.0,-130.0,-51.0
|
||||||
|
-51.0,-130.0,-51.0
|
||||||
|
-58.0,-130.0,-44.0
|
||||||
|
-58.0,-130.0,-37.0
|
||||||
|
-58.0,-130.0,-30.0
|
||||||
|
-65.0,-130.0,-23.0
|
||||||
|
-72.0,-130.0,-16.0
|
||||||
|
-79.0,-130.0,-16.0
|
||||||
|
-86.0,-130.0,-9.0
|
||||||
|
-86.0,-130.0,-2.0
|
||||||
|
-86.0,-130.0,5.0
|
||||||
|
-86.0,-130.0,12.0
|
||||||
|
-86.0,-130.0,19.0
|
||||||
|
-79.0,-130.0,26.0
|
||||||
|
-72.0,-130.0,33.0
|
||||||
|
-65.0,-130.0,40.0
|
||||||
|
-58.0,-130.0,47.0
|
||||||
|
-51.0,-130.0,54.0
|
||||||
|
-44.0,-130.0,61.0
|
||||||
|
-37.0,-130.0,68.0
|
||||||
|
-30.0,-130.0,75.0
|
||||||
|
-37.0,-130.0,82.0
|
||||||
|
-44.0,-130.0,89.0
|
||||||
|
-51.0,-130.0,96.0
|
||||||
|
-51.0,-130.0,103.0
|
||||||
|
-51.0,-130.0,110.0
|
||||||
|
-51.0,-130.0,117.0
|
||||||
|
-44.0,-130.0,124.0
|
||||||
|
-37.0,-130.0,131.0
|
||||||
|
-30.0,-130.0,138.0
|
||||||
|
-23.0,-130.0,145.0
|
||||||
|
-16.0,-130.0,152.0
|
||||||
|
-9.0,-130.0,159.0
|
||||||
|
-2.0,-130.0,152.0
|
||||||
|
5.0,-130.0,145.0
|
||||||
|
12.0,-130.0,138.0
|
||||||
|
19.0,-130.0,131.0
|
||||||
|
26.0,-130.0,131.0
|
||||||
|
33.0,-130.0,131.0
|
||||||
|
40.0,-130.0,131.0
|
||||||
|
47.0,-130.0,131.0
|
||||||
|
54.0,-130.0,131.0
|
||||||
|
61.0,-130.0,131.0
|
||||||
|
61.0,-130.0,138.0
|
||||||
|
68.0,-130.0,145.0
|
||||||
|
75.0,-130.0,152.0
|
||||||
|
82.0,-130.0,159.0
|
||||||
|
89.0,-130.0,166.0
|
||||||
|
96.0,-130.0,166.0
|
||||||
|
103.0,-130.0,166.0
|
||||||
|
110.0,-130.0,159.0
|
||||||
|
117.0,-130.0,152.0
|
||||||
|
124.0,-130.0,145.0
|
||||||
|
131.0,-130.0,138.0
|
||||||
|
124.0,-130.0,131.0
|
||||||
|
117.0,-130.0,124.0
|
||||||
|
110.0,-130.0,117.0
|
||||||
|
103.0,-130.0,110.0
|
||||||
|
110.0,-130.0,103.0
|
||||||
|
117.0,-130.0,96.0
|
||||||
|
117.0,-130.0,89.0
|
||||||
|
110.0,-130.0,82.0
|
||||||
|
103.0,-130.0,82.0
|
||||||
|
96.0,-130.0,82.0
|
||||||
|
89.0,-130.0,82.0
|
||||||
|
82.0,-130.0,75.0
|
||||||
|
82.0,-130.0,68.0
|
||||||
|
75.0,-130.0,61.0
|
||||||
|
68.0,-130.0,54.0
|
||||||
|
61.0,-130.0,54.0
|
||||||
|
54.0,-130.0,54.0
|
||||||
|
47.0,-130.0,47.0
|
||||||
|
47.0,-130.0,40.0
|
||||||
|
40.0,-130.0,40.0
|
||||||
|
33.0,-130.0,40.0
|
||||||
|
26.0,-130.0,33.0
|
||||||
|
19.0,-130.0,33.0
|
||||||
|
12.0,-130.0,33.0
|
|
12
grafika_projekt/keypoints/fishKeyPointsSecond.csv
Normal file
12
grafika_projekt/keypoints/fishKeyPointsSecond.csv
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
0.0, 0.0, 15.0
|
||||||
|
-20.0, 10.0, 10.0
|
||||||
|
-35.0, 15.0, 5.0
|
||||||
|
-55.0, 0.0, 5.0
|
||||||
|
-70.0, 0.0, 0.0
|
||||||
|
-70.0, 0.0, -10.0
|
||||||
|
-70.0, 0.0, -25.0
|
||||||
|
-85.0, 0.0, -35.0
|
||||||
|
-115.0, 0.0, -45.0
|
||||||
|
-135.0, 0.0, -25.0
|
||||||
|
-155.0, 0.0, -5.0
|
||||||
|
-175.0, 0.0, 0.0
|
|
26
grafika_projekt/keypoints/fishKeyPointsThird.csv
Normal file
26
grafika_projekt/keypoints/fishKeyPointsThird.csv
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
0.0, -130.0, 0.0
|
||||||
|
50.0, -130.0, 25.0
|
||||||
|
75.0, -130.0, 75.0
|
||||||
|
40.0, -130.0, 100.0
|
||||||
|
-25.0, -130.0, 85.0
|
||||||
|
-60.0, -130.0, 75.0
|
||||||
|
-75.0, -130.0, 70.0
|
||||||
|
-100.0, -130.0, 35.0
|
||||||
|
-90.0, -130.0, 0.0
|
||||||
|
-105.0, -130.0, -50.0
|
||||||
|
-95.0, -130.0, -75.0
|
||||||
|
-115.0, -130.0, -100.0
|
||||||
|
-75.0, -130.0, -120.0
|
||||||
|
-70.0, -130.0, -135.0
|
||||||
|
-35.0, -130.0, -120.0
|
||||||
|
10.0, -130.0, -150.0
|
||||||
|
25.0, -130.0, -135.0
|
||||||
|
50.0, -130.0, -140.0
|
||||||
|
60.0, -130.0, -110.0
|
||||||
|
50.0, -130.0, -75.0
|
||||||
|
30.0, -130.0, -85.0
|
||||||
|
10.0, -130.0, -50.0
|
||||||
|
-40.0, -130.0, -65.0
|
||||||
|
-25.0, -130.0, -25.0
|
||||||
|
-15.0, -130.0, -10.0
|
||||||
|
0.0, -130.0, 0.0
|
|
9
grafika_projekt/keypoints/sharkKeyPoints.csv
Normal file
9
grafika_projekt/keypoints/sharkKeyPoints.csv
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
-400.0, 100.0, -400.0
|
||||||
|
-300.0, 100.0, -300.0
|
||||||
|
-200.0, 100.0, -200.0
|
||||||
|
-100.0, 100.0, -100.0
|
||||||
|
0.0, 100.0, 0.0
|
||||||
|
100.0, 100.0, 100.0
|
||||||
|
200.0, 100.0, 200.0
|
||||||
|
300.0, 100.0, 300.0
|
||||||
|
400.0, 100.0, 400.0
|
|
@ -4,6 +4,8 @@
|
|||||||
#include "glm.hpp"
|
#include "glm.hpp"
|
||||||
#include "ext.hpp"
|
#include "ext.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <random>
|
#include <random>
|
||||||
@ -54,63 +56,13 @@ Core::RenderContext fangtoothContext;
|
|||||||
Core::RenderContext sharkContext;
|
Core::RenderContext sharkContext;
|
||||||
Core::RenderContext bubbleContext;
|
Core::RenderContext bubbleContext;
|
||||||
|
|
||||||
std::vector<glm::vec3> fishKeyPointsFirst({
|
std::vector<glm::vec3> fishKeyPointsFirst;
|
||||||
glm::vec3(0.0f, -130.0f, 0.0f),
|
|
||||||
glm::vec3(50.0f, -130.0f, 25.0f),
|
|
||||||
glm::vec3(75.0f, -130.0f, 75.0f),
|
|
||||||
glm::vec3(40.0f, -130.0f, 100.0f),
|
|
||||||
glm::vec3(-25.0f, -130.0f, 85.0f),
|
|
||||||
glm::vec3(-60.0f, -130.0f, 75.0f),
|
|
||||||
glm::vec3(-75.0f, -130.0f, 70.0f),
|
|
||||||
glm::vec3(-100.0f, -130.0f, 35.0f),
|
|
||||||
glm::vec3(-90.0f, -130.0f, 0.0f),
|
|
||||||
glm::vec3(-105.0f, -130.0f, -50.0f),
|
|
||||||
glm::vec3(-95.0f, -130.0f, -75.0f),
|
|
||||||
glm::vec3(-115.0f, -130.0f, -100.0f),
|
|
||||||
glm::vec3(-75.0f, -130.0f, -120.0f),
|
|
||||||
glm::vec3(-70.0f, -130.0f, -135.0f),
|
|
||||||
glm::vec3(-35.0f, -130.0f, -120.0f),
|
|
||||||
glm::vec3(10.0f, -130.0f, -150.0f),
|
|
||||||
glm::vec3(25.0f, -130.0f, -135.0f),
|
|
||||||
glm::vec3(50.0f, -130.0f, -140.0f),
|
|
||||||
glm::vec3(60.0f, -130.0f, -110.0f),
|
|
||||||
glm::vec3(50.0f, -130.0f, -75.0f),
|
|
||||||
glm::vec3(30.0f, -130.0f, -85.0f),
|
|
||||||
glm::vec3(10.0f, -130.0f, -50.0f),
|
|
||||||
glm::vec3(-40.0f, -130.0f, -65.0f),
|
|
||||||
glm::vec3(-25.0f, -130.0f, -25.0f),
|
|
||||||
glm::vec3(-15.0f, -130.0f, -10.0f),
|
|
||||||
glm::vec3(0.0f, -130.0f, 0.0f),
|
|
||||||
});
|
|
||||||
std::vector<glm::quat> fishKeyRotationFirst;
|
std::vector<glm::quat> fishKeyRotationFirst;
|
||||||
|
|
||||||
std::vector<glm::vec3> fishKeyPointsSecond({
|
std::vector<glm::vec3> fishKeyPointsSecond;
|
||||||
glm::vec3(0.0f, 0.0f, 15.0f),
|
|
||||||
glm::vec3(-20.0f, 10.0f, 10.0f),
|
|
||||||
glm::vec3(-35.0f, 15.0f, 5.0f),
|
|
||||||
glm::vec3(-55.0f, 0.0f, 5.0f),
|
|
||||||
glm::vec3(-70.0f, 0.0f, 0.0f),
|
|
||||||
glm::vec3(-70.0f, 0.0f, -10.0f),
|
|
||||||
glm::vec3(-70.0f, 0.0f, -25.0f),
|
|
||||||
glm::vec3(-85.0f, 0.0f, -35.0f),
|
|
||||||
glm::vec3(-115.0f, 0.0f, -45.0f),
|
|
||||||
glm::vec3(-135.0f, 0.0f, -25.0f),
|
|
||||||
glm::vec3(-155.0f, 0.0f, -5.0f),
|
|
||||||
glm::vec3(-175.0f, 0.0f, 0.0f)
|
|
||||||
});
|
|
||||||
std::vector<glm::quat> fishKeyRotationSecond;
|
std::vector<glm::quat> fishKeyRotationSecond;
|
||||||
|
|
||||||
std::vector<glm::vec3> sharkKeyPoints({
|
std::vector<glm::vec3> sharkKeyPoints;
|
||||||
glm::vec3(-400.0f, 100.0f, -400.0f),
|
|
||||||
glm::vec3(-300.0f, 100.0f, -300.0f),
|
|
||||||
glm::vec3(-200.0f, 100.0f, -200.0f),
|
|
||||||
glm::vec3(-100.0f, 100.0f, -100.0f),
|
|
||||||
glm::vec3(0.0f, 100.0f, 0.0f),
|
|
||||||
glm::vec3(100.0f, 100.0f, 100.0f),
|
|
||||||
glm::vec3(200.0f, 100.0f, 200.0f),
|
|
||||||
glm::vec3(300.0f, 100.0f, 300.0f),
|
|
||||||
glm::vec3(400.0f, 100.0f, 400.0f),
|
|
||||||
});
|
|
||||||
std::vector<glm::quat> sharkKeyRotation;
|
std::vector<glm::quat> sharkKeyRotation;
|
||||||
|
|
||||||
|
|
||||||
@ -463,10 +415,10 @@ void renderScene()
|
|||||||
|
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
if (time > -10) {
|
if (time > -10) {
|
||||||
drawObjectTexture(fishContext, animationMatrix(time + 15, change1, fishKeyPointsFirst, fishKeyRotationFirst, glm::vec3(0.8f), 1.f), textureFish, programTexture);
|
drawObjectTexture(fishContext, animationMatrix(time + 15, change1, fishKeyPointsFirst, fishKeyRotationFirst, glm::vec3(0.8f), 5.f), textureFish, programTexture);
|
||||||
drawObjectTexture(fishContext, animationMatrix(time + 15, change2, fishKeyPointsFirst, fishKeyRotationFirst, glm::vec3(0.8f), 1.f), textureFish, programTexture);
|
drawObjectTexture(fishContext, animationMatrix(time + 15, change2, fishKeyPointsFirst, fishKeyRotationFirst, glm::vec3(0.8f), 5.f), textureFish, programTexture);
|
||||||
drawObjectTexture(fishContext, animationMatrix(time + 15, change3, fishKeyPointsFirst, fishKeyRotationFirst, glm::vec3(0.8f), 1.f), textureFish, programTexture);
|
drawObjectTexture(fishContext, animationMatrix(time + 15, change3, fishKeyPointsFirst, fishKeyRotationFirst, glm::vec3(0.8f), 5.f), textureFish, programTexture);
|
||||||
drawObjectTexture(fishContext, animationMatrix(time + 15, change4, fishKeyPointsFirst, fishKeyRotationFirst, glm::vec3(0.8f), 1.f), textureFish, programTexture);
|
drawObjectTexture(fishContext, animationMatrix(time + 15, change4, fishKeyPointsFirst, fishKeyRotationFirst, glm::vec3(0.8f), 5.f), textureFish, programTexture);
|
||||||
drawObjectTexture(fangtoothContext, animationMatrix(time + 15, change1, fishKeyPointsSecond, fishKeyRotationSecond, glm::vec3(0.25f), 1.f), textureFangtooth, programTexture);
|
drawObjectTexture(fangtoothContext, animationMatrix(time + 15, change1, fishKeyPointsSecond, fishKeyRotationSecond, glm::vec3(0.25f), 1.f), textureFangtooth, programTexture);
|
||||||
time -= 5;
|
time -= 5;
|
||||||
}
|
}
|
||||||
@ -543,6 +495,41 @@ unsigned int loadCubemap()
|
|||||||
return textureID;
|
return textureID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<glm::vec3>parse(std::string filename)
|
||||||
|
{
|
||||||
|
std::ifstream data(filename);
|
||||||
|
std::string line;
|
||||||
|
std::vector<glm::vec3> result;
|
||||||
|
|
||||||
|
while (std::getline(data, line))
|
||||||
|
{
|
||||||
|
std::stringstream lineStream(line);
|
||||||
|
std::string cell;
|
||||||
|
glm::vec3 row;
|
||||||
|
int i = 0;
|
||||||
|
while (std::getline(lineStream, cell, ','))
|
||||||
|
{
|
||||||
|
switch (i%3) {
|
||||||
|
case 0:
|
||||||
|
row.x = std::stof(cell);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
row.y = std::stof(cell);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
row.z = std::stof(cell);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i += 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
result.push_back(row);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void initSkybox()
|
void initSkybox()
|
||||||
{
|
{
|
||||||
glGenVertexArrays(1, &skyboxVAO);
|
glGenVertexArrays(1, &skyboxVAO);
|
||||||
@ -625,10 +612,16 @@ void init()
|
|||||||
generateFishArray();
|
generateFishArray();
|
||||||
generateBubbleArray();
|
generateBubbleArray();
|
||||||
|
|
||||||
|
fishKeyPointsFirst = parse("keypoints/fishKeyPointsFirst.csv");
|
||||||
|
fishKeyPointsSecond = parse("keypoints/fishKeyPointsSecond.csv");
|
||||||
|
sharkKeyPoints = parse("keypoints/sharkKeyPoints.csv");
|
||||||
|
|
||||||
initKeyRotation(fishKeyPointsFirst, fishKeyRotationFirst);
|
initKeyRotation(fishKeyPointsFirst, fishKeyRotationFirst);
|
||||||
initKeyRotation(fishKeyPointsSecond, fishKeyRotationSecond);
|
initKeyRotation(fishKeyPointsSecond, fishKeyRotationSecond);
|
||||||
initKeyRotation(sharkKeyPoints, sharkKeyRotation);
|
initKeyRotation(sharkKeyPoints, sharkKeyRotation);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
initCube();
|
initCube();
|
||||||
initSkybox();
|
initSkybox();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user