removed obj model

This commit is contained in:
Sandro Sobczyński
2020-11-01 10:42:24 +01:00
parent d4be8e94e7
commit ef7bd425db
8 changed files with 119 additions and 196 deletions
+19 -9
View File
@@ -13,10 +13,10 @@
#include "math/vector3.hpp"
#include "math/plane.hpp"
#include "obj_model.hpp"
#include "dff_model.hpp"
#include "md2_model.hpp"
#include "./mesh_texture.hpp"
#include "./mesh_frame.hpp"
#include <tamtypes.h>
#include <draw_types.h>
#include <draw_buffers.h>
@@ -31,7 +31,6 @@ public:
u8 shouldBeLighted, shouldBeBackfaceCulled, shouldBeFrustumCulled;
MD2Model *md2;
ObjModel *obj;
DffModel *dff;
float scale;
color_t color;
@@ -39,8 +38,8 @@ public:
Mesh();
~Mesh();
void loadObj(char *t_subfolder, char *t_objFile, Vector3 &t_initPos, float t_scale, u16 framesAmount);
void setObj(Vector3 &t_initPos, ObjModel *t_objModel);
void loadObj(char *t_subfolder, char *t_objFile, Vector3 &t_initPos, float t_scale, u16 t_framesCount);
// void setObj(Vector3 &t_initPos); // TODO
void loadDff(char *t_subfolder, char *t_dffFile, Vector3 &t_initPos, float t_scale);
void setDff(Vector3 &t_initPos, DffModel *t_dffModel);
void loadMD2(char *t_subfolder, char *t_md2File, Vector3 &t_initPos, float t_scale);
@@ -57,21 +56,32 @@ public:
u32 id;
MeshTexture *textures;
/** Array of materials. Size of getMaterialsCount() */
MeshMaterial *getMaterials() const { return obj->frames[0].getMaterials(); };
// NOWE TODO
const u32 &getMaterialsCount() const { return obj->frames[0].getMaterialsCount(); };
u16 framesCount;
MeshFrame *frames;
AnimState animState;
void animate();
u32 getDrawData(u32 t_materialIndex, VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, Vector3 &t_cameraPos, float t_scale, u8 t_shouldBeBackfaceCulled);
u32 getFacesCount();
u8 isMemoryAllocated;
/** Array of materials. Size of getMaterialsCount() */
MeshMaterial *getMaterials() const { return frames[0].getMaterials(); };
const u32 &getMaterialsCount() const { return frames[0].getMaterialsCount(); };
/** Returns material, which is a mesh "subgroup". */
MeshMaterial &getMaterial(const u32 &i) const { return obj->frames[0].getMaterial(i); };
MeshMaterial &getMaterial(const u32 &i) const { return frames[0].getMaterial(i); };
/**
* Returns material, which is a mesh "subgroup".
* NULL if not found.
*/
MeshMaterial *getMaterialById(const u32 &t_id) const { return obj->frames[0].getMaterialById(t_id); }
MeshMaterial *getMaterialById(const u32 &t_id) const { return frames[0].getMaterialById(t_id); }
private:
Vector3 calc3Vectors[3];
void setupLodAndClut();
void setDefaultWrapSettings(texwrap_t &t_wrapSettings);
u32 verticesCount;
-44
View File
@@ -1,44 +0,0 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2020, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#ifndef _TYRA_OBJ_MODEL_
#define _TYRA_OBJ_MODEL_
#include <tamtypes.h>
#include <math3d.h>
#include "math/vector3.hpp"
#include "utils/debug.hpp"
#include "./anim_state.hpp"
#include "./mesh_material.hpp"
#include "./mesh_frame.hpp"
/** Class which have common types for all 3D objects */
class ObjModel
{
public:
/** File name without extension */
char *filename;
u16 frameCount;
MeshFrame *frames;
AnimState animState;
ObjModel(char *t_objFile);
~ObjModel();
void animate();
u32 getDrawData(u32 t_materialIndex, VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, Vector3 &t_cameraPos, float t_scale, u8 t_shouldBeBackfaceCulled);
u32 getFacesCount();
u8 isMemoryAllocated;
private:
Vector3 calc3Vectors[3];
};
#endif