Merge branch 'importing_ply' into test_branch
This commit is contained in:
commit
db7f06c19b
@ -190,7 +190,6 @@ void drawObjectTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLui
|
||||
glUniformMatrix4fv(glGetUniformLocation(program, "transformation"), 1, GL_FALSE, (float*)&transformation);
|
||||
glUniformMatrix4fv(glGetUniformLocation(program, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
|
||||
glUniform3f(glGetUniformLocation(program, "lightPos"), 0, 0, 0);
|
||||
|
||||
Core::DrawContext(context);
|
||||
glUseProgram(0);
|
||||
|
||||
@ -201,15 +200,30 @@ void placeObjectOnPlanet(Core::RenderContext& objectContext, glm::mat4 objectMat
|
||||
|
||||
//float diameter = ?;
|
||||
float diameter = 10;
|
||||
//objectMatrix = objectMatrix * glm::translate(placePoint * 0.1f);
|
||||
glm::vec3 base = glm::vec3(0.f, 0.f, 1.f);
|
||||
glm::vec3 axis;
|
||||
float angle;
|
||||
//odpowiednio obrócić
|
||||
|
||||
objectMatrix = objectMatrix*glm::translate(placePoint * diameter) * glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f),
|
||||
placePoint,
|
||||
glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
objectMatrix = objectMatrix;
|
||||
axis = glm::cross( placePoint,base);
|
||||
angle = dot(base, placePoint);
|
||||
angle = acos(angle);
|
||||
glm::mat4 cobjectMatrix = objectMatrix;
|
||||
// wysunąć w dobrą stronę
|
||||
cobjectMatrix = cobjectMatrix * glm::translate(base * diameter)* glm::rotate(cobjectMatrix, angle, axis);
|
||||
|
||||
|
||||
//objectMatrix = objectMatrix * glm::lookAt(
|
||||
// placePoint,
|
||||
// glm::vec3(0, 0, 0),
|
||||
// glm::vec3(0.0f, 0.0f, 1.0f));
|
||||
|
||||
|
||||
//* objectMatrix;
|
||||
//*glm::translate(placePoint)
|
||||
//TEMPORARY DRAW FUNCTION
|
||||
drawObjectBiomes(objectContext, objectMatrix , programBiomes);
|
||||
drawObjectBiomes(objectContext, cobjectMatrix , programBiomes);
|
||||
|
||||
|
||||
|
||||
@ -226,7 +240,7 @@ void renderScene(GLFWwindow* window)
|
||||
|
||||
drawObjectBiomes(sphereContext, glm::mat4(), programBiomes);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
placeObjectOnPlanet(plantContext, glm::scale(glm::mat4(), glm::vec3(0.2)), normalize(glm::vec3(0.1*i, 0.f, 1.f)), sphereContext, planetMatrix);
|
||||
placeObjectOnPlanet(plantContext, glm::scale(glm::mat4(), glm::vec3(0.2)), normalize(glm::vec3(0.1*i, 0.f, 0.f)), sphereContext, planetMatrix);
|
||||
placeObjectOnPlanet(plantContext, glm::scale(glm::mat4(), glm::vec3(0.2)), normalize(glm::vec3(-0.1 * i, 0.f, 1.f)), sphereContext, planetMatrix);
|
||||
placeObjectOnPlanet(plantContext, glm::scale(glm::mat4(), glm::vec3(0.2)), normalize(glm::vec3(0.1 * i, 0.f, -1.f)), sphereContext, planetMatrix);
|
||||
placeObjectOnPlanet(plantContext, glm::scale(glm::mat4(), glm::vec3(0.2)), normalize(glm::vec3(-0.1 * i, 0.f, -1.f)), sphereContext, planetMatrix);
|
||||
|
Loading…
Reference in New Issue
Block a user