metaforce/DataSpec/DNAMP2/CMDLMaterials.hpp

83 lines
2.9 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2015-07-25 22:59:39 +00:00
2018-06-29 20:21:36 +00:00
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/GX.hpp"
2015-07-25 22:59:39 +00:00
#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;
2018-02-25 08:23:27 +00:00
Vector<atUint32, AT_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 */
2018-04-02 04:27:24 +00:00
Value<atUint32> uniqueIdx;
2015-07-25 22:59:39 +00:00
2018-02-25 08:23:27 +00:00
Vector<atUint32, AT_DNA_COUNT(flags.konstValuesEnabled())> konstCount;
Vector<GX::Color, AT_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;
2018-02-25 08:23:27 +00:00
Vector<atUint32, AT_DNA_COUNT(flags.samusReflectionIndirectTexture())> indTexSlot;
2015-07-25 22:59:39 +00:00
Value<atUint32> colorChannelCount;
2018-02-25 08:23:27 +00:00
Vector<DNAMP1::MaterialSet::Material::ColorChannel, AT_DNA_COUNT(colorChannelCount)> colorChannels;
2015-07-25 22:59:39 +00:00
Value<atUint32> tevStageCount;
2018-02-25 08:23:27 +00:00
Vector<DNAMP1::MaterialSet::Material::TEVStage, AT_DNA_COUNT(tevStageCount)> tevStages;
Vector<DNAMP1::MaterialSet::Material::TEVStageTexInfo, AT_DNA_COUNT(tevStageCount)> tevStageTexInfo;
2015-07-25 22:59:39 +00:00
Value<atUint32> tcgCount;
2018-02-25 08:23:27 +00:00
Vector<DNAMP1::MaterialSet::Material::TexCoordGen, AT_DNA_COUNT(tcgCount)> tcgs;
2015-07-25 22:59:39 +00:00
Value<atUint32> uvAnimsSize;
Value<atUint32> uvAnimsCount;
2018-02-25 08:23:27 +00:00
Vector<DNAMP1::MaterialSet::Material::UVAnimation, AT_DNA_COUNT(uvAnimsCount)> uvAnims;
2015-07-25 22:59:39 +00:00
};
2018-02-25 08:23:27 +00:00
Vector<Material, AT_DNA_COUNT(head.materialCount)> materials;
2015-07-25 22:59:39 +00:00
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);
}
2018-11-02 08:16:16 +00:00
void ensureTexturesExtracted(PAKRouter<PAKBridge>& pakRouter) const
{
head.ensureTexturesExtracted(pakRouter);
}
2015-07-25 22:59:39 +00:00
};
}