2017-10-21 21:00:33 +00:00
|
|
|
#include "graphics/texture.h"
|
2018-12-11 05:30:55 +00:00
|
|
|
#include "graphics/shader.h"
|
2018-02-11 21:03:52 +00:00
|
|
|
#include "util.h"
|
2017-10-31 08:14:09 +00:00
|
|
|
#include <stdbool.h>
|
2017-10-21 21:00:33 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-02-12 03:16:40 +00:00
|
|
|
typedef enum {
|
|
|
|
SCALAR_METALNESS,
|
|
|
|
SCALAR_ROUGHNESS,
|
|
|
|
MAX_MATERIAL_SCALARS
|
|
|
|
} MaterialScalar;
|
|
|
|
|
2018-01-30 05:44:32 +00:00
|
|
|
typedef enum {
|
|
|
|
COLOR_DIFFUSE,
|
2018-02-12 03:16:40 +00:00
|
|
|
COLOR_EMISSIVE,
|
2018-01-30 05:44:32 +00:00
|
|
|
MAX_MATERIAL_COLORS
|
|
|
|
} MaterialColor;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
TEXTURE_DIFFUSE,
|
2018-02-12 03:16:40 +00:00
|
|
|
TEXTURE_EMISSIVE,
|
|
|
|
TEXTURE_METALNESS,
|
|
|
|
TEXTURE_ROUGHNESS,
|
|
|
|
TEXTURE_OCCLUSION,
|
|
|
|
TEXTURE_NORMAL,
|
2018-01-30 05:44:32 +00:00
|
|
|
TEXTURE_ENVIRONMENT_MAP,
|
|
|
|
MAX_MATERIAL_TEXTURES
|
|
|
|
} MaterialTexture;
|
|
|
|
|
2017-10-21 21:00:33 +00:00
|
|
|
typedef struct {
|
|
|
|
Ref ref;
|
2018-02-12 03:16:40 +00:00
|
|
|
float scalars[MAX_MATERIAL_SCALARS];
|
2018-01-30 05:44:32 +00:00
|
|
|
Color colors[MAX_MATERIAL_COLORS];
|
2017-10-21 21:00:33 +00:00
|
|
|
Texture* textures[MAX_MATERIAL_TEXTURES];
|
2018-07-18 08:17:16 +00:00
|
|
|
float transform[9];
|
2018-12-11 21:27:59 +00:00
|
|
|
bool dirty;
|
2017-10-21 21:00:33 +00:00
|
|
|
} Material;
|
|
|
|
|
2018-07-18 07:34:21 +00:00
|
|
|
Material* lovrMaterialCreate();
|
2018-02-26 08:59:03 +00:00
|
|
|
void lovrMaterialDestroy(void* ref);
|
2018-12-11 05:30:55 +00:00
|
|
|
void lovrMaterialBind(Material* material, Shader* shader);
|
2018-12-11 21:27:59 +00:00
|
|
|
bool lovrMaterialIsDirty(Material* material);
|
2018-02-12 03:16:40 +00:00
|
|
|
float lovrMaterialGetScalar(Material* material, MaterialScalar scalarType);
|
|
|
|
void lovrMaterialSetScalar(Material* material, MaterialScalar scalarType, float value);
|
2017-10-21 21:00:33 +00:00
|
|
|
Color lovrMaterialGetColor(Material* material, MaterialColor colorType);
|
|
|
|
void lovrMaterialSetColor(Material* material, MaterialColor colorType, Color color);
|
|
|
|
Texture* lovrMaterialGetTexture(Material* material, MaterialTexture textureType);
|
|
|
|
void lovrMaterialSetTexture(Material* material, MaterialTexture textureType, Texture* texture);
|
2018-07-18 08:17:16 +00:00
|
|
|
void lovrMaterialGetTransform(Material* material, float* ox, float* oy, float* sx, float* sy, float* angle);
|
|
|
|
void lovrMaterialSetTransform(Material* material, float ox, float oy, float sx, float sy, float angle);
|