1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
| #include "Global.h" #include "Draw.h" #include "Camera.h" #include "Material.h"
unsigned int SCR_WIDTH = 800; const unsigned int SCR_HEIGHT = 600; const std::string TEXTURE_PATH = "D:\\TechStack\\ComputerGraphics\\RenderEngine\\Assets\\Textures\\box.png"; const std::string OUT_PATH = "D:\\TechStack\\ComputerGraphics\\RenderEngine\\Results\\"; const std::string FILE_NAME = "Model.png";
int main() { Shader shader; Material bodyMat; bodyMat.SetShader(&shader); Texture bodyTexture("D:\\TechStack\\ComputerGraphics\\RenderEngine\\Assets\\neptune\\Texf_body02.jpg"); bodyMat.SetTexture(&bodyTexture);
Material faceMat; faceMat.SetShader(&shader); Texture faceTexture("D:\\TechStack\\ComputerGraphics\\RenderEngine\\Assets\\neptune\\Tex002f_body01.jpg"); faceMat.SetTexture(&faceTexture);
Material mouseMat; mouseMat.SetShader(&shader); Texture mouseTexture("D:\\TechStack\\ComputerGraphics\\RenderEngine\\Assets\\neptune\\Texf_mouse.jpg"); mouseMat.SetTexture(&mouseTexture);
Material eyeMat; eyeMat.SetShader(&shader); Texture eyeTexture("D:\\TechStack\\ComputerGraphics\\RenderEngine\\Assets\\neptune\\Tex001f_eye.jpg"); eyeMat.SetTexture(&eyeTexture);
Model model("D:\\TechStack\\ComputerGraphics\\RenderEngine\\Assets\\neptune\\neptune.obj"); model.SetMaterial(0, mouseMat); model.SetMaterial(1, faceMat); model.SetMaterial(2, bodyMat); model.SetMaterial(3, eyeMat);
Mesh box = CreateBox(glm::vec3(0.0, 0.0, 0.0), 0.5); Material mat; mat.SetShader(&shader); Texture boxt(TEXTURE_PATH); mat.SetTexture(&boxt); Object obj(box, mat); camera = new Camera( glm::vec3(0.0f, 0.0f, 5.0f), glm::vec3(0.0f, 1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 4.0f), 60.0f, SCR_WIDTH, SCR_HEIGHT, 0.3f, 100 );
dw = new Draw(SCR_WIDTH, SCR_HEIGHT, TEXTURE_PATH); dw->Init(); dw->ClearBuffer(glm::vec4(0, 0, 0, 1));
dw->EnableFrustumCull(); Face CullMode = Back; dw->EnableFaceCull(CullMode); ViewMatrix = camera->ViewMatrix(); ProjectMatrix = camera->PerspectiveMatrix();
ModelMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(2, 0, 0)); float angle = 0.0; ModelMatrix *= glm::rotate(glm::mat4(1.0f), glm::radians(angle), glm::vec3(1.0, 1.0, 0.0)); UpdateNormalMatrix(); dw->DrawObject(obj); ModelMatrix = glm::scale(glm::mat4(1.0f), glm::vec3(0.01, 0.01, 0.01)); dw->DrawModel(model);
std::string filepath = OUT_PATH + FILE_NAME; dw->show(filepath);
return 0; }
|