Added tree, fixed imgui crash, changed how scenenode behaves
This commit is contained in:
parent
8d5b5f7ac9
commit
6c70b27d50
deploy/data
ColorMap.jpgGrass00_Color01.jpgGrass00_Normal02.jpgGrass00_Transparecy01.pngHeightMap.jpgTree01.mtlTree01.objTree01_Bark_albedo.jpgTree01_Bark_normals.pngTree01_Bark_roughness.pngTree01_Leaves_albedo.jpgTree01_Leaves_alpha.pngTree01_Leaves_normals.pngTree01_Leaves_roughness.pngsandbox.obj
src
3
deploy/data/ColorMap.jpg
Normal file
3
deploy/data/ColorMap.jpg
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0ef5565c529081f035c2a272b7e6f920e0b33ede3f0acf60c913f79cd7254c38
|
||||
size 998404
|
3
deploy/data/Grass00_Color01.jpg
Normal file
3
deploy/data/Grass00_Color01.jpg
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4320913d741a11f8494d8bfee32fe1ec6a3eadea767bd5b58bbaf1abc5ea4571
|
||||
size 1122793
|
3
deploy/data/Grass00_Normal02.jpg
Normal file
3
deploy/data/Grass00_Normal02.jpg
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c333ce51caaa31f73433958ed92ab1c929b0fa2e465d4cc1a7e0bd85ebd1a6a6
|
||||
size 1183022
|
3
deploy/data/Grass00_Transparecy01.png
Normal file
3
deploy/data/Grass00_Transparecy01.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b595bef300d4b2b26ce7332f4731fad75aadff62e3f116fbb480d376d693590b
|
||||
size 120571
|
3
deploy/data/HeightMap.jpg
Normal file
3
deploy/data/HeightMap.jpg
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ae822dec7735ae6ac1f01fb8c176031d9868cae784d966a5ff5b554acd454c02
|
||||
size 1863853
|
3
deploy/data/Tree01.mtl
Normal file
3
deploy/data/Tree01.mtl
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d24deee892de3ef3b9b688efdf33b4cd5c3557fb0cb1aeb33607b62770972dcd
|
||||
size 369
|
3
deploy/data/Tree01.obj
Normal file
3
deploy/data/Tree01.obj
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:03ee3df999e01bd004cebec7bb782fbdd9bcec6084e74a09d4e4fe0247282281
|
||||
size 1947443
|
3
deploy/data/Tree01_Bark_albedo.jpg
Normal file
3
deploy/data/Tree01_Bark_albedo.jpg
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c73b46baf07a0b889885c64c2d5a7d3027d8600e911067e2a715faf6cbd90fca
|
||||
size 267996
|
3
deploy/data/Tree01_Bark_normals.png
Normal file
3
deploy/data/Tree01_Bark_normals.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f3d70c05a2ac42bfdfc6ef5bcbb43d5af6c16dd98f7885e4f73a32c345d6bd96
|
||||
size 2139284
|
3
deploy/data/Tree01_Bark_roughness.png
Normal file
3
deploy/data/Tree01_Bark_roughness.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4abfea7a19bb381686dad653c2448464f2c59c2673173340c7ccee65de28e1af
|
||||
size 811575
|
3
deploy/data/Tree01_Leaves_albedo.jpg
Normal file
3
deploy/data/Tree01_Leaves_albedo.jpg
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a44ca584ebde2ff39ae82b62873dfead09af3125db6678b765ea5259e37d2adc
|
||||
size 1166620
|
3
deploy/data/Tree01_Leaves_alpha.png
Normal file
3
deploy/data/Tree01_Leaves_alpha.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e198f6856d4fbab967f4c9dded854c325432c7e5613f9d6f457aac1fb9ed9e7a
|
||||
size 203100
|
3
deploy/data/Tree01_Leaves_normals.png
Normal file
3
deploy/data/Tree01_Leaves_normals.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2ca55cc1407ff1e68932439531e2091e06040c6e159b9b894a5f24e411ce5741
|
||||
size 6556000
|
3
deploy/data/Tree01_Leaves_roughness.png
Normal file
3
deploy/data/Tree01_Leaves_roughness.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b022701249a4e1a1b80a0c685a05cdbcd11f80ebe4b99a3a789dbdddfa9e7a87
|
||||
size 6833993
|
BIN
deploy/data/sandbox.obj
(Stored with Git LFS)
BIN
deploy/data/sandbox.obj
(Stored with Git LFS)
Binary file not shown.
@ -64,6 +64,7 @@ void Engine::createWindow(std::string title,
|
||||
style,
|
||||
sf::ContextSettings(24, 8, 0, 3, 3, sf::ContextSettings::Attribute::Core));
|
||||
m_window->setFramerateLimit(60);
|
||||
ImGui::CreateContext();
|
||||
m_input = new Input(m_window);
|
||||
m_renderer->initGL(w, h);
|
||||
m_sparrowshell = new SparrowShell(m_window);
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#include "glm/vec2.hpp"
|
||||
|
||||
class MeshNode;
|
||||
class BackGroundNode;
|
||||
|
||||
class ButtonShape
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <SparrowRenderer/mesh.h>
|
||||
#include <bullet/btBulletCollisionCommon.h>
|
||||
#include <bullet/btBulletDynamicsCommon.h>
|
||||
#include "tools/utils.h"
|
||||
|
||||
Engine &SceneNode::getEngine()
|
||||
{
|
||||
@ -273,3 +274,15 @@ void SceneNode::setRigidBody(btRigidBody* body)
|
||||
if(m_rigidBody != nullptr)
|
||||
m_rigidBody->setUserPointer(this);
|
||||
}
|
||||
|
||||
SceneNode* SceneNode::clone()
|
||||
{
|
||||
SceneNode* node = new SceneNode(m_script);
|
||||
node->setMesh(getMesh());
|
||||
node->setTransform(getTransform());
|
||||
node->setLight(getLight());
|
||||
node->setRigidBody(new btRigidBody(m_rigidBody->getInvMass(), node->getMotionState(), m_rigidBody->getCollisionShape()));
|
||||
for(SceneNode* child : m_children)
|
||||
node->addChild(child->clone());
|
||||
return node;
|
||||
}
|
||||
|
@ -157,6 +157,9 @@ public:
|
||||
void setRigidBody(btRigidBody* body);
|
||||
btRigidBody* getRigidBody() { return m_rigidBody; }
|
||||
|
||||
/// the scene node clones itself, with no parent
|
||||
virtual SceneNode* clone();
|
||||
|
||||
// global engine methods
|
||||
Engine& getEngine();
|
||||
};
|
||||
|
@ -75,9 +75,6 @@ void ScriptNode::version(){
|
||||
oss.str("");
|
||||
oss << " SparrowRenderer version: "<< SparrowRenderer_VERSION_MAJOR << "." << SparrowRenderer_VERSION_MINOR;
|
||||
this->getEngine().getShell()->out(oss.str());
|
||||
oss.str("");
|
||||
oss << " SparrowSerializer version: "<< SparrowSerializer_VERSION_MAJOR << "." << SparrowSerializer_VERSION_MINOR;
|
||||
this->getEngine().getShell()->out(oss.str());
|
||||
}
|
||||
|
||||
void ScriptNode::clear(){
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include "scene/gui/backgroundnode.h"
|
||||
|
||||
#include "potator.h"
|
||||
//#include "potator.h"
|
||||
#include "SparrowSerializer/serializationmanager.h"
|
||||
#include "SparrowSerializer/serializable.h"
|
||||
#include <fstream>
|
||||
@ -118,27 +118,38 @@ void generateTerrain(SceneTree *scene, btDiscreteDynamicsWorld *world)
|
||||
|
||||
void generateSponza(SceneTree *scene, btDiscreteDynamicsWorld *world)
|
||||
{
|
||||
SceneNode* sponzaContainer = new SceneNode();
|
||||
scene->getRootObject()->addChild(sponzaContainer);
|
||||
Loader::setTexDirectory("data/sponza/");
|
||||
std::vector<Mesh*> meshes = Loader::loadMesh("sponza.obj");
|
||||
SceneNode* sponzaContainer = Loader::loadMesh("sponza.obj");
|
||||
Loader::setTexDirectory("data/");
|
||||
for(Mesh* m : meshes)
|
||||
if(sponzaContainer != nullptr && sponzaContainer->getChildren().size() > 0)
|
||||
{
|
||||
if(m->getName().find("fabric") != std::string::npos)
|
||||
delete m; // moyen crade de se débarasser temporairement des rideaux
|
||||
else
|
||||
const std::vector<SceneNode*> children = sponzaContainer->getChildren();
|
||||
for(SceneNode* node : children)
|
||||
{
|
||||
m->initGL();
|
||||
SceneNode *node = new SceneNode();
|
||||
node->setMesh(m);
|
||||
node->getGeometryNode()->modelMatrix = glm::scale(glm::mat4(), glm::vec3(0.01f));
|
||||
node->setTransform(node->getGeometryNode()->modelMatrix);
|
||||
sponzaContainer->addChild(node);
|
||||
btRigidBody* body = utils::buildStaticCollider(node->getGeometryNode());
|
||||
node->setRigidBody(body);
|
||||
world->addRigidBody(body);
|
||||
if(node->getMesh()->getName().find("fabric") != std::string::npos)
|
||||
{
|
||||
// moyen crade de se débarasser des rideaux
|
||||
sponzaContainer->removeChild(node);
|
||||
node->destroyWhenOrphan();
|
||||
}
|
||||
else
|
||||
{
|
||||
// scale sponza before generating the static collider
|
||||
glm::mat4 scaleMatrix = glm::scale(glm::mat4(), glm::vec3(0.01f));
|
||||
node->getGeometryNode()->modelMatrix = scaleMatrix;
|
||||
node->setTransform(scaleMatrix);
|
||||
btRigidBody* body = utils::buildStaticCollider(node->getGeometryNode());
|
||||
node->setRigidBody(body);
|
||||
world->addRigidBody(body);
|
||||
}
|
||||
}
|
||||
scene->getRootObject()->addChild(sponzaContainer);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "failed to load sponza");
|
||||
if(sponzaContainer)
|
||||
delete sponzaContainer;
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,8 +217,8 @@ public:
|
||||
scene->setMainCamera(m_player->getCamera());
|
||||
|
||||
//potator
|
||||
Potator *potator = new Potator(m_player, DefaultKeysMap::MAIN_ACTION, DefaultKeysMap::SECONDARY_ACTION, DefaultKeysMap::TERTIARY_ACTION);
|
||||
scene->getRootObject()->addChild(potator);
|
||||
//Potator *potator = new Potator(m_player, DefaultKeysMap::MAIN_ACTION, DefaultKeysMap::SECONDARY_ACTION, DefaultKeysMap::TERTIARY_ACTION);
|
||||
//scene->getRootObject()->addChild(potator);
|
||||
|
||||
//lighting
|
||||
Texture* skyboxTexture = RESOURCE_GET(Texture, "radiance");
|
||||
@ -249,21 +260,17 @@ public:
|
||||
else if(m_config->scene == "sandbox")
|
||||
{
|
||||
sun->initShadowMap(4096);
|
||||
SceneNode* sandboxContainer = new SceneNode();
|
||||
scene->getRootObject()->addChild(sandboxContainer);
|
||||
std::vector<Mesh*> meshes = Loader::loadMesh("sandbox.obj");
|
||||
for(Mesh* m : meshes)
|
||||
{
|
||||
m->initGL();
|
||||
SceneNode *node = new SceneNode();
|
||||
node->setMesh(m);
|
||||
sandboxContainer->addChild(node);
|
||||
btRigidBody* body = utils::buildStaticCollider(node->getGeometryNode());
|
||||
node->setRigidBody(body);
|
||||
scene->getPhysics()->addRigidBody(body);
|
||||
}
|
||||
SceneNode* sandbox = Loader::loadMesh("sandbox.obj");
|
||||
btRigidBody* body = utils::buildStaticCollider(sandbox->getGeometryNode());
|
||||
sandbox->setRigidBody(body);
|
||||
scene->getPhysics()->addRigidBody(body);
|
||||
scene->getRootObject()->addChild(sandbox);
|
||||
m_player->setPosition(0.f, 1.4f, 0.f);
|
||||
sun->setShadowView(glm::vec3(80));
|
||||
|
||||
// adding tree
|
||||
SceneNode* tree = Loader::loadMesh("Tree01.obj");
|
||||
scene->getRootObject()->addChild(tree);
|
||||
}
|
||||
|
||||
scene->getRootObject()->addChild(sunLight);
|
||||
|
@ -13,6 +13,48 @@
|
||||
#include <imgui/imgui.h>
|
||||
|
||||
#define PHYSICS_SHAPES_OFFSET 0.0025f
|
||||
/*
|
||||
class GibScript : public SceneNode::Script
|
||||
{
|
||||
GibScript(const std::string &modelPath, btCollisionShape* shape, float mass) :
|
||||
m_shape(shape),
|
||||
m_mass(mass)
|
||||
{
|
||||
// preload model
|
||||
Loader::loadMesh(modelPath);
|
||||
}
|
||||
|
||||
void begin(SceneNode* node)
|
||||
{
|
||||
glm::vec3 pos(0, 10, 0);
|
||||
glm::vec3 dir(0, 1, 0);
|
||||
if(m_player != nullptr)
|
||||
{
|
||||
dir = m_player->getDirection();
|
||||
pos = m_player->getEyePosition() + dir*2.f;
|
||||
}
|
||||
float throwForce = 5.f;
|
||||
|
||||
for(Mesh * m : m_bottleMeshes)
|
||||
{
|
||||
SceneNode* meshNode = new SceneNode();
|
||||
meshNode->setMesh(m);
|
||||
node->addChild(meshNode);
|
||||
}
|
||||
createGib(node, m_bottleShape, m_bottleMass, pos, dir*throwForce, 30000);
|
||||
}
|
||||
|
||||
void update(SceneNode* node)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<Mesh*> m_meshes;
|
||||
btCollisionShape* m_shape;
|
||||
float m_mass;
|
||||
int m_action;
|
||||
};
|
||||
|
||||
Potator::Potator(PlayerCharacterNode * player,
|
||||
int shield_action,
|
||||
@ -23,13 +65,7 @@ Potator::Potator(PlayerCharacterNode * player,
|
||||
m_throwBottleAction(bottle_action),
|
||||
m_throwObjectAction(object_action)
|
||||
{
|
||||
// creating shield
|
||||
m_shieldMeshes = Loader::loadMesh("shield.obj");
|
||||
for(Mesh* m : m_shieldMeshes)
|
||||
m->initGL();
|
||||
|
||||
btCompoundShape* shieldShape = new btCompoundShape();
|
||||
|
||||
btTransform woodTransform = btTransform::getIdentity();
|
||||
woodTransform.setRotation(btQuaternion(0, 3.1416f, 0));
|
||||
shieldShape->addChildShape(woodTransform, new btCylinderShapeZ(btVector3(0.57f + PHYSICS_SHAPES_OFFSET, 0.57f + PHYSICS_SHAPES_OFFSET, 0.03f + PHYSICS_SHAPES_OFFSET)));
|
||||
@ -37,15 +73,9 @@ Potator::Potator(PlayerCharacterNode * player,
|
||||
guardTransform.setOrigin(btVector3(0.f, 0.f, -0.035f));
|
||||
shieldShape->addChildShape(guardTransform, new btSphereShape(0.08 + PHYSICS_SHAPES_OFFSET));
|
||||
|
||||
m_shieldShape = shieldShape;
|
||||
|
||||
m_shieldMass = 0.5f;
|
||||
m_shieldScript = new GibScript("shield.obj", shieldShape, 0.5f);
|
||||
|
||||
// creating bottle
|
||||
m_bottleMeshes = Loader::loadMesh("bottle.obj");
|
||||
for(Mesh* m : m_bottleMeshes)
|
||||
m->initGL();
|
||||
|
||||
btCompoundShape* bottleShape = new btCompoundShape();
|
||||
btTransform ballTransform = btTransform::getIdentity();
|
||||
ballTransform.setOrigin(btVector3(0.f, 0.098f, 0.f));
|
||||
@ -56,15 +86,10 @@ Potator::Potator(PlayerCharacterNode * player,
|
||||
btTransform neckTransform = btTransform::getIdentity();
|
||||
neckTransform.setOrigin(btVector3(0.f, 0.26f, 0.f));
|
||||
bottleShape->addChildShape(neckTransform, new btCylinderShape(btVector3(0.03f + PHYSICS_SHAPES_OFFSET, 0.08f + PHYSICS_SHAPES_OFFSET, 0.03f + PHYSICS_SHAPES_OFFSET)));
|
||||
m_bottleShape = bottleShape;
|
||||
|
||||
m_bottleMass = 0.03f;
|
||||
m_bottleScript = new GibScript("bottle.obj", bottleShape, 0.5f);
|
||||
|
||||
// creating sword :
|
||||
m_swordMeshes = Loader::loadMesh("sword.obj");
|
||||
for(Mesh* m : m_swordMeshes)
|
||||
m->initGL();
|
||||
|
||||
btCompoundShape* swordShape = new btCompoundShape();
|
||||
|
||||
btVector3 guardBox = btVector3(0.03 + PHYSICS_SHAPES_OFFSET, 0.04 + PHYSICS_SHAPES_OFFSET, 0.25 + PHYSICS_SHAPES_OFFSET);
|
||||
@ -74,8 +99,7 @@ Potator::Potator(PlayerCharacterNode * player,
|
||||
bladeTransform.setOrigin(btVector3(0.f, 0.486705f, 0.f));
|
||||
swordShape->addChildShape(bladeTransform, new btConeShape(0.07 + PHYSICS_SHAPES_OFFSET, 2.15 + PHYSICS_SHAPES_OFFSET));
|
||||
|
||||
m_swordShape = swordShape;
|
||||
m_swordMass = 0.5f;
|
||||
m_swordScript = new GibScript("sword.obj", swordShape, 0.03f);
|
||||
}
|
||||
|
||||
void Potator::throwShield()
|
||||
@ -158,7 +182,7 @@ void Potator::update()
|
||||
throwSword();
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
ImGui::Begin("Potator");
|
||||
if(ImGui::Button("Load pack"))
|
||||
LoadingThread::get()->loadResourcePack("woodbox");
|
||||
@ -172,5 +196,5 @@ void Potator::update()
|
||||
m_scene->registerMeshType(m_cubeMesh->getFlags());
|
||||
}
|
||||
ImGui::End();
|
||||
*/
|
||||
}
|
||||
*/
|
||||
|
@ -6,25 +6,15 @@
|
||||
|
||||
class PlayerCharacterNode;
|
||||
class Mesh;
|
||||
|
||||
class GibScript;
|
||||
/*
|
||||
class Potator : public GibGeneratorNode
|
||||
{
|
||||
PlayerCharacterNode *m_player;
|
||||
int m_throwShieldAction;
|
||||
int m_throwBottleAction;
|
||||
int m_throwObjectAction;
|
||||
|
||||
std::vector<Mesh*> m_shieldMeshes;
|
||||
btCollisionShape* m_shieldShape;
|
||||
float m_shieldMass;
|
||||
|
||||
std::vector<Mesh*> m_bottleMeshes;
|
||||
btCollisionShape* m_bottleShape;
|
||||
float m_bottleMass;
|
||||
|
||||
std::vector<Mesh*> m_swordMeshes;
|
||||
btCollisionShape* m_swordShape;
|
||||
float m_swordMass;
|
||||
GibScript* m_shieldScript;
|
||||
GibScript* m_bottleScript;
|
||||
GibScript* m_swordScript;
|
||||
|
||||
void throwShield();
|
||||
void throwBottle();
|
||||
@ -38,11 +28,7 @@ public:
|
||||
|
||||
void setPlayer(PlayerCharacterNode *player) { m_player = player; }
|
||||
|
||||
void setShieldThrowingAction(int action) { m_throwShieldAction = action; }
|
||||
void setSphereThrowingAction(int action) { m_throwBottleAction = action; }
|
||||
void setObjectThrowingAction(int action) { m_throwObjectAction = action; }
|
||||
|
||||
virtual void update();
|
||||
};
|
||||
};*/
|
||||
|
||||
#endif // POTATOR_H
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "SparrowRenderer/texture.h"
|
||||
#include "utils.h"
|
||||
#include "font.h"
|
||||
#include "scene/scenenode.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@ -143,7 +144,11 @@ Font* Loader::loadFont(const std::string &description_file, const std::string &t
|
||||
return font;
|
||||
}
|
||||
|
||||
std::vector<Mesh*> Loader::loadMesh(const std::string &filename){
|
||||
SceneNode* Loader::loadMesh(const std::string &filename){
|
||||
MeshNode* node = RESOURCE_GET(MeshNode, filename);
|
||||
if(node != nullptr)
|
||||
return node->clone();
|
||||
|
||||
std::vector<Mesh*> meshes;
|
||||
|
||||
std::vector<glm::vec3> pos;
|
||||
@ -165,7 +170,7 @@ std::vector<Mesh*> Loader::loadMesh(const std::string &filename){
|
||||
if(!file.is_open())
|
||||
{
|
||||
fprintf(stderr, "can't load %s.\n", filename.c_str());
|
||||
return meshes;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Mesh* currentMesh = new Mesh();
|
||||
@ -175,7 +180,7 @@ std::vector<Mesh*> Loader::loadMesh(const std::string &filename){
|
||||
std::getline(file, line);
|
||||
while(!file.eof())
|
||||
{
|
||||
if(line.length() == 0) // line vide
|
||||
if(line.length() == 0) // empty line
|
||||
{
|
||||
std::getline(file, line);
|
||||
continue;
|
||||
@ -264,6 +269,8 @@ std::vector<Mesh*> Loader::loadMesh(const std::string &filename){
|
||||
currentMat = new PBRMaterial();
|
||||
RESOURCE_ADD(currentMat, Material, material_name);
|
||||
}
|
||||
currentMesh = new Mesh();
|
||||
meshes.push_back(currentMesh);
|
||||
currentMesh->setMaterial(currentMat);
|
||||
currentMesh->setName(material_name);
|
||||
}
|
||||
@ -292,9 +299,27 @@ std::vector<Mesh*> Loader::loadMesh(const std::string &filename){
|
||||
if(m->getFlags() & (1 << Mesh::MATERIAL_PBR_NORMAL_MAP))
|
||||
m->computeTangents();
|
||||
m->mergeVertices();
|
||||
m->initGL();
|
||||
}
|
||||
}
|
||||
return meshes;
|
||||
|
||||
node = new SceneNode();
|
||||
RESOURCE_ADD(node, MeshNode, filename);
|
||||
if(meshes.size() == 1)
|
||||
{
|
||||
node->setMesh(meshes.back());
|
||||
}
|
||||
else
|
||||
{
|
||||
for(Mesh* m : meshes)
|
||||
{
|
||||
SceneNode* childNode = new SceneNode();
|
||||
childNode->setMesh(m);
|
||||
node->addChild(childNode);
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
void initMaterialTexture(PBRMaterial* mat, PBRMaterial::TextureSlots slot, const std::string & file, int bitsPerPixel = 24)
|
||||
|
@ -9,6 +9,9 @@
|
||||
class Image;
|
||||
class Mesh;
|
||||
class Font;
|
||||
class SceneNode;
|
||||
|
||||
typedef SceneNode MeshNode;
|
||||
|
||||
class Loader
|
||||
{
|
||||
@ -20,7 +23,7 @@ public:
|
||||
static std::string* loadTextFile(const std::string &filename);
|
||||
static std::unordered_map<std::string, std::string>* loadConfigFile(const std::string &filename);
|
||||
static Image* loadImage(const std::string &filename, int depth = 24, bool reversed = true);
|
||||
static std::vector<Mesh*> loadMesh(const std::string &filename);
|
||||
static SceneNode* loadMesh(const std::string &filename);
|
||||
static Font* loadFont(const std::string &texture, const std::string &description);
|
||||
static bool loadMTL(const std::string &filename);
|
||||
|
||||
|
@ -19,6 +19,10 @@ void initStandardScene();
|
||||
//void scale2D(MeshNode*, glm::vec2);
|
||||
//void rotate2D(MeshNode* mnode, glm::vec2 center, float angle);
|
||||
//void setDepth2D(MeshNode* mnode, float depth);
|
||||
|
||||
/**
|
||||
* @warning collisions on static meshes does not work if the transform is modified after the rigidbody construction
|
||||
*/
|
||||
btRigidBody* buildStaticCollider(GeometryNode* node);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user