mirror of https://github.com/AxioDL/metaforce.git
Minor re-organization of DeafBabe header
This commit is contained in:
parent
794dd26014
commit
5129f0a0c7
|
@ -10,6 +10,7 @@ add_library(DNACommon
|
||||||
TXTR.hpp TXTR.cpp
|
TXTR.hpp TXTR.cpp
|
||||||
ANCS.hpp
|
ANCS.hpp
|
||||||
ANIM.hpp ANIM.cpp
|
ANIM.hpp ANIM.cpp
|
||||||
|
DeafBabe.hpp
|
||||||
BabeDead.hpp
|
BabeDead.hpp
|
||||||
Tweaks/ITweakPlayer.hpp
|
Tweaks/ITweakPlayer.hpp
|
||||||
Tweaks/ITweakPlayerControl.hpp)
|
Tweaks/ITweakPlayerControl.hpp)
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
#ifndef _DNACOMMON_DEAFBABE_HPP_
|
||||||
|
#define _DNACOMMON_DEAFBABE_HPP_
|
||||||
|
|
||||||
|
#include "DNACommon.hpp"
|
||||||
|
#include "BlenderConnection.hpp"
|
||||||
|
|
||||||
|
namespace Retro
|
||||||
|
{
|
||||||
|
|
||||||
|
template<class DEAFBABE>
|
||||||
|
void DeafBabeSendToBlender(HECL::BlenderConnection::PyOutStream& os, const DEAFBABE& db)
|
||||||
|
{
|
||||||
|
os << "material_index = []\n"
|
||||||
|
"col_bm = bmesh.new()\n";
|
||||||
|
for (const atVec3f& vert : db.verts)
|
||||||
|
os.format("col_bm.verts.new((%f,%f,%f))\n",
|
||||||
|
vert.vec[0],
|
||||||
|
vert.vec[1],
|
||||||
|
vert.vec[2]);
|
||||||
|
|
||||||
|
os << "col_bm.verts.ensure_lookup_table()\n";
|
||||||
|
|
||||||
|
int triIdx = 0;
|
||||||
|
for (const typename DEAFBABE::Triangle& tri : db.triangleEdgeConnections)
|
||||||
|
{
|
||||||
|
const typename DEAFBABE::Material& triMat = db.materials[db.triMats[triIdx++]];
|
||||||
|
const typename DEAFBABE::Edge& edge0 = db.edgeVertConnections[tri.edges[0]];
|
||||||
|
const typename DEAFBABE::Edge& edge1 = db.edgeVertConnections[tri.edges[1]];
|
||||||
|
const typename DEAFBABE::Edge& edge2 = db.edgeVertConnections[tri.edges[2]];
|
||||||
|
if (!edge0.verts[0] && !edge1.verts[0] && !edge2.verts[0])
|
||||||
|
break;
|
||||||
|
os << "tri_verts = []\n";
|
||||||
|
os.format("tri_verts.append(col_bm.verts[%u])\n", edge0.findCommon(edge1));
|
||||||
|
os.format("tri_verts.append(col_bm.verts[%u])\n", edge1.findCommon(edge2));
|
||||||
|
os.format("tri_verts.append(col_bm.verts[%u])\n", edge2.findCommon(edge0));
|
||||||
|
|
||||||
|
os.format("face = col_bm.faces.get(tri_verts)\n"
|
||||||
|
"if face is None:\n"
|
||||||
|
" face = col_bm.faces.new(tri_verts)\n"
|
||||||
|
"else:\n"
|
||||||
|
" face = face.copy()\n"
|
||||||
|
" for i in range(3):\n"
|
||||||
|
" face.verts[i].co = tri_verts[i].co\n"
|
||||||
|
" col_bm.verts.ensure_lookup_table()\n"
|
||||||
|
"face.material_index = select_material(0x%08X)\n"
|
||||||
|
"face.smooth = False\n"
|
||||||
|
"\n",
|
||||||
|
atUint32(triMat.material));
|
||||||
|
}
|
||||||
|
|
||||||
|
db.insertNoClimb(os);
|
||||||
|
|
||||||
|
os << "col_mesh = bpy.data.meshes.new('CMESH')\n"
|
||||||
|
"col_bm.to_mesh(col_mesh)\n"
|
||||||
|
"col_mesh_obj = bpy.data.objects.new(col_mesh.name, col_mesh)\n"
|
||||||
|
"\n"
|
||||||
|
"for mat_name in material_index:\n"
|
||||||
|
" mat = material_dict[mat_name]\n"
|
||||||
|
" col_mesh.materials.append(mat)\n"
|
||||||
|
"\n"
|
||||||
|
"bpy.context.scene.objects.link(col_mesh_obj)\n"
|
||||||
|
"col_mesh_obj.layers[1] = True\n"
|
||||||
|
"col_mesh_obj.layers[0] = False\n"
|
||||||
|
"col_mesh_obj.draw_type = 'SOLID'\n"
|
||||||
|
"col_mesh_obj.game.physics_type = 'STATIC'\n"
|
||||||
|
"\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // _DNACOMMON_DEAFBABE_HPP_
|
|
@ -1,73 +1,13 @@
|
||||||
#ifndef _DNAMP1_DEAFBABE_HPP_
|
#ifndef _DNAMP1_DEAFBABE_HPP_
|
||||||
#define _DNAMP1_DEAFBABE_HPP_
|
#define _DNAMP1_DEAFBABE_HPP_
|
||||||
|
|
||||||
#include "../DNACommon/DNACommon.hpp"
|
#include "../DNACommon/DeafBabe.hpp"
|
||||||
#include "BlenderConnection.hpp"
|
|
||||||
|
|
||||||
namespace Retro
|
namespace Retro
|
||||||
{
|
{
|
||||||
namespace DNAMP1
|
namespace DNAMP1
|
||||||
{
|
{
|
||||||
|
|
||||||
template<class DEAFBABE>
|
|
||||||
void DeafBabeSendToBlender(HECL::BlenderConnection::PyOutStream& os, const DEAFBABE& db)
|
|
||||||
{
|
|
||||||
os << "material_index = []\n"
|
|
||||||
"col_bm = bmesh.new()\n";
|
|
||||||
for (const atVec3f& vert : db.verts)
|
|
||||||
os.format("col_bm.verts.new((%f,%f,%f))\n",
|
|
||||||
vert.vec[0],
|
|
||||||
vert.vec[1],
|
|
||||||
vert.vec[2]);
|
|
||||||
|
|
||||||
os << "col_bm.verts.ensure_lookup_table()\n";
|
|
||||||
|
|
||||||
int triIdx = 0;
|
|
||||||
for (const typename DEAFBABE::Triangle& tri : db.triangleEdgeConnections)
|
|
||||||
{
|
|
||||||
const typename DEAFBABE::Material& triMat = db.materials[db.triMats[triIdx++]];
|
|
||||||
const typename DEAFBABE::Edge& edge0 = db.edgeVertConnections[tri.edges[0]];
|
|
||||||
const typename DEAFBABE::Edge& edge1 = db.edgeVertConnections[tri.edges[1]];
|
|
||||||
const typename DEAFBABE::Edge& edge2 = db.edgeVertConnections[tri.edges[2]];
|
|
||||||
if (!edge0.verts[0] && !edge1.verts[0] && !edge2.verts[0])
|
|
||||||
break;
|
|
||||||
os << "tri_verts = []\n";
|
|
||||||
os.format("tri_verts.append(col_bm.verts[%u])\n", edge0.findCommon(edge1));
|
|
||||||
os.format("tri_verts.append(col_bm.verts[%u])\n", edge1.findCommon(edge2));
|
|
||||||
os.format("tri_verts.append(col_bm.verts[%u])\n", edge2.findCommon(edge0));
|
|
||||||
|
|
||||||
os.format("face = col_bm.faces.get(tri_verts)\n"
|
|
||||||
"if face is None:\n"
|
|
||||||
" face = col_bm.faces.new(tri_verts)\n"
|
|
||||||
"else:\n"
|
|
||||||
" face = face.copy()\n"
|
|
||||||
" for i in range(3):\n"
|
|
||||||
" face.verts[i].co = tri_verts[i].co\n"
|
|
||||||
" col_bm.verts.ensure_lookup_table()\n"
|
|
||||||
"face.material_index = select_material(0x%08X)\n"
|
|
||||||
"face.smooth = False\n"
|
|
||||||
"\n",
|
|
||||||
atUint32(triMat.material));
|
|
||||||
}
|
|
||||||
|
|
||||||
db.insertNoClimb(os);
|
|
||||||
|
|
||||||
os << "col_mesh = bpy.data.meshes.new('CMESH')\n"
|
|
||||||
"col_bm.to_mesh(col_mesh)\n"
|
|
||||||
"col_mesh_obj = bpy.data.objects.new(col_mesh.name, col_mesh)\n"
|
|
||||||
"\n"
|
|
||||||
"for mat_name in material_index:\n"
|
|
||||||
" mat = material_dict[mat_name]\n"
|
|
||||||
" col_mesh.materials.append(mat)\n"
|
|
||||||
"\n"
|
|
||||||
"bpy.context.scene.objects.link(col_mesh_obj)\n"
|
|
||||||
"col_mesh_obj.layers[1] = True\n"
|
|
||||||
"col_mesh_obj.layers[0] = False\n"
|
|
||||||
"col_mesh_obj.draw_type = 'SOLID'\n"
|
|
||||||
"col_mesh_obj.game.physics_type = 'STATIC'\n"
|
|
||||||
"\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
struct DeafBabe : BigDNA
|
struct DeafBabe : BigDNA
|
||||||
{
|
{
|
||||||
DECL_DNA
|
DECL_DNA
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#ifndef _DNAMP2_DEAFBABE_HPP_
|
#ifndef _DNAMP2_DEAFBABE_HPP_
|
||||||
#define _DNAMP2_DEAFBABE_HPP_
|
#define _DNAMP2_DEAFBABE_HPP_
|
||||||
|
|
||||||
#include "../DNACommon/DNACommon.hpp"
|
|
||||||
#include "BlenderConnection.hpp"
|
|
||||||
#include "../DNAMP1/DeafBabe.hpp"
|
#include "../DNAMP1/DeafBabe.hpp"
|
||||||
|
|
||||||
namespace Retro
|
namespace Retro
|
||||||
|
@ -86,7 +84,7 @@ struct DeafBabe : BigDNA
|
||||||
}
|
}
|
||||||
void sendToBlender(HECL::BlenderConnection::PyOutStream& os) const
|
void sendToBlender(HECL::BlenderConnection::PyOutStream& os) const
|
||||||
{
|
{
|
||||||
DNAMP1::DeafBabeSendToBlender(os, *this);
|
DeafBabeSendToBlender(os, *this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue