/* Silkworm - Verlet cloth physics in C * * Copyright (c) 2021 Evan Hemsley * * This software is provided 'as-is', without any express or implied warranty. * In no event will the authors be held liable for any damages arising from * the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software in a * product, an acknowledgment in the product documentation would be * appreciated but is not required. * * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * * 3. This notice may not be removed or altered from any source distribution. * * Evan "cosmonaut" Hemsley * */ #ifndef SILKWORM_H #define SILKWORM_H #include #include #include #ifdef _WIN32 #define SILKWORMAPI __declspec(dllexport) #define SILKWORMCALL __cdecl #else #define SILKWORMAPI #define SILKWORMCALL #endif #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* Version API */ #define SILKWORM_ABI_VERSION 0 #define SILKWORM_MAJOR_VERSION 0 #define SILKWORM_MINOR_VERSION 1 #define SILKWORM_PATCH_VERSION 0 #define SILKWORM_COMPILED_VERSION ( \ (SILKWORM_ABI_VERSION * 100 * 100 * 100) + \ (SILKWORM_MAJOR_VERSION * 100 * 100) + \ (SILKWORM_MINOR_VERSION * 100) + \ (SILKWORM_PATCH_VERSION) \ ) SILKWORMAPI void Silkworm_Init(); SILKWORMAPI void Silkworm_Update(double delta); SILKWORMAPI void Silkworm_ApplyWind(double xSpeed, double ySpeed); SILKWORMAPI double Silkworm_CreateNode(double xPosition, double yPosition, double mass, double friction, double radius, double pushFactor); SILKWORMAPI void Silkworm_NodeSetDestroyable(double nodeId); SILKWORMAPI double Silkworm_CreateLink(double aId, double bId, double distance, double tearThreshold); SILKWORMAPI double Silkworm_CreateCloth(double xPosition, double yPosition, double horizontalNodeCount, double verticalNodeCount, double mass, double friction, double windFactor, double tearThreshold); SILKWORMAPI void Silkworm_ClothNodePin(double clothId, double i, double j); SILKWORMAPI void Silkworm_ClothNodeUnpin(double clothId, double i, double j); SILKWORMAPI void Silkworm_ClothNodeDestroy(double clothId, double i, double j); SILKWORMAPI void Silkworm_DestroyCloth(double clothId); SILKWORMAPI void Silkworm_SetTriangleBuffer(const char* bufferId); SILKWORMAPI double Silkworm_ClothFillTriangleBuffer(double clothId, double leftUV, double widthUV, double topUV, double heightUV); SILKWORMAPI void Silkworm_DestroyNode(double nodeId); SILKWORMAPI void Silkworm_DestroyNodesInRadius(double x, double y, double radius); SILKWORMAPI void Silkworm_ClearAll(); #endif /* SILKWORM_H */