mirror of
https://github.com/Relintai/sfw.git
synced 2024-11-08 07:52:09 +01:00
Doc setup pt1.
This commit is contained in:
parent
7388a81ebe
commit
06a841b2d0
@ -1,179 +1,424 @@
|
||||
<meta charset="utf-8">
|
||||
**Sample API Doc**
|
||||
1.1 Release
|
||||
<meta charset="utf-8">
|
||||
**SFW Docs**
|
||||
|
||||
what it is, notes
|
||||
|
||||
|
||||
This is the markdeep generic "Company API" template. Replace
|
||||
`company-logo-512.png` with your organization's logo and adjust the
|
||||
`company-api.css` styling to match the desired colors.
|
||||
Compile
|
||||
------------------------------------------------------------------
|
||||
|
||||
See `CA::OpenHandle()` for an example of an auto-generated API link.
|
||||
The rest of the information on this page is bogus placeholder to show the formatting.
|
||||
|
||||
License
|
||||
------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ENUMS
|
||||
CORE
|
||||
====================================================================================
|
||||
|
||||
Error
|
||||
----------------------------------------------------------------------------------------
|
||||
Enums
|
||||
------------------------------------------------------------------
|
||||
|
||||
<a name="ENUM_Error"></a>
|
||||
<details><summary>Error</summary>
|
||||
|
||||
|||ENUM_Error|||
|
||||
|
||||
KeyList
|
||||
----------------------------------------------------------------------------------------
|
||||
</details>
|
||||
|
||||
<a name="ENUM_KeyList"></a>
|
||||
<details><summary>KeyList</summary>
|
||||
|
||||
|||ENUM_KeyList|||
|
||||
|
||||
</details>
|
||||
|
||||
Errors and Logging
|
||||
------------------------------------------------------------------
|
||||
|
||||
<a name="LOGGING_MACROS"></a>
|
||||
<details><summary>Logging</summary>
|
||||
|
||||
Use the provided macros:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C
|
||||
#define PRINT_TRACE(str)
|
||||
#define LOG_TRACE(...)
|
||||
|
||||
#define PRINT_MSG(str)
|
||||
#define LOG_MSG(...)
|
||||
|
||||
#define PRINT_WARN(str)
|
||||
#define LOG_WARN(...)
|
||||
|
||||
#define PRINT_ERR(str)
|
||||
#define ERR_PRINT(str)
|
||||
#define LOG_ERR(...)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
</details>
|
||||
|
||||
<a name="ERROR_MACROS"></a>
|
||||
<details><summary>Error</summary>
|
||||
|
||||
Uses these macros:
|
||||
|
||||
Note that the library itself does not use exceptions, it uses these macros exclusively.
|
||||
|
||||
Also note that you are not prevented you from using exceptions if you want to in your own code.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C
|
||||
#define ERR_FAIL_MSG(msg)
|
||||
|
||||
#define ERR_FAIL_V(val)
|
||||
|
||||
#define ERR_FAIL_V_MSG(val, msg)
|
||||
|
||||
#define ERR_FAIL_INDEX(index, size)
|
||||
#define ERR_FAIL_INDEX_MSG(index, size, msg)
|
||||
|
||||
#define ERR_FAIL_INDEX_V(index, size, val)
|
||||
#define ERR_FAIL_INDEX_V_MSG(index, size, val, msg)
|
||||
|
||||
#define ERR_FAIL_COND(cond)
|
||||
#define ERR_FAIL_COND_MSG(cond, msg)
|
||||
|
||||
#define ERR_FAIL_COND_V(cond, val)
|
||||
#define ERR_FAIL_COND_V_MSG(cond, val, msg)
|
||||
|
||||
#define ERR_CONTINUE(cond)
|
||||
#define ERR_CONTINUE_MSG(cond, msg)
|
||||
|
||||
#define ERR_CONTINUE_ACTION(cond, action)
|
||||
#define ERR_CONTINUE_ACTION_MSG(cond, action, msg)
|
||||
|
||||
#define CRASH_INDEX(index, size)
|
||||
#define CRASH_BAD_INDEX(index, size)
|
||||
#define CRASH_BAD_UNSIGNED_INDEX(index, size)
|
||||
|
||||
#define CRASH_COND(cond)
|
||||
#define CRASH_COND_MSG(cond, msg)
|
||||
|
||||
#define CRASH_MSG(msg)
|
||||
#define CRASH_NOW(msg)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
</details>
|
||||
|
||||
<a name="ASSERTION_MACROS"></a>
|
||||
<details><summary>Asserts</summary>
|
||||
|
||||
Use the provided macros:
|
||||
|
||||
These should be 'free' checks for program flow and should not be needed in any releases, only used when the DEV_ENABLED define is set.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C
|
||||
#define DEV_CHECK(m_cond)
|
||||
#define DEV_CHECK_ONCE(m_cond)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
</details>
|
||||
|
||||
Math
|
||||
------------------------------------------------------------------
|
||||
|
||||
<a name="CLASS_Math"></a>
|
||||
<details><summary>Math</summary>
|
||||
|
||||
|||CLASS_Math|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_Vector2"></a>
|
||||
<details><summary>Vector2</summary>
|
||||
|
||||
|||STRUCT_Vector2|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_Vector2i"></a>
|
||||
<details><summary>Vector2i</summary>
|
||||
|
||||
|||STRUCT_Vector2i|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_Vector3"></a>
|
||||
<details><summary>Vector3</summary>
|
||||
|
||||
|||STRUCT_Vector3|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_Vector3i"></a>
|
||||
<details><summary>Vector3i</summary>
|
||||
|
||||
|||STRUCT_Vector3i|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_Vector4"></a>
|
||||
<details><summary>Vector4</summary>
|
||||
|
||||
|||STRUCT_Vector4|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_Vector4i"></a>
|
||||
<details><summary>Vector4i</summary>
|
||||
|
||||
|||STRUCT_Vector4i|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_Color"></a>
|
||||
<details><summary>Color</summary>
|
||||
|
||||
|||STRUCT_Color|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_Rect2"></a>
|
||||
<details><summary>Rect2</summary>
|
||||
|
||||
|||STRUCT_Rect2|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_Rect2i"></a>
|
||||
<details><summary>Rect2i</summary>
|
||||
|
||||
|||STRUCT_Rect2i|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_Plane"></a>
|
||||
<details><summary>Plane</summary>
|
||||
|
||||
|||STRUCT_Plane|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_AABB"></a>
|
||||
<details><summary>AABB</summary>
|
||||
|
||||
|||STRUCT_AABB|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_Face3"></a>
|
||||
<details><summary>Face3</summary>
|
||||
|
||||
|||STRUCT_Face3|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_Transform2D"></a>
|
||||
<details><summary>Transform2D</summary>
|
||||
|
||||
|||STRUCT_Transform2D|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_Quaternion"></a>
|
||||
<details><summary>Quaternion</summary>
|
||||
|
||||
|||STRUCT_Quaternion|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_Basis"></a>
|
||||
<details><summary>Basis</summary>
|
||||
|
||||
|||STRUCT_Basis|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_Transform"></a>
|
||||
<details><summary>Transform</summary>
|
||||
|
||||
|||STRUCT_Transform|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_Projection"></a>
|
||||
<details><summary>Projection</summary>
|
||||
|
||||
|||STRUCT_Projection|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="CLASS_RandomPCG"></a>
|
||||
<details><summary>RandomPCG</summary>
|
||||
|
||||
|||CLASS_RandomPCG|||
|
||||
|
||||
</details>
|
||||
|
||||
String
|
||||
------------------------------------------------------------------
|
||||
|
||||
Helper Structs
|
||||
|
||||
<a name="STRUCT_CharRange"></a>
|
||||
<details><summary>CharRange</summary>
|
||||
|
||||
|||STRUCT_CharRange|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_StrRange"></a>
|
||||
<details><summary>StrRange</summary>
|
||||
|
||||
|||STRUCT_StrRange|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_NoCaseComparator"></a>
|
||||
<details><summary>NoCaseComparator</summary>
|
||||
|
||||
|||STRUCT_NoCaseComparator|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="STRUCT_NaturalNoCaseComparator"></a>
|
||||
<details><summary>NaturalNoCaseComparator</summary>
|
||||
|
||||
|||STRUCT_NaturalNoCaseComparator|||
|
||||
|
||||
</details>
|
||||
|
||||
Character Strings
|
||||
|
||||
<a name="STRUCT_StaticCString"></a>
|
||||
<details><summary>StaticCString</summary>
|
||||
|
||||
You can statically stoe a C string with this.
|
||||
|
||||
|||STRUCT_StaticCString|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="CLASS_Char16String"></a>
|
||||
<details><summary>Char16String</summary>
|
||||
|
||||
16 bit (wide char) char string.
|
||||
|
||||
|||CLASS_Char16String|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="CLASS_CharString"></a>
|
||||
<details><summary>CharString</summary>
|
||||
|
||||
8 bit char string.
|
||||
|
||||
|||CLASS_CharString|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="CLASS_CharProxy"></a>
|
||||
<details><summary>CharProxy</summary>
|
||||
|
||||
Properly stores a reference to an element in a String.
|
||||
|
||||
|||CLASS_CharProxy|||
|
||||
|
||||
</details>
|
||||
|
||||
Main
|
||||
|
||||
<a name="CLASS_String"></a>
|
||||
<details><summary>String</summary>
|
||||
|
||||
Main String class. This is what you normally use. Stores characters as 32 bit variables. It's COW (Copy on Write).
|
||||
|
||||
If you want to convert this to a char* use it's utf8() method.
|
||||
|
||||
|||CLASS_String|||
|
||||
|
||||
</details>
|
||||
|
||||
<a name="CLASS_StringName"></a>
|
||||
<details><summary>StringName</summary>
|
||||
|
||||
A String that is optimized for comparisons using ==.
|
||||
|
||||
|||CLASS_StringName|||
|
||||
|
||||
</details>
|
||||
|
||||
Containers
|
||||
------------------------------------------------------------------
|
||||
|
||||
|
||||
API Modules
|
||||
Files
|
||||
------------------------------------------------------------------
|
||||
|
||||
|
||||
Threading
|
||||
------------------------------------------------------------------
|
||||
|
||||
|
||||
OBJECT
|
||||
====================================================================================
|
||||
|
||||
The CA library is a layer on top of the resource manager and parsing libraries that
|
||||
provides utilities for streaming processing and client-side process construction.
|
||||
|
||||
|
||||
ENUMS
|
||||
|
||||
|
||||
RENDER CORE
|
||||
====================================================================================
|
||||
|
||||
$ENUMS$
|
||||
Coordinate Systems
|
||||
------------------------------------------------------------------
|
||||
|
||||
STRUCTS
|
||||
====================================================================================
|
||||
3D TODO doube check z
|
||||
|
||||
$STRUCTS$
|
||||
|
||||
CLASSES
|
||||
====================================================================================
|
||||
|
||||
$CLASSES$
|
||||
|
||||
Modules
|
||||
----------------------------------------------------------------------------------------
|
||||
|
||||
The CA library contains the APIs for applications to allocate and exchange resources.
|
||||
|
||||
|
||||
!!! Attention Attention
|
||||
Always read all of the documentation.
|
||||
|
||||
[CA APIs](#CA)
|
||||
: List of APIs to manage external processes.
|
||||
|
||||
CA Buffer List APIs
|
||||
: Methods to process buffer resources separate from computation.
|
||||
|
||||
CA Data Structures
|
||||
: Specifies the data structures used for complex cases.
|
||||
|
||||
|
||||
## Handles
|
||||
|
||||
`CA::OpenHandle(const std::string&)`
|
||||
: Open a reference handle.
|
||||
|
||||
`CA::ReadMetaData(const Handle&)`
|
||||
: Metadata about the event.
|
||||
|
||||
`CA::CloseHandle(const Handle&)`
|
||||
: Free all handle resources, recursively.
|
||||
|
||||
|
||||
CA
|
||||
====================================================================================
|
||||
|
||||
!!! Warning Warning
|
||||
The API content represents the set of APIs you can use directly. Some APIs
|
||||
are not documented and we advise you do not use them directly. Using undocumented
|
||||
APIs can lead to incompatibility when upgrading to later releases.
|
||||
|
||||
|
||||
These examples assume that your directory structure is:
|
||||
|
||||
**********************************************************
|
||||
******************************************************************
|
||||
*
|
||||
* 📂 ca1
|
||||
* |
|
||||
* +-- 📄 bar.txt
|
||||
* |
|
||||
* +-- 📂 foo
|
||||
* | |
|
||||
* | ⋮
|
||||
* |
|
||||
* +-- 📂 xsource
|
||||
* | |
|
||||
* | +-- 📂 data
|
||||
* | | |
|
||||
* | | +-- 📄 manifest.json
|
||||
* | | |
|
||||
* | ⋮ ⋮
|
||||
* |
|
||||
* ⋮
|
||||
**********************************************************
|
||||
[Directory structure.]
|
||||
* +x
|
||||
* *--->--------. .--->--------.
|
||||
* | | | |
|
||||
* v +y | | |
|
||||
* | | +y ^ ^ +z |
|
||||
* | | |/ |
|
||||
* '------------' *--->--------'
|
||||
* / +x
|
||||
* -z
|
||||
* 2D 3D
|
||||
******************************************************************
|
||||
|
||||
|
||||
Table
|
||||
Application
|
||||
------------------------------------------------------------------
|
||||
|
||||
|
||||
Screen | Factor | Used | Efficiency
|
||||
----------:|------------:|----------:|---------:
|
||||
1366x768 | 3x | 1152x672 | 74%
|
||||
1440x900 | 3x | 1152x672 | 60%
|
||||
*1600x900* | *4x* | 1536x896 | *96%*
|
||||
1680x1050 | 4x | 1536x896 | 78%
|
||||
1920x1080 | 4x | 1536x896 | 66%
|
||||
*1920x1200*| *5x* | 1920x1120 | *93%*
|
||||
[A Table]
|
||||
|
||||
|
||||
More Info
|
||||
Input
|
||||
------------------------------------------------------------------
|
||||
|
||||
******************************************************************
|
||||
* ^ y
|
||||
* |
|
||||
* .---------. .----|----.
|
||||
* | | | | |
|
||||
* | *-------> x | *--------> x
|
||||
* | | | | |
|
||||
* '----|----' '---------'
|
||||
* |
|
||||
* v y
|
||||
******************************************************************
|
||||
[Figure 1: Coordinate Example]
|
||||
|
||||
Rendering
|
||||
------------------------------------------------------------------
|
||||
|
||||
|
||||
-----
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GLSL
|
||||
vec3 sphNormal(in vec3 pos, in vec4 sph) {
|
||||
return normalize(pos-sph.xyz);
|
||||
}
|
||||
Materials
|
||||
------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
RENDER IMMEDIATE
|
||||
====================================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
RENDER OBJECTS
|
||||
====================================================================================
|
||||
|
||||
vec3 camera(vec2 U, vec2 r, vec3 ro, vec3 la, float fl) {
|
||||
vec2 uv = (U - r*.5)/r.y;
|
||||
vec3 fwd = normalize(la-ro),
|
||||
rgt = normalize(vec3(fwd.z, 0., -fwd.x));
|
||||
return normalize(fwd + fl*uv.x*rgt + fl*uv.y*cross(fwd, rgt));
|
||||
}
|
||||
|
||||
float vMap(vec3 p) {
|
||||
float hit = 0.0;
|
||||
vec2 h2 = hash22(floor(p.xz*0.25));
|
||||
if (p.z > 0.0) {
|
||||
if (p.y < -10.0 && h2.x > 0.5) hit=1.0;
|
||||
if (p.y > 10.0 && h2.y > 0.5) hit=1.0;
|
||||
}
|
||||
return hit;
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
[Code listing]
|
||||
|
||||
<script>markdeepOptions = {tocStyle:'long', definitionStyle:'long', linkAPIDefinitions: true};</script>
|
||||
<link rel="stylesheet" href="slate.css">
|
||||
|
Loading…
Reference in New Issue
Block a user