summaryrefslogtreecommitdiffstats
path: root/libs/rs/scriptc/rs_math.rsh
blob: 4390a5d94db35cab26699dbd225eb22918b97d5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef __RS_MATH_RSH__
#define __RS_MATH_RSH__

#include "rs_cl.rsh"
#include "rs_core.rsh"



// Allocations
extern rs_allocation rsGetAllocation(const void *);
extern uint32_t rsAllocationGetDimX(rs_allocation);
extern uint32_t rsAllocationGetDimY(rs_allocation);
extern uint32_t rsAllocationGetDimZ(rs_allocation);
extern uint32_t rsAllocationGetDimLOD(rs_allocation);
extern uint32_t rsAllocationGetDimFaces(rs_allocation);



// Debugging
extern void __attribute__((overloadable))rsDebug(const char *, float);
extern void __attribute__((overloadable))rsDebug(const char *, float2);
extern void __attribute__((overloadable))rsDebug(const char *, float3);
extern void __attribute__((overloadable))rsDebug(const char *, float4);
extern void __attribute__((overloadable))rsDebug(const char *, int);
extern void __attribute__((overloadable))rsDebug(const char *, const void *);
#define RS_DEBUG(a) rsDebug(#a, a)
#define RS_DEBUG_MARKER rsDebug(__FILE__, __LINE__)

// RS Math
extern int __attribute__((overloadable)) rsRand(int);
extern int __attribute__((overloadable)) rsRand(int, int);
extern float __attribute__((overloadable)) rsRand(float);
extern float __attribute__((overloadable)) rsRand(float, float);

extern float __attribute__((overloadable)) rsFrac(float);

// time
extern int32_t rsSecond();
extern int32_t rsMinute();
extern int32_t rsHour();
extern int32_t rsDay();
extern int32_t rsMonth();
extern int32_t rsYear();
extern int64_t rsUptimeMillis();
extern int64_t rsStartTimeMillis();
extern int64_t rsElapsedTimeMillis();

extern int rsSendToClient(void *data, int cmdID, int len, int waitForSpace);

// Script to Script
typedef struct rs_script_call_rec {
    rs_script script;
    rs_allocation input;
    rs_allocation output;

    uint32_t xStart;
    uint32_t xEnd;
    uint32_t yStart;
    uint32_t yEnd;
    uint32_t zStart;
    uint32_t zEnd;
    uint32_t arrayStart;
    uint32_t arrayEnd;

    const void * usrData;
} rs_script_call;

extern void __attribute__((overloadable))rsForEach(rs_script, rs_allocation input);
extern void __attribute__((overloadable))rsForEach(rs_script, rs_allocation input, rs_allocation output);
extern void __attribute__((overloadable))rsForEach(rs_script, rs_allocation input, int xStart, int xEnd);
extern void __attribute__((overloadable))rsForEach(rs_script, rs_allocation input, rs_allocation output, int xStart, int xEnd);
extern void __attribute__((overloadable))rsForEach(rs_script, rs_allocation input, int xStart, int yStart, int xEnd, int yEnd);
extern void __attribute__((overloadable))rsForEach(rs_script, rs_allocation input, rs_allocation output, int xStart, int yStart, int xEnd, int yEnd);

#endif