metaforce/DataSpec/DNAMP2/CMDLMaterials.hpp

80 lines
2.8 KiB
C++
Raw Normal View History

2015-07-25 22:59:39 +00:00
#ifndef _DNAMP2_CMDL_MATERIALS_HPP_
#define _DNAMP2_CMDL_MATERIALS_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/GX.hpp"
#include "../DNAMP1/CMDLMaterials.hpp"
#include "DNAMP2.hpp"
2015-07-25 22:59:39 +00:00
2017-12-29 08:08:12 +00:00
namespace DataSpec::DNAMP2
2015-07-25 22:59:39 +00:00
{
/* Structurally identical to DNAMP1::MaterialSet except unk0 and unk1 fields */
struct MaterialSet : BigDNA
{
2015-09-19 01:38:40 +00:00
static constexpr bool OneSection() {return false;}
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
2015-07-25 22:59:39 +00:00
DNAMP1::MaterialSet::MaterialSetHead head;
struct Material : BigDNA
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
2015-09-07 04:05:44 +00:00
using Flags = DNAMP1::MaterialSet::Material::Flags;
Flags flags;
const Flags& getFlags() const {return flags;}
2015-07-25 22:59:39 +00:00
Value<atUint32> textureCount;
2015-10-21 01:34:35 +00:00
Vector<atUint32, DNA_COUNT(textureCount)> textureIdxs;
using VAFlags = DNAMP1::MaterialSet::Material::VAFlags;
2015-07-25 22:59:39 +00:00
DNAMP1::MaterialSet::Material::VAFlags vaFlags;
2015-09-07 04:05:44 +00:00
const VAFlags& getVAFlags() const {return vaFlags;}
2015-07-25 22:59:39 +00:00
Value<atUint32> unk0; /* MP2 only */
Value<atUint32> unk1; /* MP2 only */
Value<atUint32> groupIdx;
Vector<atUint32, DNA_COUNT(flags.konstValuesEnabled())> konstCount;
Vector<GX::Color, DNA_COUNT(flags.konstValuesEnabled() ? konstCount[0] : 0)> konstColors;
2015-07-25 22:59:39 +00:00
2015-11-21 01:16:07 +00:00
using BlendFactor = GX::BlendFactor;
2015-08-21 00:06:39 +00:00
Value<BlendFactor> blendDstFac;
Value<BlendFactor> blendSrcFac;
2015-07-25 22:59:39 +00:00
Vector<atUint32, DNA_COUNT(flags.samusReflectionIndirectTexture())> indTexSlot;
Value<atUint32> colorChannelCount;
Vector<DNAMP1::MaterialSet::Material::ColorChannel, DNA_COUNT(colorChannelCount)> colorChannels;
Value<atUint32> tevStageCount;
Vector<DNAMP1::MaterialSet::Material::TEVStage, DNA_COUNT(tevStageCount)> tevStages;
Vector<DNAMP1::MaterialSet::Material::TEVStageTexInfo, DNA_COUNT(tevStageCount)> tevStageTexInfo;
Value<atUint32> tcgCount;
Vector<DNAMP1::MaterialSet::Material::TexCoordGen, DNA_COUNT(tcgCount)> tcgs;
2015-07-25 22:59:39 +00:00
Value<atUint32> uvAnimsSize;
Value<atUint32> uvAnimsCount;
Vector<DNAMP1::MaterialSet::Material::UVAnimation, DNA_COUNT(uvAnimsCount)> uvAnims;
};
Vector<Material, DNA_COUNT(head.materialCount)> materials;
2017-12-29 08:08:12 +00:00
static void RegisterMaterialProps(hecl::blender::PyOutStream& out)
{
DNAMP1::MaterialSet::RegisterMaterialProps(out);
}
2017-12-29 08:08:12 +00:00
static void ConstructMaterial(hecl::blender::PyOutStream& out,
const MaterialSet::Material& material,
unsigned groupIdx, unsigned matIdx);
2017-12-29 08:08:12 +00:00
void readToBlender(hecl::blender::PyOutStream& os,
2015-09-07 04:05:44 +00:00
const PAKRouter<PAKBridge>& pakRouter,
const PAKRouter<PAKBridge>::EntryType& entry,
2015-09-19 01:38:40 +00:00
unsigned setIdx)
{
2015-09-19 01:38:40 +00:00
DNACMDL::ReadMaterialSetToBlender_1_2(os, *this, pakRouter, entry, setIdx);
}
2015-07-25 22:59:39 +00:00
};
}
#endif // _DNAMP2_CMDL_MATERIALS_HPP_