OpenGL DrawMesh和静态网格物体

时间:2018-12-09 22:51:35

标签: c++ opengl glm-math wavefront

因此,我试图从obj文件渲染球体并执行函数接受的转换,并且还尝试为静态网格物体创建3个函数,但是我遇到了麻烦,因为我只有在所有功能都属于1功能时才完成此操作,而没有拆分为3。

// SPHERE.H

var headers = new HttpClient().DefaultRequestHeaders;

PropertyInfo[] properties = headers.GetType().GetProperties();
foreach (var property in properties)
      Console.WriteLine(property.Name);

// SPHERE.CPP

#pragma once
#include "SceneNode.h"
#include "StaticMesh.h"
#include "glm\glm.hpp"

class Sphere : public SceneNode
{
public:
    //Constructor
    Sphere(glm::mat4 transformation, ShaderInfo some_shaders[10]);
    void SceneNode::drawMesh(glm::mat4 transformation) override;

};

// STATICMESH.H

#include "Sphere.h"


Sphere::Sphere(glm::mat4 transformation, ShaderInfo some_shaders[10]) : 
SceneNode(transformation, some_shaders)
{
    mesh = StaticMesh("Sphere.obj");
}

void drawMesh(glm::mat4 transformation)
{
//implement transformation
}

// STATICMESH.CPP

#ifndef STATICMESH_HEADER
#define STSTAICMESH_HEADER

#include <../glm/glm/glm.hpp>

class StaticMesh
{

public:
    int number_of_vertices;
    int number_of_faces;
    float ** vertices;
    float ** faces;

    //Constructors
    StaticMesh();   
    StaticMesh(char* fileName);
    StaticMesh(float vertices[][3], float faces[][3]);

};
#endif

这是我发生的问题之一。当我将静态网格划分为3个函数时,我不知道如何实现;当网格小于1时,我使用下面的代码效果很好

#include "StaticMesh.h"
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#pragma once

using namespace std;

StaticMesh::StaticMesh()
{}
StaticMesh::StaticMesh(char* fileName)
{}
StaticMesh::StaticMesh(float vertices[][3], float faces[][3])
{}

0 个答案:

没有答案