mirror of
https://github.com/Linloir/SceneEditor.git
synced 2025-12-17 07:28:12 +08:00
update model to set LOADED
This commit is contained in:
parent
7f7d99caa8
commit
0cc3672c33
@ -13,7 +13,7 @@
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{BB1EFCBB-6CD7-4283-8C3F-69AE88470EED}</ProjectGuid>
|
||||
<Keyword>QtVS_v304</Keyword>
|
||||
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">10.0.22621.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">10.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">10.0.22621.0</WindowsTargetPlatformVersion>
|
||||
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -13,6 +13,7 @@ Model::~Model() {
|
||||
// TODO: Maybe delete all meshes?
|
||||
}
|
||||
|
||||
// file path is ...\\...\\.obj, and processnode & processmesh have been called here
|
||||
void Model::loadModel(std::string path) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene* scene = importer.ReadFile(
|
||||
@ -26,6 +27,7 @@ void Model::loadModel(std::string path) {
|
||||
_directory = path.substr(0, path.find_last_of('/'));
|
||||
|
||||
processNode(scene->mRootNode, scene);
|
||||
_status = LOADED;
|
||||
}
|
||||
|
||||
void Model::processNode(aiNode* node, const aiScene* scene) {
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
#include "vao.h"
|
||||
#include "shader.h"
|
||||
#include "logger.h"
|
||||
#include "model.h"
|
||||
|
||||
using std::vector;
|
||||
|
||||
@ -39,6 +40,7 @@ void SceneViewer::resizeGL(int w, int h) {
|
||||
void SceneViewer::paintGL() {
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
/*
|
||||
vector<Vertex> vertices = {
|
||||
{ { -0.5f, -0.5f, 0.0f } },
|
||||
{ { 0.5f, -0.5f, 0.0f } },
|
||||
@ -47,11 +49,19 @@ void SceneViewer::paintGL() {
|
||||
VertexBufferObject vbo(vertices);
|
||||
VertexArrayObject vao(vbo);
|
||||
vao.setVertexAttributePointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0);
|
||||
|
||||
vao.enableVertexAttribute(0);
|
||||
VertexShader vertexShader("E:\\Repositories\\CollegeProjects\\CGAssignments\\FinalProject\\FinalProject\\vertexshader.vs");
|
||||
FragmentShader fragmentShader("E:\\Repositories\\CollegeProjects\\CGAssignments\\FinalProject\\FinalProject\\fragmentshader.fs");
|
||||
*/
|
||||
|
||||
|
||||
VertexShader vertexShader("D:\\code\\ComputerGraphic\\SceneEditor\\FinalProject\\vertexshader.vs");
|
||||
FragmentShader fragmentShader("D:\\code\\ComputerGraphic\\SceneEditor\\FinalProject\\fragmentshader.fs");
|
||||
ShaderProgram shaderProgram(vertexShader, fragmentShader);
|
||||
shaderProgram.setActive();
|
||||
vao.bind();
|
||||
|
||||
Model test_model("D:\\code\\ComputerGraphic\\SceneEditor\\obj\\nanosuit/nanosuit.obj");
|
||||
test_model.render(shaderProgram);
|
||||
|
||||
//vao.bind();
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user