Vulkan2D
2D renderer written in C using Vulkan and SDL2
|
Information needed to use hardware-accelerated shadows. More...
Go to the source code of this file.
Functions | |
VK2DShadowEnvironment | vk2DShadowEnvironmentCreate () |
Creates a new shadow environment. More... | |
void | vk2DShadowEnvironmentFree (VK2DShadowEnvironment shadowEnvironment) |
Frees a shadow environment. More... | |
VK2DShadowObject | vk2dShadowEnvironmentAddObject (VK2DShadowEnvironment shadowEnvironment) |
Adds a new object to a shadow environment. More... | |
void | vk2dShadowEnvironmentObjectSetPos (VK2DShadowEnvironment shadowEnvironment, VK2DShadowObject object, float x, float y) |
Translates a shadow object. More... | |
void | vk2dShadowEnvironmentObjectUpdate (VK2DShadowEnvironment shadowEnvironment, VK2DShadowObject object, float x, float y, float scaleX, float scaleY, float rotation, float originX, float originY) |
Updates a shadow object. More... | |
void | vk2dShadowEnvironmentObjectSetStatus (VK2DShadowEnvironment shadowEnvironment, VK2DShadowObject object, bool enabled) |
Updates a shadow object's status. More... | |
bool | vk2dShadowEnvironmentObjectGetStatus (VK2DShadowEnvironment shadowEnvironment, VK2DShadowObject object) |
Returns a shadow object's status. More... | |
void | vk2DShadowEnvironmentAddEdge (VK2DShadowEnvironment shadowEnvironment, float x1, float y1, float x2, float y2) |
Adds an edge to a shadow environment's current object, use this on wall edges. More... | |
void | vk2dShadowEnvironmentResetEdges (VK2DShadowEnvironment shadowEnvironment) |
Removes all edges from the shadow environment's cache in case you want to change the edges. More... | |
void | vk2DShadowEnvironmentFlushVBO (VK2DShadowEnvironment shadowEnvironment) |
Flushes the edges present in the environment to a VBO that can be drawn to screen. More... | |
Information needed to use hardware-accelerated shadows.
void vk2DShadowEnvironmentAddEdge | ( | VK2DShadowEnvironment | shadowEnvironment, |
float | x1, | ||
float | y1, | ||
float | x2, | ||
float | y2 | ||
) |
Adds an edge to a shadow environment's current object, use this on wall edges.
shadowEnvironment | Shadow environment to add to |
x1 | X of the start of the edge |
y1 | Y of the start of the edge |
x2 | X of the end of the edge |
y2 | Y of the end of the edge |
You may call this from another thread so long as you do not call vk2DShadowEnvironmentFlushVBO at the same time (ie, set up all your edges in the other thread and once you know that thread is done adding edges call vk2DShadowEnvironmentFlushVBO).
VK2DShadowObject vk2dShadowEnvironmentAddObject | ( | VK2DShadowEnvironment | shadowEnvironment | ) |
Adds a new object to a shadow environment.
shadowEnvironment | Shadow environment |
VK2DShadowEnvironment vk2DShadowEnvironmentCreate | ( | ) |
Creates a new shadow environment.
void vk2DShadowEnvironmentFlushVBO | ( | VK2DShadowEnvironment | shadowEnvironment | ) |
Flushes the edges present in the environment to a VBO that can be drawn to screen.
shadowEnvironment | Shadow environment to flush |
void vk2DShadowEnvironmentFree | ( | VK2DShadowEnvironment | shadowEnvironment | ) |
Frees a shadow environment.
shadowEnvironment | Shadow environment to free |
bool vk2dShadowEnvironmentObjectGetStatus | ( | VK2DShadowEnvironment | shadowEnvironment, |
VK2DShadowObject | object | ||
) |
Returns a shadow object's status.
shadowEnvironment | Shadow environment |
object | Object to update |
void vk2dShadowEnvironmentObjectSetPos | ( | VK2DShadowEnvironment | shadowEnvironment, |
VK2DShadowObject | object, | ||
float | x, | ||
float | y | ||
) |
Translates a shadow object.
shadowEnvironment | Shadow environment |
object | Object to update |
x | X position of the object |
y | Y position of the object |
void vk2dShadowEnvironmentObjectSetStatus | ( | VK2DShadowEnvironment | shadowEnvironment, |
VK2DShadowObject | object, | ||
bool | enabled | ||
) |
Updates a shadow object's status.
shadowEnvironment | Shadow environment |
object | Object to update |
enabled | Whether or not this object will be visible |
void vk2dShadowEnvironmentObjectUpdate | ( | VK2DShadowEnvironment | shadowEnvironment, |
VK2DShadowObject | object, | ||
float | x, | ||
float | y, | ||
float | scaleX, | ||
float | scaleY, | ||
float | rotation, | ||
float | originX, | ||
float | originY | ||
) |
Updates a shadow object.
shadowEnvironment | Shadow environment |
object | Object to update |
x | X position of the object |
y | Y position of the object |
scaleX | X scale of the object |
scaleY | Y scale of the object |
rotation | Rotation of the object |
originX | X origin of the object |
originY | Y origin of the object |
void vk2dShadowEnvironmentResetEdges | ( | VK2DShadowEnvironment | shadowEnvironment | ) |
Removes all edges from the shadow environment's cache in case you want to change the edges.
shadowEnvironment | Shadow environment to reset |