Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void createShape(){
- double height = this->height + this->length;
- // piciorul 1
- this->colors = glm::vec3(0.1, 0.1, 0.9);
- this->addVertex(0.0, 0.0, 0.0);
- this->colors = glm::vec3(0.6, 0.1, 0.2);
- this->addVertex(0.0, 0.0, length);
- this->colors = glm::vec3(0.1, 0.1, 0.9);
- this->addVertex(0.0f, this->height + 2 * length / TAN(angle), (double)length);
- this->colors = glm::vec3(0.6, 0.1, 0.2);
- this->addVertex(0.0, this->height + length / TAN(angle), 0.0);
- // piciorul 2
- this->colors = glm::vec3(0.1, 0.1, 0.9);
- this->addVertex(length, 0.0, 0.0);
- this->colors = glm::vec3(0.6, 0.1, 0.2);
- this->addVertex(length, 0.0, length);
- this->colors = glm::vec3(0.1, 0.1, 0.9);
- this->addVertex((double)length, this->height + 2 * length / TAN(angle), (double)length);
- this->colors = glm::vec3(0.6, 0.1, 0.2);
- this->addVertex(length, this->height + length / TAN(angle), 0.0);
- this->addIndex(0, 1, 2);
- this->addIndex(0, 2, 3);
- this->addIndex(4, 5, 6);
- this->addIndex(4, 6, 7);
- this->colors = glm::vec3(1, 0.3, 0.1);
- double startHeight, newHeight;
- double startZ = this->height - height, newZ;
- startHeight = this->height;
- int size;
- while (startZ < 100){
- size = this->vertices.size();
- this->addVertex(0.0f, startHeight, startZ);
- this->addVertex((float)length, startHeight, startZ);
- newZ = startZ + 1;
- newHeight = startHeight + abs(newZ-startZ) * COS(angle) / SIN(angle);
- this->addVertex((float)length, newHeight, newZ);
- this->addVertex(0.0f, newHeight, newZ);
- startHeight = newHeight;
- startZ = newZ;
- this->addIndex(size, size+1, size+2);
- this->addIndex(size, size+2, size+3);
- }
- size = this->vertices.size();
- //piciorul 3
- this->colors = glm::vec3(0.1, 0.1, 0.9);
- this->addVertex(0.0, 0.0, startZ-length);
- this->colors = glm::vec3(0.6, 0.1, 0.2);
- this->addVertex(0.0, 0.0, startZ);
- this->colors = glm::vec3(0.1, 0.1, 0.9);
- this->addVertex(0.0f, startHeight, (double)startZ);
- this->colors = glm::vec3(0.6, 0.1, 0.2);
- this->addVertex(0.0, startHeight - length * COS(angle) / SIN(angle), startZ - length);
- // piciorul 4
- this->colors = glm::vec3(0.1, 0.1, 0.9);
- this->addVertex(length, 0.0, startZ-length);
- this->colors = glm::vec3(0.6, 0.1, 0.2);
- this->addVertex(length, 0.0, startZ);
- this->colors = glm::vec3(0.1, 0.1, 0.9);
- this->addVertex((double)length, startHeight, (double)startZ);
- this->colors = glm::vec3(0.6, 0.1, 0.2);
- this->addVertex(length, startHeight - length * COS(angle) / SIN(angle), startZ - length);
- this->addIndex(size, size+1, size+2);
- this->addIndex(size, size+2, size+3);
- this->addIndex(size+4, size+5, size+6);
- this->addIndex(size+4, size+6, size+7);
- this->endPosition = glm::vec3( startPosition.x, startHeight + startPosition.y, startZ + startPosition.z);
- }
Advertisement
Add Comment
Please, Sign In to add comment