/** * Copyright (c) 2021 Dominic Msters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #pragma once #include /** * Compiles a shader from vertex and fragment shader code. * @param shader Shader to compile into. * @param vertexShaderSource The raw vertex shader code. * @param fragmentShaderSource The raw fragment shader code. */ void shaderInit(shader_t *shader, char *vertexShaderSource, char* fragmentShaderSource ); /** * Cleanup and unload a previously loaded shader. * @param shader The shader to unload */ void shaderDispose(shader_t *shader); /** * Attaches the supplied shader as the current shader. * @param shader The shader to attach */ void shaderUse(shader_t *shader); /** * Attaches a camera to the shader. * @param shader Shader to attach to. * @param camera Camera to attach. */ void shaderUseCamera(shader_t *shader, camera_t *camera); /** * Attaches a texture to the shader. * @param shader Shader to attach to. * @param texture Texture to attach. */ void shaderUseTexture(shader_t *shader, texture_t *texture); /** * Set's the current translation matrix onto the shader for the next * render to use. Rotation order is set to YZX. * @param shader Shader to attach to. * @param x X coordinate (world space). * @param y Y coordinate (world space). * @param z Z coordinate (world space). * @param pitch Pitch of the object (local space). * @param yaw Yaw of the object (local space). * @param roll Roll of the object (local space). */ void shaderUsePosition(shader_t *shader, float x, float y, float z, float pitch, float yaw, float roll ); /** * Set's the current translation matrix onto the shader for the next * render to use. Also provides scaling controls. * * @param shader Shader to attach to. * @param x X coordinate (world space). * @param y Y coordinate (world space). * @param z Z coordinate (world space). * @param pitch Pitch of the object (local space). * @param yaw Yaw of the object (local space). * @param roll Roll of the object (local space). * @param scaleX X scale of model (1 being 100% scaled). * @param scaleY Y scale of model (1 being 100% scaled). * @param scaleZ Z scale of model (1 being 100% scaled). */ void shaderUsePositionAndScale(shader_t *shader, float x, float y, float z, float pitch, float yaw, float roll, float scaleX, float scaleY, float scaleZ );