40 lines
1.2 KiB
C
40 lines
1.2 KiB
C
/**
|
|
* Copyright (c) 2021 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "shader.h"
|
|
#include "../texture.h"
|
|
|
|
#define SHADER_COMMON_UNIFORM_PROJECTION "u_Proj"
|
|
#define SHADER_COMMON_UNIFORM_VIEW "u_View"
|
|
#define SHADER_COMMON_UNIFORM_MODEL "u_Modl"
|
|
#define SHADER_COMMON_UNIFORM_COLOR "u_Colr"
|
|
#define SHADER_COMMON_UNIFORM_TEXTURE "u_Text"
|
|
|
|
typedef struct {
|
|
shader_t shader;
|
|
shaderuniform_t uniformProjection;
|
|
shaderuniform_t uniformView;
|
|
shaderuniform_t uniformModel;
|
|
shaderuniform_t uniformColor;
|
|
shaderuniform_t uniformTexture;
|
|
} shadercommon_t;
|
|
|
|
void shaderCommonInit(shadercommon_t *shader, char *vert, char *frag);
|
|
void shaderCommonUseCamera(shadercommon_t *shader, camera_t *camera);
|
|
void shaderCommonUseTexture(shadercommon_t *shader, texture_t *texture);
|
|
void shaderCommonUseColor(shadercommon_t *shader, pixel_t color);
|
|
void shaderCommonUsePosition(shadercommon_t *shader,
|
|
float x, float y, float z,
|
|
float pitch, float yaw, float roll
|
|
);
|
|
void shaderCommonUsePositionAndScale(
|
|
shadercommon_t *shader,
|
|
float x, float y, float z,
|
|
float pitch, float yaw, float roll,
|
|
float scaleX, float scaleY, float scaleZ
|
|
); |