summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Assets/TextureSamplerValue.h
blob: 9b21b6bf8d263406ff1d64452f9111b2f112beb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2024 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <string>

#include <picojson.h>

#include "VideoCommon/Assets/CustomAssetLibrary.h"

namespace VideoCommon
{
// A structure that provides metadata about a texture to a material
struct TextureSamplerValue
{
  CustomAssetLibrary::AssetID asset;

  // Where does the sampler originate from
  // If 'Asset' is used, the sampler is pulled
  // directly from the asset properties
  // If 'TextureHash' is chosen, the sampler is pulled
  // from the game with the corresponding texture hash
  enum class SamplerOrigin
  {
    Asset,
    TextureHash
  };
  static std::string ToString(SamplerOrigin sampler_origin);
  SamplerOrigin sampler_origin = SamplerOrigin::Asset;
  std::string texture_hash;

  static bool FromJson(const picojson::object& json, TextureSamplerValue* data);
  static void ToJson(picojson::object* obj, const TextureSamplerValue& data);
};
}  // namespace VideoCommon