mirror of https://github.com/mode777/rayjs.git
More bindings, more samples
This commit is contained in:
parent
b43d924be8
commit
9227ba8b5d
|
@ -0,0 +1,430 @@
|
|||
#version 330
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec2 fragTexCoord;
|
||||
in vec4 fragColor;
|
||||
|
||||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
||||
uniform vec3 viewEye;
|
||||
uniform vec3 viewCenter;
|
||||
uniform float runTime;
|
||||
uniform vec2 resolution;
|
||||
|
||||
// The MIT License
|
||||
// Copyright © 2013 Inigo Quilez
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
// A list of useful distance function to simple primitives, and an example on how to
|
||||
// do some interesting boolean operations, repetition and displacement.
|
||||
//
|
||||
// More info here: http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm
|
||||
|
||||
#define AA 1 // make this 1 is your machine is too slow
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
||||
float sdPlane( vec3 p )
|
||||
{
|
||||
return p.y;
|
||||
}
|
||||
|
||||
float sdSphere( vec3 p, float s )
|
||||
{
|
||||
return length(p)-s;
|
||||
}
|
||||
|
||||
float sdBox( vec3 p, vec3 b )
|
||||
{
|
||||
vec3 d = abs(p) - b;
|
||||
return min(max(d.x,max(d.y,d.z)),0.0) + length(max(d,0.0));
|
||||
}
|
||||
|
||||
float sdEllipsoid( in vec3 p, in vec3 r )
|
||||
{
|
||||
return (length( p/r ) - 1.0) * min(min(r.x,r.y),r.z);
|
||||
}
|
||||
|
||||
float udRoundBox( vec3 p, vec3 b, float r )
|
||||
{
|
||||
return length(max(abs(p)-b,0.0))-r;
|
||||
}
|
||||
|
||||
float sdTorus( vec3 p, vec2 t )
|
||||
{
|
||||
return length( vec2(length(p.xz)-t.x,p.y) )-t.y;
|
||||
}
|
||||
|
||||
float sdHexPrism( vec3 p, vec2 h )
|
||||
{
|
||||
vec3 q = abs(p);
|
||||
#if 0
|
||||
return max(q.z-h.y,max((q.x*0.866025+q.y*0.5),q.y)-h.x);
|
||||
#else
|
||||
float d1 = q.z-h.y;
|
||||
float d2 = max((q.x*0.866025+q.y*0.5),q.y)-h.x;
|
||||
return length(max(vec2(d1,d2),0.0)) + min(max(d1,d2), 0.);
|
||||
#endif
|
||||
}
|
||||
|
||||
float sdCapsule( vec3 p, vec3 a, vec3 b, float r )
|
||||
{
|
||||
vec3 pa = p-a, ba = b-a;
|
||||
float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 );
|
||||
return length( pa - ba*h ) - r;
|
||||
}
|
||||
|
||||
float sdEquilateralTriangle( in vec2 p )
|
||||
{
|
||||
const float k = sqrt(3.0);
|
||||
p.x = abs(p.x) - 1.0;
|
||||
p.y = p.y + 1.0/k;
|
||||
if( p.x + k*p.y > 0.0 ) p = vec2( p.x - k*p.y, -k*p.x - p.y )/2.0;
|
||||
p.x += 2.0 - 2.0*clamp( (p.x+2.0)/2.0, 0.0, 1.0 );
|
||||
return -length(p)*sign(p.y);
|
||||
}
|
||||
|
||||
float sdTriPrism( vec3 p, vec2 h )
|
||||
{
|
||||
vec3 q = abs(p);
|
||||
float d1 = q.z-h.y;
|
||||
#if 1
|
||||
// distance bound
|
||||
float d2 = max(q.x*0.866025+p.y*0.5,-p.y)-h.x*0.5;
|
||||
#else
|
||||
// correct distance
|
||||
h.x *= 0.866025;
|
||||
float d2 = sdEquilateralTriangle(p.xy/h.x)*h.x;
|
||||
#endif
|
||||
return length(max(vec2(d1,d2),0.0)) + min(max(d1,d2), 0.);
|
||||
}
|
||||
|
||||
float sdCylinder( vec3 p, vec2 h )
|
||||
{
|
||||
vec2 d = abs(vec2(length(p.xz),p.y)) - h;
|
||||
return min(max(d.x,d.y),0.0) + length(max(d,0.0));
|
||||
}
|
||||
|
||||
float sdCone( in vec3 p, in vec3 c )
|
||||
{
|
||||
vec2 q = vec2( length(p.xz), p.y );
|
||||
float d1 = -q.y-c.z;
|
||||
float d2 = max( dot(q,c.xy), q.y);
|
||||
return length(max(vec2(d1,d2),0.0)) + min(max(d1,d2), 0.);
|
||||
}
|
||||
|
||||
float sdConeSection( in vec3 p, in float h, in float r1, in float r2 )
|
||||
{
|
||||
float d1 = -p.y - h;
|
||||
float q = p.y - h;
|
||||
float si = 0.5*(r1-r2)/h;
|
||||
float d2 = max( sqrt( dot(p.xz,p.xz)*(1.0-si*si)) + q*si - r2, q );
|
||||
return length(max(vec2(d1,d2),0.0)) + min(max(d1,d2), 0.);
|
||||
}
|
||||
|
||||
float sdPryamid4(vec3 p, vec3 h ) // h = { cos a, sin a, height }
|
||||
{
|
||||
// Tetrahedron = Octahedron - Cube
|
||||
float box = sdBox( p - vec3(0,-2.0*h.z,0), vec3(2.0*h.z) );
|
||||
|
||||
float d = 0.0;
|
||||
d = max( d, abs( dot(p, vec3( -h.x, h.y, 0 )) ));
|
||||
d = max( d, abs( dot(p, vec3( h.x, h.y, 0 )) ));
|
||||
d = max( d, abs( dot(p, vec3( 0, h.y, h.x )) ));
|
||||
d = max( d, abs( dot(p, vec3( 0, h.y,-h.x )) ));
|
||||
float octa = d - h.z;
|
||||
return max(-box,octa); // Subtraction
|
||||
}
|
||||
|
||||
float length2( vec2 p )
|
||||
{
|
||||
return sqrt( p.x*p.x + p.y*p.y );
|
||||
}
|
||||
|
||||
float length6( vec2 p )
|
||||
{
|
||||
p = p*p*p; p = p*p;
|
||||
return pow( p.x + p.y, 1.0/6.0 );
|
||||
}
|
||||
|
||||
float length8( vec2 p )
|
||||
{
|
||||
p = p*p; p = p*p; p = p*p;
|
||||
return pow( p.x + p.y, 1.0/8.0 );
|
||||
}
|
||||
|
||||
float sdTorus82( vec3 p, vec2 t )
|
||||
{
|
||||
vec2 q = vec2(length2(p.xz)-t.x,p.y);
|
||||
return length8(q)-t.y;
|
||||
}
|
||||
|
||||
float sdTorus88( vec3 p, vec2 t )
|
||||
{
|
||||
vec2 q = vec2(length8(p.xz)-t.x,p.y);
|
||||
return length8(q)-t.y;
|
||||
}
|
||||
|
||||
float sdCylinder6( vec3 p, vec2 h )
|
||||
{
|
||||
return max( length6(p.xz)-h.x, abs(p.y)-h.y );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
||||
float opS( float d1, float d2 )
|
||||
{
|
||||
return max(-d2,d1);
|
||||
}
|
||||
|
||||
vec2 opU( vec2 d1, vec2 d2 )
|
||||
{
|
||||
return (d1.x<d2.x) ? d1 : d2;
|
||||
}
|
||||
|
||||
vec3 opRep( vec3 p, vec3 c )
|
||||
{
|
||||
return mod(p,c)-0.5*c;
|
||||
}
|
||||
|
||||
vec3 opTwist( vec3 p )
|
||||
{
|
||||
float c = cos(10.0*p.y+10.0);
|
||||
float s = sin(10.0*p.y+10.0);
|
||||
mat2 m = mat2(c,-s,s,c);
|
||||
return vec3(m*p.xz,p.y);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
||||
vec2 map( in vec3 pos )
|
||||
{
|
||||
vec2 res = opU( vec2( sdPlane( pos), 1.0 ),
|
||||
vec2( sdSphere( pos-vec3( 0.0,0.25, 0.0), 0.25 ), 46.9 ) );
|
||||
res = opU( res, vec2( sdBox( pos-vec3( 1.0,0.25, 0.0), vec3(0.25) ), 3.0 ) );
|
||||
res = opU( res, vec2( udRoundBox( pos-vec3( 1.0,0.25, 1.0), vec3(0.15), 0.1 ), 41.0 ) );
|
||||
res = opU( res, vec2( sdTorus( pos-vec3( 0.0,0.25, 1.0), vec2(0.20,0.05) ), 25.0 ) );
|
||||
res = opU( res, vec2( sdCapsule( pos,vec3(-1.3,0.10,-0.1), vec3(-0.8,0.50,0.2), 0.1 ), 31.9 ) );
|
||||
res = opU( res, vec2( sdTriPrism( pos-vec3(-1.0,0.25,-1.0), vec2(0.25,0.05) ),43.5 ) );
|
||||
res = opU( res, vec2( sdCylinder( pos-vec3( 1.0,0.30,-1.0), vec2(0.1,0.2) ), 8.0 ) );
|
||||
res = opU( res, vec2( sdCone( pos-vec3( 0.0,0.50,-1.0), vec3(0.8,0.6,0.3) ), 55.0 ) );
|
||||
res = opU( res, vec2( sdTorus82( pos-vec3( 0.0,0.25, 2.0), vec2(0.20,0.05) ),50.0 ) );
|
||||
res = opU( res, vec2( sdTorus88( pos-vec3(-1.0,0.25, 2.0), vec2(0.20,0.05) ),43.0 ) );
|
||||
res = opU( res, vec2( sdCylinder6( pos-vec3( 1.0,0.30, 2.0), vec2(0.1,0.2) ), 12.0 ) );
|
||||
res = opU( res, vec2( sdHexPrism( pos-vec3(-1.0,0.20, 1.0), vec2(0.25,0.05) ),17.0 ) );
|
||||
res = opU( res, vec2( sdPryamid4( pos-vec3(-1.0,0.15,-2.0), vec3(0.8,0.6,0.25) ),37.0 ) );
|
||||
res = opU( res, vec2( opS( udRoundBox( pos-vec3(-2.0,0.2, 1.0), vec3(0.15),0.05),
|
||||
sdSphere( pos-vec3(-2.0,0.2, 1.0), 0.25)), 13.0 ) );
|
||||
res = opU( res, vec2( opS( sdTorus82( pos-vec3(-2.0,0.2, 0.0), vec2(0.20,0.1)),
|
||||
sdCylinder( opRep( vec3(atan(pos.x+2.0,pos.z)/6.2831, pos.y, 0.02+0.5*length(pos-vec3(-2.0,0.2, 0.0))), vec3(0.05,1.0,0.05)), vec2(0.02,0.6))), 51.0 ) );
|
||||
res = opU( res, vec2( 0.5*sdSphere( pos-vec3(-2.0,0.25,-1.0), 0.2 ) + 0.03*sin(50.0*pos.x)*sin(50.0*pos.y)*sin(50.0*pos.z), 65.0 ) );
|
||||
res = opU( res, vec2( 0.5*sdTorus( opTwist(pos-vec3(-2.0,0.25, 2.0)),vec2(0.20,0.05)), 46.7 ) );
|
||||
res = opU( res, vec2( sdConeSection( pos-vec3( 0.0,0.35,-2.0), 0.15, 0.2, 0.1 ), 13.67 ) );
|
||||
res = opU( res, vec2( sdEllipsoid( pos-vec3( 1.0,0.35,-2.0), vec3(0.15, 0.2, 0.05) ), 43.17 ) );
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
vec2 castRay( in vec3 ro, in vec3 rd )
|
||||
{
|
||||
float tmin = 0.2;
|
||||
float tmax = 30.0;
|
||||
|
||||
#if 1
|
||||
// bounding volume
|
||||
float tp1 = (0.0-ro.y)/rd.y; if( tp1>0.0 ) tmax = min( tmax, tp1 );
|
||||
float tp2 = (1.6-ro.y)/rd.y; if( tp2>0.0 ) { if( ro.y>1.6 ) tmin = max( tmin, tp2 );
|
||||
else tmax = min( tmax, tp2 ); }
|
||||
#endif
|
||||
|
||||
float t = tmin;
|
||||
float m = -1.0;
|
||||
for( int i=0; i<64; i++ )
|
||||
{
|
||||
float precis = 0.0005*t;
|
||||
vec2 res = map( ro+rd*t );
|
||||
if( res.x<precis || t>tmax ) break;
|
||||
t += res.x;
|
||||
m = res.y;
|
||||
}
|
||||
|
||||
if( t>tmax ) m=-1.0;
|
||||
return vec2( t, m );
|
||||
}
|
||||
|
||||
|
||||
float calcSoftshadow( in vec3 ro, in vec3 rd, in float mint, in float tmax )
|
||||
{
|
||||
float res = 1.0;
|
||||
float t = mint;
|
||||
for( int i=0; i<16; i++ )
|
||||
{
|
||||
float h = map( ro + rd*t ).x;
|
||||
res = min( res, 8.0*h/t );
|
||||
t += clamp( h, 0.02, 0.10 );
|
||||
if( h<0.001 || t>tmax ) break;
|
||||
}
|
||||
return clamp( res, 0.0, 1.0 );
|
||||
}
|
||||
|
||||
vec3 calcNormal( in vec3 pos )
|
||||
{
|
||||
vec2 e = vec2(1.0,-1.0)*0.5773*0.0005;
|
||||
return normalize( e.xyy*map( pos + e.xyy ).x +
|
||||
e.yyx*map( pos + e.yyx ).x +
|
||||
e.yxy*map( pos + e.yxy ).x +
|
||||
e.xxx*map( pos + e.xxx ).x );
|
||||
/*
|
||||
vec3 eps = vec3( 0.0005, 0.0, 0.0 );
|
||||
vec3 nor = vec3(
|
||||
map(pos+eps.xyy).x - map(pos-eps.xyy).x,
|
||||
map(pos+eps.yxy).x - map(pos-eps.yxy).x,
|
||||
map(pos+eps.yyx).x - map(pos-eps.yyx).x );
|
||||
return normalize(nor);
|
||||
*/
|
||||
}
|
||||
|
||||
float calcAO( in vec3 pos, in vec3 nor )
|
||||
{
|
||||
float occ = 0.0;
|
||||
float sca = 1.0;
|
||||
for( int i=0; i<5; i++ )
|
||||
{
|
||||
float hr = 0.01 + 0.12*float(i)/4.0;
|
||||
vec3 aopos = nor * hr + pos;
|
||||
float dd = map( aopos ).x;
|
||||
occ += -(dd-hr)*sca;
|
||||
sca *= 0.95;
|
||||
}
|
||||
return clamp( 1.0 - 3.0*occ, 0.0, 1.0 );
|
||||
}
|
||||
|
||||
// http://iquilezles.org/www/articles/checkerfiltering/checkerfiltering.htm
|
||||
float checkersGradBox( in vec2 p )
|
||||
{
|
||||
// filter kernel
|
||||
vec2 w = fwidth(p) + 0.001;
|
||||
// analytical integral (box filter)
|
||||
vec2 i = 2.0*(abs(fract((p-0.5*w)*0.5)-0.5)-abs(fract((p+0.5*w)*0.5)-0.5))/w;
|
||||
// xor pattern
|
||||
return 0.5 - 0.5*i.x*i.y;
|
||||
}
|
||||
|
||||
vec3 render( in vec3 ro, in vec3 rd )
|
||||
{
|
||||
vec3 col = vec3(0.7, 0.9, 1.0) +rd.y*0.8;
|
||||
vec2 res = castRay(ro,rd);
|
||||
float t = res.x;
|
||||
float m = res.y;
|
||||
if( m>-0.5 )
|
||||
{
|
||||
vec3 pos = ro + t*rd;
|
||||
vec3 nor = calcNormal( pos );
|
||||
vec3 ref = reflect( rd, nor );
|
||||
|
||||
// material
|
||||
col = 0.45 + 0.35*sin( vec3(0.05,0.08,0.10)*(m-1.0) );
|
||||
if( m<1.5 )
|
||||
{
|
||||
|
||||
float f = checkersGradBox( 5.0*pos.xz );
|
||||
col = 0.3 + f*vec3(0.1);
|
||||
}
|
||||
|
||||
// lighting
|
||||
float occ = calcAO( pos, nor );
|
||||
vec3 lig = normalize( vec3(cos(-0.4 * runTime), sin(0.7 * runTime), -0.6) );
|
||||
vec3 hal = normalize( lig-rd );
|
||||
float amb = clamp( 0.5+0.5*nor.y, 0.0, 1.0 );
|
||||
float dif = clamp( dot( nor, lig ), 0.0, 1.0 );
|
||||
float bac = clamp( dot( nor, normalize(vec3(-lig.x,0.0,-lig.z))), 0.0, 1.0 )*clamp( 1.0-pos.y,0.0,1.0);
|
||||
float dom = smoothstep( -0.1, 0.1, ref.y );
|
||||
float fre = pow( clamp(1.0+dot(nor,rd),0.0,1.0), 2.0 );
|
||||
|
||||
dif *= calcSoftshadow( pos, lig, 0.02, 2.5 );
|
||||
dom *= calcSoftshadow( pos, ref, 0.02, 2.5 );
|
||||
|
||||
float spe = pow( clamp( dot( nor, hal ), 0.0, 1.0 ),16.0)*
|
||||
dif *
|
||||
(0.04 + 0.96*pow( clamp(1.0+dot(hal,rd),0.0,1.0), 5.0 ));
|
||||
|
||||
vec3 lin = vec3(0.0);
|
||||
lin += 1.30*dif*vec3(1.00,0.80,0.55);
|
||||
lin += 0.40*amb*vec3(0.40,0.60,1.00)*occ;
|
||||
lin += 0.50*dom*vec3(0.40,0.60,1.00)*occ;
|
||||
lin += 0.50*bac*vec3(0.25,0.25,0.25)*occ;
|
||||
lin += 0.25*fre*vec3(1.00,1.00,1.00)*occ;
|
||||
col = col*lin;
|
||||
col += 10.00*spe*vec3(1.00,0.90,0.70);
|
||||
|
||||
col = mix( col, vec3(0.8,0.9,1.0), 1.0-exp( -0.0002*t*t*t ) );
|
||||
}
|
||||
|
||||
return vec3( clamp(col,0.0,1.0) );
|
||||
}
|
||||
|
||||
mat3 setCamera( in vec3 ro, in vec3 ta, float cr )
|
||||
{
|
||||
vec3 cw = normalize(ta-ro);
|
||||
vec3 cp = vec3(sin(cr), cos(cr),0.0);
|
||||
vec3 cu = normalize( cross(cw,cp) );
|
||||
vec3 cv = normalize( cross(cu,cw) );
|
||||
return mat3( cu, cv, cw );
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 tot = vec3(0.0);
|
||||
#if AA>1
|
||||
for( int m=0; m<AA; m++ )
|
||||
for( int n=0; n<AA; n++ )
|
||||
{
|
||||
// pixel coordinates
|
||||
vec2 o = vec2(float(m),float(n)) / float(AA) - 0.5;
|
||||
vec2 p = (-resolution.xy + 2.0*(gl_FragCoord.xy+o))/resolution.y;
|
||||
#else
|
||||
vec2 p = (-resolution.xy + 2.0*gl_FragCoord.xy)/resolution.y;
|
||||
#endif
|
||||
|
||||
// RAY: Camera is provided from raylib
|
||||
//vec3 ro = vec3( -0.5+3.5*cos(0.1*time + 6.0*mo.x), 1.0 + 2.0*mo.y, 0.5 + 4.0*sin(0.1*time + 6.0*mo.x) );
|
||||
|
||||
vec3 ro = viewEye;
|
||||
vec3 ta = viewCenter;
|
||||
|
||||
// camera-to-world transformation
|
||||
mat3 ca = setCamera( ro, ta, 0.0 );
|
||||
// ray direction
|
||||
vec3 rd = ca * normalize( vec3(p.xy,2.0) );
|
||||
|
||||
// render
|
||||
vec3 col = render( ro, rd );
|
||||
|
||||
// gamma
|
||||
col = pow( col, vec3(0.4545) );
|
||||
|
||||
tot += col;
|
||||
#if AA>1
|
||||
}
|
||||
tot /= float(AA*AA);
|
||||
#endif
|
||||
|
||||
finalColor = vec4( tot, 1.0 );
|
||||
}
|
|
@ -197,7 +197,7 @@ function main(){
|
|||
core.addApiFunctionByName("MaximizeWindow")
|
||||
core.addApiFunctionByName("MinimizeWindow")
|
||||
core.addApiFunctionByName("RestoreWindow")
|
||||
// SetWindowIcon
|
||||
core.addApiFunctionByName("SetWindowIcon")
|
||||
// SetWindowIcons
|
||||
core.addApiFunctionByName("SetWindowTitle")
|
||||
core.addApiFunctionByName("SetWindowPosition")
|
||||
|
@ -247,8 +247,8 @@ function main(){
|
|||
core.addApiFunctionByName("EndMode3D")
|
||||
//core.addApiFunctionByName("BeginTextureMode")
|
||||
//core.addApiFunctionByName("EndTextureMode")
|
||||
//core.addApiFunctionByName("BeginShaderMode")
|
||||
//core.addApiFunctionByName("EndShaderMode")
|
||||
core.addApiFunctionByName("BeginShaderMode")
|
||||
core.addApiFunctionByName("EndShaderMode")
|
||||
core.addApiFunctionByName("BeginBlendMode")
|
||||
core.addApiFunctionByName("EndBlendMode")
|
||||
core.addApiFunctionByName("BeginScissorMode")
|
||||
|
@ -261,24 +261,24 @@ function main(){
|
|||
//core.addApiFunctionByName("UnloadVrStereoConfig")
|
||||
|
||||
// Shader Management
|
||||
// core.addApiFunctionByName("LoadShader")
|
||||
core.addApiFunctionByName("LoadShader")
|
||||
// core.addApiFunctionByName("LoadShaderFromMemory")
|
||||
// core.addApiFunctionByName("IsShaderReady")
|
||||
// core.addApiFunctionByName("GetShaderLocation")
|
||||
// core.addApiFunctionByName("GetShaderLocationAttrib")
|
||||
core.addApiFunctionByName("IsShaderReady")
|
||||
core.addApiFunctionByName("GetShaderLocation")
|
||||
core.addApiFunctionByName("GetShaderLocationAttrib")
|
||||
// core.addApiFunctionByName("SetShaderValue")
|
||||
// core.addApiFunctionByName("SetShaderValueV")
|
||||
// core.addApiFunctionByName("SetShaderValueMatrix")
|
||||
// core.addApiFunctionByName("SetShaderValueTexture")
|
||||
// // "UnloadShader" is destructor
|
||||
core.addApiFunctionByName("SetShaderValueMatrix")
|
||||
core.addApiFunctionByName("SetShaderValueTexture")
|
||||
// "UnloadShader" called by finalizer
|
||||
|
||||
// ScreenSpaceRelatedFunctions
|
||||
//core.addApiFunctionByName("GetMouseRay")
|
||||
//core.addApiFunctionByName("GetCameraMatrix")
|
||||
core.addApiFunctionByName("GetMouseRay")
|
||||
core.addApiFunctionByName("GetCameraMatrix")
|
||||
core.addApiFunctionByName("GetCameraMatrix2D")
|
||||
//core.addApiFunctionByName("GetWorldToScreen")
|
||||
core.addApiFunctionByName("GetWorldToScreen")
|
||||
core.addApiFunctionByName("GetScreenToWorld2D")
|
||||
//core.addApiFunctionByName("GetScreenToWorldEx")
|
||||
core.addApiFunctionByName("GetWorldToScreenEx")
|
||||
core.addApiFunctionByName("GetWorldToScreen2D")
|
||||
|
||||
// Timing related functions
|
||||
|
@ -393,8 +393,8 @@ function main(){
|
|||
core.addApiFunctionByName("GetGesturePinchAngle")
|
||||
|
||||
// Camera system functions
|
||||
// core.addApiFunctionByName("UpdateCamera")
|
||||
// core.addApiFunctionByName("UpdateCameraPro")
|
||||
core.addApiFunctionByName("UpdateCamera")
|
||||
core.addApiFunctionByName("UpdateCameraPro")
|
||||
|
||||
//api.functions.forEach(x => console.log(`core.addApiFunctionByName("${x.name}")`))
|
||||
|
||||
|
@ -481,54 +481,54 @@ function main(){
|
|||
core.addApiFunctionByName("ImageCopy")
|
||||
core.addApiFunctionByName("ImageFromImage")
|
||||
core.addApiFunctionByName("ImageText")
|
||||
// core.addApiFunctionByName("ImageTextEx")
|
||||
// core.addApiFunctionByName("ImageFormat")
|
||||
// core.addApiFunctionByName("ImageToPOT")
|
||||
// core.addApiFunctionByName("ImageCrop")
|
||||
// core.addApiFunctionByName("ImageAlphaCrop")
|
||||
// core.addApiFunctionByName("ImageAlphaClear")
|
||||
// core.addApiFunctionByName("ImageAlphaMask")
|
||||
// core.addApiFunctionByName("ImageAlphaPremultiply")
|
||||
// core.addApiFunctionByName("ImageBlurGaussian")
|
||||
// core.addApiFunctionByName("ImageResize")
|
||||
// core.addApiFunctionByName("ImageResizeNN")
|
||||
// core.addApiFunctionByName("ImageResizeCanvas")
|
||||
// core.addApiFunctionByName("ImageMipmaps")
|
||||
// core.addApiFunctionByName("ImageDither")
|
||||
// core.addApiFunctionByName("ImageFlipVertical")
|
||||
// core.addApiFunctionByName("ImageFlipHorizontal")
|
||||
// core.addApiFunctionByName("ImageRotateCW")
|
||||
// core.addApiFunctionByName("ImageRotateCCW")
|
||||
// core.addApiFunctionByName("ImageColorTint")
|
||||
// core.addApiFunctionByName("ImageColorInvert")
|
||||
// core.addApiFunctionByName("ImageColorGrayscale")
|
||||
// core.addApiFunctionByName("ImageColorContrast")
|
||||
// core.addApiFunctionByName("ImageColorBrightness")
|
||||
// core.addApiFunctionByName("ImageColorReplace")
|
||||
// core.addApiFunctionByName("LoadImageColors")
|
||||
// core.addApiFunctionByName("LoadImagePalette")
|
||||
// core.addApiFunctionByName("UnloadImageColors")
|
||||
// core.addApiFunctionByName("UnloadImagePalette")
|
||||
core.addApiFunctionByName("ImageTextEx")
|
||||
core.addApiFunctionByName("ImageFormat")
|
||||
core.addApiFunctionByName("ImageToPOT")
|
||||
core.addApiFunctionByName("ImageCrop")
|
||||
core.addApiFunctionByName("ImageAlphaCrop")
|
||||
core.addApiFunctionByName("ImageAlphaClear")
|
||||
core.addApiFunctionByName("ImageAlphaMask")
|
||||
core.addApiFunctionByName("ImageAlphaPremultiply")
|
||||
core.addApiFunctionByName("ImageBlurGaussian")
|
||||
core.addApiFunctionByName("ImageResize")
|
||||
core.addApiFunctionByName("ImageResizeNN")
|
||||
core.addApiFunctionByName("ImageResizeCanvas")
|
||||
core.addApiFunctionByName("ImageMipmaps")
|
||||
core.addApiFunctionByName("ImageDither")
|
||||
core.addApiFunctionByName("ImageFlipVertical")
|
||||
core.addApiFunctionByName("ImageFlipHorizontal")
|
||||
core.addApiFunctionByName("ImageRotateCW")
|
||||
core.addApiFunctionByName("ImageRotateCCW")
|
||||
core.addApiFunctionByName("ImageColorTint")
|
||||
core.addApiFunctionByName("ImageColorInvert")
|
||||
core.addApiFunctionByName("ImageColorGrayscale")
|
||||
core.addApiFunctionByName("ImageColorContrast")
|
||||
core.addApiFunctionByName("ImageColorBrightness")
|
||||
core.addApiFunctionByName("ImageColorReplace")
|
||||
//core.addApiFunctionByName("LoadImageColors")
|
||||
//core.addApiFunctionByName("LoadImagePalette")
|
||||
//core.addApiFunctionByName("UnloadImageColors")
|
||||
//core.addApiFunctionByName("UnloadImagePalette")
|
||||
core.addApiFunctionByName("GetImageAlphaBorder")
|
||||
core.addApiFunctionByName("GetImageColor")
|
||||
|
||||
// Image drawing functions
|
||||
// core.addApiFunctionByName("ImageClearBackground")
|
||||
// core.addApiFunctionByName("ImageDrawPixel")
|
||||
// core.addApiFunctionByName("ImageDrawPixelV")
|
||||
// core.addApiFunctionByName("ImageDrawLine")
|
||||
// core.addApiFunctionByName("ImageDrawLineV")
|
||||
// core.addApiFunctionByName("ImageDrawCircle")
|
||||
// core.addApiFunctionByName("ImageDrawCircleV")
|
||||
// core.addApiFunctionByName("ImageDrawCircleLines")
|
||||
// core.addApiFunctionByName("ImageDrawCircleLinesV")
|
||||
// core.addApiFunctionByName("ImageDrawRectangle")
|
||||
// core.addApiFunctionByName("ImageDrawRectangleV")
|
||||
// core.addApiFunctionByName("ImageDrawRectangleRec")
|
||||
// core.addApiFunctionByName("ImageDrawRectangleLines")
|
||||
// core.addApiFunctionByName("ImageDraw")
|
||||
// core.addApiFunctionByName("ImageDrawText")
|
||||
// core.addApiFunctionByName("ImageDrawTextEx")
|
||||
core.addApiFunctionByName("ImageClearBackground")
|
||||
core.addApiFunctionByName("ImageDrawPixel")
|
||||
core.addApiFunctionByName("ImageDrawPixelV")
|
||||
core.addApiFunctionByName("ImageDrawLine")
|
||||
core.addApiFunctionByName("ImageDrawLineV")
|
||||
core.addApiFunctionByName("ImageDrawCircle")
|
||||
core.addApiFunctionByName("ImageDrawCircleV")
|
||||
core.addApiFunctionByName("ImageDrawCircleLines")
|
||||
core.addApiFunctionByName("ImageDrawCircleLinesV")
|
||||
core.addApiFunctionByName("ImageDrawRectangle")
|
||||
core.addApiFunctionByName("ImageDrawRectangleV")
|
||||
core.addApiFunctionByName("ImageDrawRectangleRec")
|
||||
core.addApiFunctionByName("ImageDrawRectangleLines")
|
||||
core.addApiFunctionByName("ImageDraw")
|
||||
core.addApiFunctionByName("ImageDrawText")
|
||||
core.addApiFunctionByName("ImageDrawTextEx")
|
||||
|
||||
// Texture loading functions
|
||||
core.addApiFunctionByName("LoadTexture")
|
||||
|
@ -543,7 +543,7 @@ function main(){
|
|||
// core.addApiFunctionByName("UpdateTextureRec")
|
||||
|
||||
// Texture configuration functions
|
||||
// core.addApiFunctionByName("GenTextureMipmaps")
|
||||
core.addApiFunctionByName("GenTextureMipmaps")
|
||||
core.addApiFunctionByName("SetTextureFilter")
|
||||
core.addApiFunctionByName("SetTextureWrap")
|
||||
|
||||
|
@ -615,22 +615,7 @@ function main(){
|
|||
// core.addApiFunctionByName("CodepointToUTF8")
|
||||
|
||||
// Text strings management functions (no UTF-8 strings, only byte chars)
|
||||
// Probably not needed
|
||||
// core.addApiFunctionByName("TextCopy")
|
||||
// core.addApiFunctionByName("TextIsEqual")
|
||||
// core.addApiFunctionByName("TextLength")
|
||||
// core.addApiFunctionByName("TextFormat")
|
||||
// core.addApiFunctionByName("TextSubtext")
|
||||
// core.addApiFunctionByName("TextReplace")
|
||||
// core.addApiFunctionByName("TextInsert")
|
||||
// core.addApiFunctionByName("TextJoin")
|
||||
// core.addApiFunctionByName("TextSplit")
|
||||
// core.addApiFunctionByName("TextAppend")
|
||||
// core.addApiFunctionByName("TextFindIndex")
|
||||
// core.addApiFunctionByName("TextToUpper")
|
||||
// core.addApiFunctionByName("TextToLower")
|
||||
// core.addApiFunctionByName("TextToPascal")
|
||||
// core.addApiFunctionByName("TextToInteger")
|
||||
// Not supported, use JS Stdlib instead
|
||||
|
||||
// module: rmodels
|
||||
|
||||
|
@ -675,14 +660,15 @@ function main(){
|
|||
core.addApiFunctionByName("DrawBillboardPro")
|
||||
|
||||
// Mesh management functions
|
||||
// core.addApiFunctionByName("UploadMesh")
|
||||
// TODO: Refcounting needed?
|
||||
core.addApiFunctionByName("UploadMesh")
|
||||
// core.addApiFunctionByName("UpdateMeshBuffer")
|
||||
// "UnloadMesh" called by finalizer
|
||||
//core.addApiFunctionByName("DrawMesh")
|
||||
// core.addApiFunctionByName("DrawMeshInstanced")
|
||||
core.addApiFunctionByName("ExportMesh")
|
||||
core.addApiFunctionByName("GetMeshBoundingBox")
|
||||
// core.addApiFunctionByName("GenMeshTangents")
|
||||
core.addApiFunctionByName("GenMeshTangents")
|
||||
|
||||
// Mesh generation functions
|
||||
core.addApiFunctionByName("GenMeshPoly")
|
||||
|
@ -753,8 +739,8 @@ function main(){
|
|||
core.addApiFunctionByName("SetSoundPitch")
|
||||
core.addApiFunctionByName("SetSoundPan")
|
||||
core.addApiFunctionByName("WaveCopy")
|
||||
// core.addApiFunctionByName("WaveCrop")
|
||||
// core.addApiFunctionByName("WaveFormat")
|
||||
core.addApiFunctionByName("WaveCrop")
|
||||
core.addApiFunctionByName("WaveFormat")
|
||||
// core.addApiFunctionByName("LoadWaveSamples")
|
||||
// core.addApiFunctionByName("UnloadWaveSamples")
|
||||
|
||||
|
@ -838,81 +824,81 @@ function main(){
|
|||
core.addApiFunctionByName("Vector3One")
|
||||
core.addApiFunctionByName("Vector3Add")
|
||||
core.addApiFunctionByName("Vector3AddValue")
|
||||
// core.addApiFunctionByName("Vector3Subtract")
|
||||
// core.addApiFunctionByName("Vector3SubtractValue")
|
||||
// core.addApiFunctionByName("Vector3Scale")
|
||||
// core.addApiFunctionByName("Vector3Multiply")
|
||||
// core.addApiFunctionByName("Vector3CrossProduct")
|
||||
// core.addApiFunctionByName("Vector3Perpendicular")
|
||||
// core.addApiFunctionByName("Vector3Length")
|
||||
// core.addApiFunctionByName("Vector3LengthSqr")
|
||||
// core.addApiFunctionByName("Vector3DotProduct")
|
||||
// core.addApiFunctionByName("Vector3Distance")
|
||||
// core.addApiFunctionByName("Vector3DistanceSqr")
|
||||
// core.addApiFunctionByName("Vector3Angle")
|
||||
// core.addApiFunctionByName("Vector3Negate")
|
||||
// core.addApiFunctionByName("Vector3Divide")
|
||||
// core.addApiFunctionByName("Vector3Normalize")
|
||||
// core.addApiFunctionByName("Vector3OrthoNormalize")
|
||||
// core.addApiFunctionByName("Vector3Transform")
|
||||
// core.addApiFunctionByName("Vector3RotateByQuaternion")
|
||||
// core.addApiFunctionByName("Vector3RotateByAxisAngle")
|
||||
// core.addApiFunctionByName("Vector3Lerp")
|
||||
// core.addApiFunctionByName("Vector3Reflect")
|
||||
// core.addApiFunctionByName("Vector3Min")
|
||||
// core.addApiFunctionByName("Vector3Max")
|
||||
// core.addApiFunctionByName("Vector3Barycenter")
|
||||
// core.addApiFunctionByName("Vector3Unproject")
|
||||
// core.addApiFunctionByName("Vector3ToFloatV")
|
||||
// core.addApiFunctionByName("Vector3Invert")
|
||||
// core.addApiFunctionByName("Vector3Clamp")
|
||||
// core.addApiFunctionByName("Vector3ClampValue")
|
||||
// core.addApiFunctionByName("Vector3Equals")
|
||||
// core.addApiFunctionByName("Vector3Refract")
|
||||
// core.addApiFunctionByName("MatrixDeterminant")
|
||||
// core.addApiFunctionByName("MatrixTrace")
|
||||
// core.addApiFunctionByName("MatrixTranspose")
|
||||
// core.addApiFunctionByName("MatrixInvert")
|
||||
// core.addApiFunctionByName("MatrixIdentity")
|
||||
// core.addApiFunctionByName("MatrixAdd")
|
||||
// core.addApiFunctionByName("MatrixSubtract")
|
||||
// core.addApiFunctionByName("MatrixMultiply")
|
||||
// core.addApiFunctionByName("MatrixTranslate")
|
||||
// core.addApiFunctionByName("MatrixRotate")
|
||||
// core.addApiFunctionByName("MatrixRotateX")
|
||||
// core.addApiFunctionByName("MatrixRotateY")
|
||||
// core.addApiFunctionByName("MatrixRotateZ")
|
||||
// core.addApiFunctionByName("MatrixRotateXYZ")
|
||||
// core.addApiFunctionByName("MatrixRotateZYX")
|
||||
// core.addApiFunctionByName("MatrixScale")
|
||||
// core.addApiFunctionByName("MatrixFrustum")
|
||||
// core.addApiFunctionByName("MatrixPerspective")
|
||||
// core.addApiFunctionByName("MatrixOrtho")
|
||||
// core.addApiFunctionByName("MatrixLookAt")
|
||||
// core.addApiFunctionByName("MatrixToFloatV")
|
||||
// core.addApiFunctionByName("QuaternionAdd")
|
||||
// core.addApiFunctionByName("QuaternionAddValue")
|
||||
// core.addApiFunctionByName("QuaternionSubtract")
|
||||
// core.addApiFunctionByName("QuaternionSubtractValue")
|
||||
// core.addApiFunctionByName("QuaternionIdentity")
|
||||
// core.addApiFunctionByName("QuaternionLength")
|
||||
// core.addApiFunctionByName("QuaternionNormalize")
|
||||
// core.addApiFunctionByName("QuaternionInvert")
|
||||
// core.addApiFunctionByName("QuaternionMultiply")
|
||||
// core.addApiFunctionByName("QuaternionScale")
|
||||
// core.addApiFunctionByName("QuaternionDivide")
|
||||
// core.addApiFunctionByName("QuaternionLerp")
|
||||
// core.addApiFunctionByName("QuaternionNlerp")
|
||||
// core.addApiFunctionByName("QuaternionSlerp")
|
||||
// core.addApiFunctionByName("QuaternionFromVector3ToVector3")
|
||||
// core.addApiFunctionByName("QuaternionFromMatrix")
|
||||
// core.addApiFunctionByName("QuaternionToMatrix")
|
||||
// core.addApiFunctionByName("QuaternionFromAxisAngle")
|
||||
// core.addApiFunctionByName("QuaternionToAxisAngle")
|
||||
// core.addApiFunctionByName("QuaternionFromEuler")
|
||||
// core.addApiFunctionByName("QuaternionToEuler")
|
||||
// core.addApiFunctionByName("QuaternionTransform")
|
||||
// core.addApiFunctionByName("QuaternionEquals")
|
||||
core.addApiFunctionByName("Vector3Subtract")
|
||||
core.addApiFunctionByName("Vector3SubtractValue")
|
||||
core.addApiFunctionByName("Vector3Scale")
|
||||
core.addApiFunctionByName("Vector3Multiply")
|
||||
core.addApiFunctionByName("Vector3CrossProduct")
|
||||
core.addApiFunctionByName("Vector3Perpendicular")
|
||||
core.addApiFunctionByName("Vector3Length")
|
||||
core.addApiFunctionByName("Vector3LengthSqr")
|
||||
core.addApiFunctionByName("Vector3DotProduct")
|
||||
core.addApiFunctionByName("Vector3Distance")
|
||||
core.addApiFunctionByName("Vector3DistanceSqr")
|
||||
core.addApiFunctionByName("Vector3Angle")
|
||||
core.addApiFunctionByName("Vector3Negate")
|
||||
core.addApiFunctionByName("Vector3Divide")
|
||||
core.addApiFunctionByName("Vector3Normalize")
|
||||
//core.addApiFunctionByName("Vector3OrthoNormalize")
|
||||
core.addApiFunctionByName("Vector3Transform")
|
||||
core.addApiFunctionByName("Vector3RotateByQuaternion")
|
||||
core.addApiFunctionByName("Vector3RotateByAxisAngle")
|
||||
core.addApiFunctionByName("Vector3Lerp")
|
||||
core.addApiFunctionByName("Vector3Reflect")
|
||||
core.addApiFunctionByName("Vector3Min")
|
||||
core.addApiFunctionByName("Vector3Max")
|
||||
core.addApiFunctionByName("Vector3Barycenter")
|
||||
core.addApiFunctionByName("Vector3Unproject")
|
||||
//core.addApiFunctionByName("Vector3ToFloatV")
|
||||
core.addApiFunctionByName("Vector3Invert")
|
||||
core.addApiFunctionByName("Vector3Clamp")
|
||||
core.addApiFunctionByName("Vector3ClampValue")
|
||||
core.addApiFunctionByName("Vector3Equals")
|
||||
core.addApiFunctionByName("Vector3Refract")
|
||||
core.addApiFunctionByName("MatrixDeterminant")
|
||||
core.addApiFunctionByName("MatrixTrace")
|
||||
core.addApiFunctionByName("MatrixTranspose")
|
||||
core.addApiFunctionByName("MatrixInvert")
|
||||
core.addApiFunctionByName("MatrixIdentity")
|
||||
core.addApiFunctionByName("MatrixAdd")
|
||||
core.addApiFunctionByName("MatrixSubtract")
|
||||
core.addApiFunctionByName("MatrixMultiply")
|
||||
core.addApiFunctionByName("MatrixTranslate")
|
||||
core.addApiFunctionByName("MatrixRotate")
|
||||
core.addApiFunctionByName("MatrixRotateX")
|
||||
core.addApiFunctionByName("MatrixRotateY")
|
||||
core.addApiFunctionByName("MatrixRotateZ")
|
||||
core.addApiFunctionByName("MatrixRotateXYZ")
|
||||
core.addApiFunctionByName("MatrixRotateZYX")
|
||||
core.addApiFunctionByName("MatrixScale")
|
||||
core.addApiFunctionByName("MatrixFrustum")
|
||||
core.addApiFunctionByName("MatrixPerspective")
|
||||
core.addApiFunctionByName("MatrixOrtho")
|
||||
core.addApiFunctionByName("MatrixLookAt")
|
||||
//core.addApiFunctionByName("MatrixToFloatV")
|
||||
core.addApiFunctionByName("QuaternionAdd")
|
||||
core.addApiFunctionByName("QuaternionAddValue")
|
||||
core.addApiFunctionByName("QuaternionSubtract")
|
||||
core.addApiFunctionByName("QuaternionSubtractValue")
|
||||
core.addApiFunctionByName("QuaternionIdentity")
|
||||
core.addApiFunctionByName("QuaternionLength")
|
||||
core.addApiFunctionByName("QuaternionNormalize")
|
||||
core.addApiFunctionByName("QuaternionInvert")
|
||||
core.addApiFunctionByName("QuaternionMultiply")
|
||||
core.addApiFunctionByName("QuaternionScale")
|
||||
core.addApiFunctionByName("QuaternionDivide")
|
||||
core.addApiFunctionByName("QuaternionLerp")
|
||||
core.addApiFunctionByName("QuaternionNlerp")
|
||||
core.addApiFunctionByName("QuaternionSlerp")
|
||||
core.addApiFunctionByName("QuaternionFromVector3ToVector3")
|
||||
core.addApiFunctionByName("QuaternionFromMatrix")
|
||||
core.addApiFunctionByName("QuaternionToMatrix")
|
||||
core.addApiFunctionByName("QuaternionFromAxisAngle")
|
||||
//core.addApiFunctionByName("QuaternionToAxisAngle")
|
||||
core.addApiFunctionByName("QuaternionFromEuler")
|
||||
core.addApiFunctionByName("QuaternionToEuler")
|
||||
core.addApiFunctionByName("QuaternionTransform")
|
||||
core.addApiFunctionByName("QuaternionEquals")
|
||||
|
||||
api.defines.filter(x => x.type === "COLOR").map(x => ({ name: x.name, description: x.description, values: (x.value.match(/\{([^}]+)\}/) || "")[1].split(',').map(x => x.trim()) })).forEach(x => {
|
||||
core.exportGlobalStruct("Color", x.name, x.values, x.description)
|
||||
|
@ -925,6 +911,7 @@ function main(){
|
|||
api.enums.find(x => x.name === "MouseCursor")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description))
|
||||
api.enums.find(x => x.name === "PixelFormat")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description))
|
||||
api.enums.find(x => x.name === "CameraProjection")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description))
|
||||
api.enums.find(x => x.name === "CameraMode")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description))
|
||||
core.writeTo("src/bindings/js_raylib_core.h")
|
||||
core.typings.writeTo("examples/lib.raylib.d.ts")
|
||||
}
|
||||
|
|
|
@ -110,11 +110,13 @@ export abstract class GenericQuickJsGenerator<T extends QuickJsGenerator> extend
|
|||
break;
|
||||
default:
|
||||
const isConst = type.startsWith('const')
|
||||
const classId = classIds[type.replace("const ", "")]
|
||||
const isPointer = type.endsWith(' *')
|
||||
const classId = classIds[type.replace("const ", "").replace(" *", "")]
|
||||
if(!classId) throw new Error("Cannot convert into parameter type: " + type)
|
||||
this.jsOpqToStructPtr(type, name+"_ptr", src, classId)
|
||||
this.statement(`if(${name}_ptr == NULL) return JS_EXCEPTION`)
|
||||
this.declare(name, type, false, `*${name}_ptr`)
|
||||
const suffix = isPointer ? "" : "_ptr"
|
||||
this.jsOpqToStructPtr(type.replace(" *", ""), name+suffix, src, classId)
|
||||
this.statement(`if(${name+suffix} == NULL) return JS_EXCEPTION`)
|
||||
if(!isPointer) this.declare(name, type, false, `*${name}_ptr`)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ for (const key in rl) {
|
|||
// Translate based on mouse right click
|
||||
if (isMouseButtonDown(MOUSE_BUTTON_RIGHT))
|
||||
{
|
||||
const delta = getMouseDelta();
|
||||
let delta = getMouseDelta();
|
||||
delta = vector2Scale(delta, -1.0/camera.zoom);
|
||||
|
||||
camera.target = vector2Add(camera.target, delta);
|
||||
|
|
|
@ -229,6 +229,8 @@ declare function maximizeWindow(): void;
|
|||
declare function minimizeWindow(): void;
|
||||
/** Set window state: not minimized/maximized (only PLATFORM_DESKTOP) */
|
||||
declare function restoreWindow(): void;
|
||||
/** Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP) */
|
||||
declare function setWindowIcon(image: Image): void;
|
||||
/** Set title for window (only PLATFORM_DESKTOP) */
|
||||
declare function setWindowTitle(title: string): void;
|
||||
/** Set window position on screen (only PLATFORM_DESKTOP) */
|
||||
|
@ -305,6 +307,10 @@ declare function endMode2D(): void;
|
|||
declare function beginMode3D(camera: Camera3D): void;
|
||||
/** Ends 3D mode and returns to default 2D orthographic mode */
|
||||
declare function endMode3D(): void;
|
||||
/** Begin custom shader drawing */
|
||||
declare function beginShaderMode(shader: Shader): void;
|
||||
/** End custom shader drawing (use default shader) */
|
||||
declare function endShaderMode(): void;
|
||||
/** Begin blending mode (alpha, additive, multiplied, subtract, custom) */
|
||||
declare function beginBlendMode(mode: number): void;
|
||||
/** End blending mode (reset to default: alpha blending) */
|
||||
|
@ -313,10 +319,30 @@ declare function endBlendMode(): void;
|
|||
declare function beginScissorMode(x: number, y: number, width: number, height: number): void;
|
||||
/** End scissor mode */
|
||||
declare function endScissorMode(): void;
|
||||
/** Load shader from files and bind default locations */
|
||||
declare function loadShader(vsFileName: string, fsFileName: string): Shader;
|
||||
/** Check if a shader is ready */
|
||||
declare function isShaderReady(shader: Shader): boolean;
|
||||
/** Get shader uniform location */
|
||||
declare function getShaderLocation(shader: Shader, uniformName: string): number;
|
||||
/** Get shader attribute location */
|
||||
declare function getShaderLocationAttrib(shader: Shader, attribName: string): number;
|
||||
/** Set shader uniform value (matrix 4x4) */
|
||||
declare function setShaderValueMatrix(shader: Shader, locIndex: number, mat: Matrix): void;
|
||||
/** Set shader uniform value for texture (sampler2d) */
|
||||
declare function setShaderValueTexture(shader: Shader, locIndex: number, texture: Texture2D): void;
|
||||
/** Get a ray trace from mouse position */
|
||||
declare function getMouseRay(mousePosition: Vector2, camera: Camera): Ray;
|
||||
/** Get camera transform matrix (view matrix) */
|
||||
declare function getCameraMatrix(camera: Camera): Matrix;
|
||||
/** Get camera 2d transform matrix */
|
||||
declare function getCameraMatrix2D(camera: Camera2D): Matrix;
|
||||
/** Get the screen space position for a 3d world space position */
|
||||
declare function getWorldToScreen(position: Vector3, camera: Camera): Vector2;
|
||||
/** Get the world space position for a 2d camera screen space position */
|
||||
declare function getScreenToWorld2D(position: Vector2, camera: Camera2D): Vector2;
|
||||
/** Get size position for a 3d world space position */
|
||||
declare function getWorldToScreenEx(position: Vector3, camera: Camera, width: number, height: number): Vector2;
|
||||
/** Get the screen space position for a 2d camera world space position */
|
||||
declare function getWorldToScreen2D(position: Vector2, camera: Camera2D): Vector2;
|
||||
/** Set target FPS (maximum) */
|
||||
|
@ -463,6 +489,10 @@ declare function getGestureDragAngle(): number;
|
|||
declare function getGesturePinchVector(): Vector2;
|
||||
/** Get gesture pinch angle */
|
||||
declare function getGesturePinchAngle(): number;
|
||||
/** Update camera position for selected mode */
|
||||
declare function updateCamera(camera: Camera *, mode: number): void;
|
||||
/** Update camera movement/rotation */
|
||||
declare function updateCameraPro(camera: Camera *, movement: Vector3, rotation: Vector3, zoom: number): void;
|
||||
/** Draw a pixel */
|
||||
declare function drawPixel(posX: number, posY: number, color: Color): void;
|
||||
/** Draw a pixel (Vector version) */
|
||||
|
@ -583,10 +613,90 @@ declare function imageCopy(image: Image): Image;
|
|||
declare function imageFromImage(image: Image, rec: Rectangle): Image;
|
||||
/** Create an image from text (default font) */
|
||||
declare function imageText(text: string, fontSize: number, color: Color): Image;
|
||||
/** Create an image from text (custom sprite font) */
|
||||
declare function imageTextEx(font: Font, text: string, fontSize: number, spacing: number, tint: Color): Image;
|
||||
/** Convert image data to desired format */
|
||||
declare function imageFormat(image: Image *, newFormat: number): void;
|
||||
/** Convert image to POT (power-of-two) */
|
||||
declare function imageToPOT(image: Image *, fill: Color): void;
|
||||
/** Crop an image to a defined rectangle */
|
||||
declare function imageCrop(image: Image *, crop: Rectangle): void;
|
||||
/** Crop image depending on alpha value */
|
||||
declare function imageAlphaCrop(image: Image *, threshold: number): void;
|
||||
/** Clear alpha channel to desired color */
|
||||
declare function imageAlphaClear(image: Image *, color: Color, threshold: number): void;
|
||||
/** Apply alpha mask to image */
|
||||
declare function imageAlphaMask(image: Image *, alphaMask: Image): void;
|
||||
/** Premultiply alpha channel */
|
||||
declare function imageAlphaPremultiply(image: Image *): void;
|
||||
/** Apply Gaussian blur using a box blur approximation */
|
||||
declare function imageBlurGaussian(image: Image *, blurSize: number): void;
|
||||
/** Resize image (Bicubic scaling algorithm) */
|
||||
declare function imageResize(image: Image *, newWidth: number, newHeight: number): void;
|
||||
/** Resize image (Nearest-Neighbor scaling algorithm) */
|
||||
declare function imageResizeNN(image: Image *, newWidth: number, newHeight: number): void;
|
||||
/** Resize canvas and fill with color */
|
||||
declare function imageResizeCanvas(image: Image *, newWidth: number, newHeight: number, offsetX: number, offsetY: number, fill: Color): void;
|
||||
/** Compute all mipmap levels for a provided image */
|
||||
declare function imageMipmaps(image: Image *): void;
|
||||
/** Dither image data to 16bpp or lower (Floyd-Steinberg dithering) */
|
||||
declare function imageDither(image: Image *, rBpp: number, gBpp: number, bBpp: number, aBpp: number): void;
|
||||
/** Flip image vertically */
|
||||
declare function imageFlipVertical(image: Image *): void;
|
||||
/** Flip image horizontally */
|
||||
declare function imageFlipHorizontal(image: Image *): void;
|
||||
/** Rotate image clockwise 90deg */
|
||||
declare function imageRotateCW(image: Image *): void;
|
||||
/** Rotate image counter-clockwise 90deg */
|
||||
declare function imageRotateCCW(image: Image *): void;
|
||||
/** Modify image color: tint */
|
||||
declare function imageColorTint(image: Image *, color: Color): void;
|
||||
/** Modify image color: invert */
|
||||
declare function imageColorInvert(image: Image *): void;
|
||||
/** Modify image color: grayscale */
|
||||
declare function imageColorGrayscale(image: Image *): void;
|
||||
/** Modify image color: contrast (-100 to 100) */
|
||||
declare function imageColorContrast(image: Image *, contrast: number): void;
|
||||
/** Modify image color: brightness (-255 to 255) */
|
||||
declare function imageColorBrightness(image: Image *, brightness: number): void;
|
||||
/** Modify image color: replace color */
|
||||
declare function imageColorReplace(image: Image *, color: Color, replace: Color): void;
|
||||
/** Get image alpha border rectangle */
|
||||
declare function getImageAlphaBorder(image: Image, threshold: number): Rectangle;
|
||||
/** Get image pixel color at (x, y) position */
|
||||
declare function getImageColor(image: Image, x: number, y: number): Color;
|
||||
/** Clear image background with given color */
|
||||
declare function imageClearBackground(dst: Image *, color: Color): void;
|
||||
/** Draw pixel within an image */
|
||||
declare function imageDrawPixel(dst: Image *, posX: number, posY: number, color: Color): void;
|
||||
/** Draw pixel within an image (Vector version) */
|
||||
declare function imageDrawPixelV(dst: Image *, position: Vector2, color: Color): void;
|
||||
/** Draw line within an image */
|
||||
declare function imageDrawLine(dst: Image *, startPosX: number, startPosY: number, endPosX: number, endPosY: number, color: Color): void;
|
||||
/** Draw line within an image (Vector version) */
|
||||
declare function imageDrawLineV(dst: Image *, start: Vector2, end: Vector2, color: Color): void;
|
||||
/** Draw a filled circle within an image */
|
||||
declare function imageDrawCircle(dst: Image *, centerX: number, centerY: number, radius: number, color: Color): void;
|
||||
/** Draw a filled circle within an image (Vector version) */
|
||||
declare function imageDrawCircleV(dst: Image *, center: Vector2, radius: number, color: Color): void;
|
||||
/** Draw circle outline within an image */
|
||||
declare function imageDrawCircleLines(dst: Image *, centerX: number, centerY: number, radius: number, color: Color): void;
|
||||
/** Draw circle outline within an image (Vector version) */
|
||||
declare function imageDrawCircleLinesV(dst: Image *, center: Vector2, radius: number, color: Color): void;
|
||||
/** Draw rectangle within an image */
|
||||
declare function imageDrawRectangle(dst: Image *, posX: number, posY: number, width: number, height: number, color: Color): void;
|
||||
/** Draw rectangle within an image (Vector version) */
|
||||
declare function imageDrawRectangleV(dst: Image *, position: Vector2, size: Vector2, color: Color): void;
|
||||
/** Draw rectangle within an image */
|
||||
declare function imageDrawRectangleRec(dst: Image *, rec: Rectangle, color: Color): void;
|
||||
/** Draw rectangle lines within an image */
|
||||
declare function imageDrawRectangleLines(dst: Image *, rec: Rectangle, thick: number, color: Color): void;
|
||||
/** Draw a source image within a destination image (tint applied to source) */
|
||||
declare function imageDraw(dst: Image *, src: Image, srcRec: Rectangle, dstRec: Rectangle, tint: Color): void;
|
||||
/** Draw text (using default font) within an image (destination) */
|
||||
declare function imageDrawText(dst: Image *, text: string, posX: number, posY: number, fontSize: number, color: Color): void;
|
||||
/** Draw text (custom sprite font) within an image (destination) */
|
||||
declare function imageDrawTextEx(dst: Image *, font: Font, text: string, position: Vector2, fontSize: number, spacing: number, tint: Color): void;
|
||||
/** Load texture from file into GPU memory (VRAM) */
|
||||
declare function loadTexture(fileName: string): Texture2D;
|
||||
/** Load texture from image data */
|
||||
|
@ -595,6 +705,8 @@ declare function loadTextureFromImage(image: Image): Texture2D;
|
|||
declare function loadTextureCubemap(image: Image, layout: number): TextureCubemap;
|
||||
/** Check if a texture is ready */
|
||||
declare function isTextureReady(texture: Texture2D): boolean;
|
||||
/** Generate GPU mipmaps for a texture */
|
||||
declare function genTextureMipmaps(texture: Texture2D *): void;
|
||||
/** Set texture scaling filter mode */
|
||||
declare function setTextureFilter(texture: Texture2D, filter: number): void;
|
||||
/** Set texture wrapping mode */
|
||||
|
@ -725,10 +837,14 @@ declare function drawBillboard(camera: Camera, texture: Texture2D, position: Vec
|
|||
declare function drawBillboardRec(camera: Camera, texture: Texture2D, source: Rectangle, position: Vector3, size: Vector2, tint: Color): void;
|
||||
/** Draw a billboard texture defined by source and rotation */
|
||||
declare function drawBillboardPro(camera: Camera, texture: Texture2D, source: Rectangle, position: Vector3, up: Vector3, size: Vector2, origin: Vector2, rotation: number, tint: Color): void;
|
||||
/** Upload mesh vertex data in GPU and provide VAO/VBO ids */
|
||||
declare function uploadMesh(mesh: Mesh *, dynamic: boolean): void;
|
||||
/** Export mesh data to file, returns true on success */
|
||||
declare function exportMesh(mesh: Mesh, fileName: string): boolean;
|
||||
/** Compute mesh bounding box limits */
|
||||
declare function getMeshBoundingBox(mesh: Mesh): BoundingBox;
|
||||
/** Compute mesh tangents */
|
||||
declare function genMeshTangents(mesh: Mesh *): void;
|
||||
/** Generate polygonal mesh */
|
||||
declare function genMeshPoly(sides: number, radius: number): Mesh;
|
||||
/** Generate plane mesh (with subdivisions) */
|
||||
|
@ -805,6 +921,10 @@ declare function setSoundPitch(sound: Sound, pitch: number): void;
|
|||
declare function setSoundPan(sound: Sound, pan: number): void;
|
||||
/** Copy a wave to a new wave */
|
||||
declare function waveCopy(wave: Wave): Wave;
|
||||
/** Crop a wave to defined samples range */
|
||||
declare function waveCrop(wave: Wave *, initSample: number, finalSample: number): void;
|
||||
/** Convert wave data to desired format */
|
||||
declare function waveFormat(wave: Wave *, sampleRate: number, sampleSize: number, channels: number): void;
|
||||
/** Load music stream from file */
|
||||
declare function loadMusicStream(fileName: string): Music;
|
||||
/** Checks if a music stream is ready */
|
||||
|
@ -907,6 +1027,148 @@ declare function vector3One(): Vector3;
|
|||
declare function vector3Add(v1: Vector3, v2: Vector3): Vector3;
|
||||
/** */
|
||||
declare function vector3AddValue(v: Vector3, add: number): Vector3;
|
||||
/** */
|
||||
declare function vector3Subtract(v1: Vector3, v2: Vector3): Vector3;
|
||||
/** */
|
||||
declare function vector3SubtractValue(v: Vector3, sub: number): Vector3;
|
||||
/** */
|
||||
declare function vector3Scale(v: Vector3, scalar: number): Vector3;
|
||||
/** */
|
||||
declare function vector3Multiply(v1: Vector3, v2: Vector3): Vector3;
|
||||
/** */
|
||||
declare function vector3CrossProduct(v1: Vector3, v2: Vector3): Vector3;
|
||||
/** */
|
||||
declare function vector3Perpendicular(v: Vector3): Vector3;
|
||||
/** */
|
||||
declare function vector3Length(v: const Vector3): number;
|
||||
/** */
|
||||
declare function vector3LengthSqr(v: const Vector3): number;
|
||||
/** */
|
||||
declare function vector3DotProduct(v1: Vector3, v2: Vector3): number;
|
||||
/** */
|
||||
declare function vector3Distance(v1: Vector3, v2: Vector3): number;
|
||||
/** */
|
||||
declare function vector3DistanceSqr(v1: Vector3, v2: Vector3): number;
|
||||
/** */
|
||||
declare function vector3Angle(v1: Vector3, v2: Vector3): number;
|
||||
/** */
|
||||
declare function vector3Negate(v: Vector3): Vector3;
|
||||
/** */
|
||||
declare function vector3Divide(v1: Vector3, v2: Vector3): Vector3;
|
||||
/** */
|
||||
declare function vector3Normalize(v: Vector3): Vector3;
|
||||
/** */
|
||||
declare function vector3Transform(v: Vector3, mat: Matrix): Vector3;
|
||||
/** */
|
||||
declare function vector3RotateByQuaternion(v: Vector3, q: Quaternion): Vector3;
|
||||
/** */
|
||||
declare function vector3RotateByAxisAngle(v: Vector3, axis: Vector3, angle: number): Vector3;
|
||||
/** */
|
||||
declare function vector3Lerp(v1: Vector3, v2: Vector3, amount: number): Vector3;
|
||||
/** */
|
||||
declare function vector3Reflect(v: Vector3, normal: Vector3): Vector3;
|
||||
/** */
|
||||
declare function vector3Min(v1: Vector3, v2: Vector3): Vector3;
|
||||
/** */
|
||||
declare function vector3Max(v1: Vector3, v2: Vector3): Vector3;
|
||||
/** */
|
||||
declare function vector3Barycenter(p: Vector3, a: Vector3, b: Vector3, c: Vector3): Vector3;
|
||||
/** */
|
||||
declare function vector3Unproject(source: Vector3, projection: Matrix, view: Matrix): Vector3;
|
||||
/** */
|
||||
declare function vector3Invert(v: Vector3): Vector3;
|
||||
/** */
|
||||
declare function vector3Clamp(v: Vector3, min: Vector3, max: Vector3): Vector3;
|
||||
/** */
|
||||
declare function vector3ClampValue(v: Vector3, min: number, max: number): Vector3;
|
||||
/** */
|
||||
declare function vector3Equals(p: Vector3, q: Vector3): number;
|
||||
/** */
|
||||
declare function vector3Refract(v: Vector3, n: Vector3, r: number): Vector3;
|
||||
/** */
|
||||
declare function matrixDeterminant(mat: Matrix): number;
|
||||
/** */
|
||||
declare function matrixTrace(mat: Matrix): number;
|
||||
/** */
|
||||
declare function matrixTranspose(mat: Matrix): Matrix;
|
||||
/** */
|
||||
declare function matrixInvert(mat: Matrix): Matrix;
|
||||
/** */
|
||||
declare function matrixIdentity(): Matrix;
|
||||
/** */
|
||||
declare function matrixAdd(left: Matrix, right: Matrix): Matrix;
|
||||
/** */
|
||||
declare function matrixSubtract(left: Matrix, right: Matrix): Matrix;
|
||||
/** */
|
||||
declare function matrixMultiply(left: Matrix, right: Matrix): Matrix;
|
||||
/** */
|
||||
declare function matrixTranslate(x: number, y: number, z: number): Matrix;
|
||||
/** */
|
||||
declare function matrixRotate(axis: Vector3, angle: number): Matrix;
|
||||
/** */
|
||||
declare function matrixRotateX(angle: number): Matrix;
|
||||
/** */
|
||||
declare function matrixRotateY(angle: number): Matrix;
|
||||
/** */
|
||||
declare function matrixRotateZ(angle: number): Matrix;
|
||||
/** */
|
||||
declare function matrixRotateXYZ(angle: Vector3): Matrix;
|
||||
/** */
|
||||
declare function matrixRotateZYX(angle: Vector3): Matrix;
|
||||
/** */
|
||||
declare function matrixScale(x: number, y: number, z: number): Matrix;
|
||||
/** */
|
||||
declare function matrixFrustum(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix;
|
||||
/** */
|
||||
declare function matrixPerspective(fovy: number, aspect: number, near: number, far: number): Matrix;
|
||||
/** */
|
||||
declare function matrixOrtho(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix;
|
||||
/** */
|
||||
declare function matrixLookAt(eye: Vector3, target: Vector3, up: Vector3): Matrix;
|
||||
/** */
|
||||
declare function quaternionAdd(q1: Quaternion, q2: Quaternion): Quaternion;
|
||||
/** */
|
||||
declare function quaternionAddValue(q: Quaternion, add: number): Quaternion;
|
||||
/** */
|
||||
declare function quaternionSubtract(q1: Quaternion, q2: Quaternion): Quaternion;
|
||||
/** */
|
||||
declare function quaternionSubtractValue(q: Quaternion, sub: number): Quaternion;
|
||||
/** */
|
||||
declare function quaternionIdentity(): Quaternion;
|
||||
/** */
|
||||
declare function quaternionLength(q: Quaternion): number;
|
||||
/** */
|
||||
declare function quaternionNormalize(q: Quaternion): Quaternion;
|
||||
/** */
|
||||
declare function quaternionInvert(q: Quaternion): Quaternion;
|
||||
/** */
|
||||
declare function quaternionMultiply(q1: Quaternion, q2: Quaternion): Quaternion;
|
||||
/** */
|
||||
declare function quaternionScale(q: Quaternion, mul: number): Quaternion;
|
||||
/** */
|
||||
declare function quaternionDivide(q1: Quaternion, q2: Quaternion): Quaternion;
|
||||
/** */
|
||||
declare function quaternionLerp(q1: Quaternion, q2: Quaternion, amount: number): Quaternion;
|
||||
/** */
|
||||
declare function quaternionNlerp(q1: Quaternion, q2: Quaternion, amount: number): Quaternion;
|
||||
/** */
|
||||
declare function quaternionSlerp(q1: Quaternion, q2: Quaternion, amount: number): Quaternion;
|
||||
/** */
|
||||
declare function quaternionFromVector3ToVector3(from: Vector3, to: Vector3): Quaternion;
|
||||
/** */
|
||||
declare function quaternionFromMatrix(mat: Matrix): Quaternion;
|
||||
/** */
|
||||
declare function quaternionToMatrix(q: Quaternion): Matrix;
|
||||
/** */
|
||||
declare function quaternionFromAxisAngle(axis: Vector3, angle: number): Quaternion;
|
||||
/** */
|
||||
declare function quaternionFromEuler(pitch: number, yaw: number, roll: number): Quaternion;
|
||||
/** */
|
||||
declare function quaternionToEuler(q: Quaternion): Vector3;
|
||||
/** */
|
||||
declare function quaternionTransform(q: Quaternion, mat: Matrix): Quaternion;
|
||||
/** */
|
||||
declare function quaternionEquals(p: Quaternion, q: Quaternion): number;
|
||||
/** Light Gray */
|
||||
declare var LIGHTGRAY: Color;
|
||||
/** Gray */
|
||||
|
@ -1323,3 +1585,13 @@ declare var PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA: number;
|
|||
declare var CAMERA_PERSPECTIVE: number;
|
||||
/** Orthographic projection */
|
||||
declare var CAMERA_ORTHOGRAPHIC: number;
|
||||
/** Custom camera */
|
||||
declare var CAMERA_CUSTOM: number;
|
||||
/** Free camera */
|
||||
declare var CAMERA_FREE: number;
|
||||
/** Orbital camera */
|
||||
declare var CAMERA_ORBITAL: number;
|
||||
/** First person camera */
|
||||
declare var CAMERA_FIRST_PERSON: number;
|
||||
/** Third person camera */
|
||||
declare var CAMERA_THIRD_PERSON: number;
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const screenWidth = 800;
|
||||
const screenHeight = 450;
|
||||
|
||||
setConfigFlags(FLAG_WINDOW_RESIZABLE);
|
||||
initWindow(screenWidth, screenHeight, "raylib [shaders] example - raymarching shapes");
|
||||
|
||||
const position = new Vector3(2.5, 2.5, 3.0); // Camera position
|
||||
const target = new Vector3(0.0, 0.0, 0.7); // Camera looking at point
|
||||
const up = new Vector3(0.0, 1.0, 0.0); // Camera up vector (rotation towards target)
|
||||
const fovy = 65.0; // Camera field-of-view Y
|
||||
const projection = CAMERA_PERSPECTIVE; // Camera projection type
|
||||
const camera = new Camera3D(position,target, up, fovy, projection)
|
||||
|
||||
// Load raymarching shader
|
||||
// NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader
|
||||
const shader = loadShader(0, "assets/shaders/glsl330/raymarching.fs");
|
||||
|
||||
// Get shader locations for required uniforms
|
||||
const viewEyeLoc = getShaderLocation(shader, "viewEye");
|
||||
const viewCenterLoc = getShaderLocation(shader, "viewCenter");
|
||||
const runTimeLoc = getShaderLocation(shader, "runTime");
|
||||
const resolutionLoc = getShaderLocation(shader, "resolution");
|
||||
|
||||
let resolution = new Vector2(screenWidth, screenHeight);
|
||||
setShaderValue(shader, resolutionLoc, resolution, SHADER_UNIFORM_VEC2);
|
||||
|
||||
let runTime = 0.0;
|
||||
|
||||
disableCursor(); // Limit cursor to relative movement inside the window
|
||||
setTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!windowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
updateCamera(camera, CAMERA_FIRST_PERSON);
|
||||
|
||||
const deltaTime = getFrameTime();
|
||||
runTime += deltaTime;
|
||||
|
||||
// Set shader required uniform values
|
||||
setShaderValue(shader, viewEyeLoc, position, SHADER_UNIFORM_VEC3);
|
||||
setShaderValue(shader, viewCenterLoc, target, SHADER_UNIFORM_VEC3);
|
||||
setShaderValue(shader, runTimeLoc, runTime, SHADER_UNIFORM_FLOAT);
|
||||
|
||||
// Check if screen is resized
|
||||
if (isWindowResized())
|
||||
{
|
||||
resolution = new Vector2(getScreenWidth(),getScreenHeight())
|
||||
setShaderValue(shader, resolutionLoc, resolution, SHADER_UNIFORM_VEC2);
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
beginDrawing();
|
||||
|
||||
clearBackground(RAYWHITE);
|
||||
|
||||
// We only draw a white full-screen rectangle,
|
||||
// frame is generated in shader using raymarching
|
||||
beginShaderMode(shader);
|
||||
drawRectangle(0, 0, getScreenWidth(), getScreenHeight(), WHITE);
|
||||
endShaderMode();
|
||||
|
||||
drawText("(c) Raymarching shader by Iñigo Quilez. MIT License.", getScreenWidth() - 280, getScreenHeight() - 20, 10, BLACK);
|
||||
|
||||
endDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
closeWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
|
@ -379,12 +379,15 @@ class GenericQuickJsGenerator extends generation_1.GenericCodeGenerator {
|
|||
break;
|
||||
default:
|
||||
const isConst = type.startsWith('const');
|
||||
const classId = classIds[type.replace("const ", "")];
|
||||
const isPointer = type.endsWith(' *');
|
||||
const classId = classIds[type.replace("const ", "").replace(" *", "")];
|
||||
if (!classId)
|
||||
throw new Error("Cannot convert into parameter type: " + type);
|
||||
this.jsOpqToStructPtr(type, name + "_ptr", src, classId);
|
||||
this.statement(`if(${name}_ptr == NULL) return JS_EXCEPTION`);
|
||||
this.declare(name, type, false, `*${name}_ptr`);
|
||||
const suffix = isPointer ? "" : "_ptr";
|
||||
this.jsOpqToStructPtr(type.replace(" *", ""), name + suffix, src, classId);
|
||||
this.statement(`if(${name + suffix} == NULL) return JS_EXCEPTION`);
|
||||
if (!isPointer)
|
||||
this.declare(name, type, false, `*${name}_ptr`);
|
||||
}
|
||||
}
|
||||
jsToJs(type, name, src, classIds = {}) {
|
||||
|
@ -990,7 +993,7 @@ function main() {
|
|||
core.addApiFunctionByName("MaximizeWindow");
|
||||
core.addApiFunctionByName("MinimizeWindow");
|
||||
core.addApiFunctionByName("RestoreWindow");
|
||||
// SetWindowIcon
|
||||
core.addApiFunctionByName("SetWindowIcon");
|
||||
// SetWindowIcons
|
||||
core.addApiFunctionByName("SetWindowTitle");
|
||||
core.addApiFunctionByName("SetWindowPosition");
|
||||
|
@ -1037,8 +1040,8 @@ function main() {
|
|||
core.addApiFunctionByName("EndMode3D");
|
||||
//core.addApiFunctionByName("BeginTextureMode")
|
||||
//core.addApiFunctionByName("EndTextureMode")
|
||||
//core.addApiFunctionByName("BeginShaderMode")
|
||||
//core.addApiFunctionByName("EndShaderMode")
|
||||
core.addApiFunctionByName("BeginShaderMode");
|
||||
core.addApiFunctionByName("EndShaderMode");
|
||||
core.addApiFunctionByName("BeginBlendMode");
|
||||
core.addApiFunctionByName("EndBlendMode");
|
||||
core.addApiFunctionByName("BeginScissorMode");
|
||||
|
@ -1049,23 +1052,23 @@ function main() {
|
|||
//core.addApiFunctionByName("LoadVrStereoConfig")
|
||||
//core.addApiFunctionByName("UnloadVrStereoConfig")
|
||||
// Shader Management
|
||||
// core.addApiFunctionByName("LoadShader")
|
||||
core.addApiFunctionByName("LoadShader");
|
||||
// core.addApiFunctionByName("LoadShaderFromMemory")
|
||||
// core.addApiFunctionByName("IsShaderReady")
|
||||
// core.addApiFunctionByName("GetShaderLocation")
|
||||
// core.addApiFunctionByName("GetShaderLocationAttrib")
|
||||
core.addApiFunctionByName("IsShaderReady");
|
||||
core.addApiFunctionByName("GetShaderLocation");
|
||||
core.addApiFunctionByName("GetShaderLocationAttrib");
|
||||
// core.addApiFunctionByName("SetShaderValue")
|
||||
// core.addApiFunctionByName("SetShaderValueV")
|
||||
// core.addApiFunctionByName("SetShaderValueMatrix")
|
||||
// core.addApiFunctionByName("SetShaderValueTexture")
|
||||
// // "UnloadShader" is destructor
|
||||
core.addApiFunctionByName("SetShaderValueMatrix");
|
||||
core.addApiFunctionByName("SetShaderValueTexture");
|
||||
// "UnloadShader" called by finalizer
|
||||
// ScreenSpaceRelatedFunctions
|
||||
//core.addApiFunctionByName("GetMouseRay")
|
||||
//core.addApiFunctionByName("GetCameraMatrix")
|
||||
core.addApiFunctionByName("GetMouseRay");
|
||||
core.addApiFunctionByName("GetCameraMatrix");
|
||||
core.addApiFunctionByName("GetCameraMatrix2D");
|
||||
//core.addApiFunctionByName("GetWorldToScreen")
|
||||
core.addApiFunctionByName("GetWorldToScreen");
|
||||
core.addApiFunctionByName("GetScreenToWorld2D");
|
||||
//core.addApiFunctionByName("GetScreenToWorldEx")
|
||||
core.addApiFunctionByName("GetWorldToScreenEx");
|
||||
core.addApiFunctionByName("GetWorldToScreen2D");
|
||||
// Timing related functions
|
||||
core.addApiFunctionByName("SetTargetFPS");
|
||||
|
@ -1169,8 +1172,8 @@ function main() {
|
|||
core.addApiFunctionByName("GetGesturePinchVector");
|
||||
core.addApiFunctionByName("GetGesturePinchAngle");
|
||||
// Camera system functions
|
||||
// core.addApiFunctionByName("UpdateCamera")
|
||||
// core.addApiFunctionByName("UpdateCameraPro")
|
||||
core.addApiFunctionByName("UpdateCamera");
|
||||
core.addApiFunctionByName("UpdateCameraPro");
|
||||
//api.functions.forEach(x => console.log(`core.addApiFunctionByName("${x.name}")`))
|
||||
// module: rshapes
|
||||
// TODO: Do we need ref-counting here?
|
||||
|
@ -1250,53 +1253,53 @@ function main() {
|
|||
core.addApiFunctionByName("ImageCopy");
|
||||
core.addApiFunctionByName("ImageFromImage");
|
||||
core.addApiFunctionByName("ImageText");
|
||||
// core.addApiFunctionByName("ImageTextEx")
|
||||
// core.addApiFunctionByName("ImageFormat")
|
||||
// core.addApiFunctionByName("ImageToPOT")
|
||||
// core.addApiFunctionByName("ImageCrop")
|
||||
// core.addApiFunctionByName("ImageAlphaCrop")
|
||||
// core.addApiFunctionByName("ImageAlphaClear")
|
||||
// core.addApiFunctionByName("ImageAlphaMask")
|
||||
// core.addApiFunctionByName("ImageAlphaPremultiply")
|
||||
// core.addApiFunctionByName("ImageBlurGaussian")
|
||||
// core.addApiFunctionByName("ImageResize")
|
||||
// core.addApiFunctionByName("ImageResizeNN")
|
||||
// core.addApiFunctionByName("ImageResizeCanvas")
|
||||
// core.addApiFunctionByName("ImageMipmaps")
|
||||
// core.addApiFunctionByName("ImageDither")
|
||||
// core.addApiFunctionByName("ImageFlipVertical")
|
||||
// core.addApiFunctionByName("ImageFlipHorizontal")
|
||||
// core.addApiFunctionByName("ImageRotateCW")
|
||||
// core.addApiFunctionByName("ImageRotateCCW")
|
||||
// core.addApiFunctionByName("ImageColorTint")
|
||||
// core.addApiFunctionByName("ImageColorInvert")
|
||||
// core.addApiFunctionByName("ImageColorGrayscale")
|
||||
// core.addApiFunctionByName("ImageColorContrast")
|
||||
// core.addApiFunctionByName("ImageColorBrightness")
|
||||
// core.addApiFunctionByName("ImageColorReplace")
|
||||
// core.addApiFunctionByName("LoadImageColors")
|
||||
// core.addApiFunctionByName("LoadImagePalette")
|
||||
// core.addApiFunctionByName("UnloadImageColors")
|
||||
// core.addApiFunctionByName("UnloadImagePalette")
|
||||
core.addApiFunctionByName("ImageTextEx");
|
||||
core.addApiFunctionByName("ImageFormat");
|
||||
core.addApiFunctionByName("ImageToPOT");
|
||||
core.addApiFunctionByName("ImageCrop");
|
||||
core.addApiFunctionByName("ImageAlphaCrop");
|
||||
core.addApiFunctionByName("ImageAlphaClear");
|
||||
core.addApiFunctionByName("ImageAlphaMask");
|
||||
core.addApiFunctionByName("ImageAlphaPremultiply");
|
||||
core.addApiFunctionByName("ImageBlurGaussian");
|
||||
core.addApiFunctionByName("ImageResize");
|
||||
core.addApiFunctionByName("ImageResizeNN");
|
||||
core.addApiFunctionByName("ImageResizeCanvas");
|
||||
core.addApiFunctionByName("ImageMipmaps");
|
||||
core.addApiFunctionByName("ImageDither");
|
||||
core.addApiFunctionByName("ImageFlipVertical");
|
||||
core.addApiFunctionByName("ImageFlipHorizontal");
|
||||
core.addApiFunctionByName("ImageRotateCW");
|
||||
core.addApiFunctionByName("ImageRotateCCW");
|
||||
core.addApiFunctionByName("ImageColorTint");
|
||||
core.addApiFunctionByName("ImageColorInvert");
|
||||
core.addApiFunctionByName("ImageColorGrayscale");
|
||||
core.addApiFunctionByName("ImageColorContrast");
|
||||
core.addApiFunctionByName("ImageColorBrightness");
|
||||
core.addApiFunctionByName("ImageColorReplace");
|
||||
//core.addApiFunctionByName("LoadImageColors")
|
||||
//core.addApiFunctionByName("LoadImagePalette")
|
||||
//core.addApiFunctionByName("UnloadImageColors")
|
||||
//core.addApiFunctionByName("UnloadImagePalette")
|
||||
core.addApiFunctionByName("GetImageAlphaBorder");
|
||||
core.addApiFunctionByName("GetImageColor");
|
||||
// Image drawing functions
|
||||
// core.addApiFunctionByName("ImageClearBackground")
|
||||
// core.addApiFunctionByName("ImageDrawPixel")
|
||||
// core.addApiFunctionByName("ImageDrawPixelV")
|
||||
// core.addApiFunctionByName("ImageDrawLine")
|
||||
// core.addApiFunctionByName("ImageDrawLineV")
|
||||
// core.addApiFunctionByName("ImageDrawCircle")
|
||||
// core.addApiFunctionByName("ImageDrawCircleV")
|
||||
// core.addApiFunctionByName("ImageDrawCircleLines")
|
||||
// core.addApiFunctionByName("ImageDrawCircleLinesV")
|
||||
// core.addApiFunctionByName("ImageDrawRectangle")
|
||||
// core.addApiFunctionByName("ImageDrawRectangleV")
|
||||
// core.addApiFunctionByName("ImageDrawRectangleRec")
|
||||
// core.addApiFunctionByName("ImageDrawRectangleLines")
|
||||
// core.addApiFunctionByName("ImageDraw")
|
||||
// core.addApiFunctionByName("ImageDrawText")
|
||||
// core.addApiFunctionByName("ImageDrawTextEx")
|
||||
core.addApiFunctionByName("ImageClearBackground");
|
||||
core.addApiFunctionByName("ImageDrawPixel");
|
||||
core.addApiFunctionByName("ImageDrawPixelV");
|
||||
core.addApiFunctionByName("ImageDrawLine");
|
||||
core.addApiFunctionByName("ImageDrawLineV");
|
||||
core.addApiFunctionByName("ImageDrawCircle");
|
||||
core.addApiFunctionByName("ImageDrawCircleV");
|
||||
core.addApiFunctionByName("ImageDrawCircleLines");
|
||||
core.addApiFunctionByName("ImageDrawCircleLinesV");
|
||||
core.addApiFunctionByName("ImageDrawRectangle");
|
||||
core.addApiFunctionByName("ImageDrawRectangleV");
|
||||
core.addApiFunctionByName("ImageDrawRectangleRec");
|
||||
core.addApiFunctionByName("ImageDrawRectangleLines");
|
||||
core.addApiFunctionByName("ImageDraw");
|
||||
core.addApiFunctionByName("ImageDrawText");
|
||||
core.addApiFunctionByName("ImageDrawTextEx");
|
||||
// Texture loading functions
|
||||
core.addApiFunctionByName("LoadTexture");
|
||||
core.addApiFunctionByName("LoadTextureFromImage");
|
||||
|
@ -1309,7 +1312,7 @@ function main() {
|
|||
// core.addApiFunctionByName("UpdateTexture")
|
||||
// core.addApiFunctionByName("UpdateTextureRec")
|
||||
// Texture configuration functions
|
||||
// core.addApiFunctionByName("GenTextureMipmaps")
|
||||
core.addApiFunctionByName("GenTextureMipmaps");
|
||||
core.addApiFunctionByName("SetTextureFilter");
|
||||
core.addApiFunctionByName("SetTextureWrap");
|
||||
// Texture drawing functions
|
||||
|
@ -1373,22 +1376,7 @@ function main() {
|
|||
// core.addApiFunctionByName("GetCodepointPrevious")
|
||||
// core.addApiFunctionByName("CodepointToUTF8")
|
||||
// Text strings management functions (no UTF-8 strings, only byte chars)
|
||||
// Probably not needed
|
||||
// core.addApiFunctionByName("TextCopy")
|
||||
// core.addApiFunctionByName("TextIsEqual")
|
||||
// core.addApiFunctionByName("TextLength")
|
||||
// core.addApiFunctionByName("TextFormat")
|
||||
// core.addApiFunctionByName("TextSubtext")
|
||||
// core.addApiFunctionByName("TextReplace")
|
||||
// core.addApiFunctionByName("TextInsert")
|
||||
// core.addApiFunctionByName("TextJoin")
|
||||
// core.addApiFunctionByName("TextSplit")
|
||||
// core.addApiFunctionByName("TextAppend")
|
||||
// core.addApiFunctionByName("TextFindIndex")
|
||||
// core.addApiFunctionByName("TextToUpper")
|
||||
// core.addApiFunctionByName("TextToLower")
|
||||
// core.addApiFunctionByName("TextToPascal")
|
||||
// core.addApiFunctionByName("TextToInteger")
|
||||
// Not supported, use JS Stdlib instead
|
||||
// module: rmodels
|
||||
// Basic geometric 3D shapes drawing functions
|
||||
core.addApiFunctionByName("DrawLine3D");
|
||||
|
@ -1428,14 +1416,15 @@ function main() {
|
|||
core.addApiFunctionByName("DrawBillboardRec");
|
||||
core.addApiFunctionByName("DrawBillboardPro");
|
||||
// Mesh management functions
|
||||
// core.addApiFunctionByName("UploadMesh")
|
||||
// TODO: Refcounting needed?
|
||||
core.addApiFunctionByName("UploadMesh");
|
||||
// core.addApiFunctionByName("UpdateMeshBuffer")
|
||||
// "UnloadMesh" called by finalizer
|
||||
//core.addApiFunctionByName("DrawMesh")
|
||||
// core.addApiFunctionByName("DrawMeshInstanced")
|
||||
core.addApiFunctionByName("ExportMesh");
|
||||
core.addApiFunctionByName("GetMeshBoundingBox");
|
||||
// core.addApiFunctionByName("GenMeshTangents")
|
||||
core.addApiFunctionByName("GenMeshTangents");
|
||||
// Mesh generation functions
|
||||
core.addApiFunctionByName("GenMeshPoly");
|
||||
core.addApiFunctionByName("GenMeshPlane");
|
||||
|
@ -1498,8 +1487,8 @@ function main() {
|
|||
core.addApiFunctionByName("SetSoundPitch");
|
||||
core.addApiFunctionByName("SetSoundPan");
|
||||
core.addApiFunctionByName("WaveCopy");
|
||||
// core.addApiFunctionByName("WaveCrop")
|
||||
// core.addApiFunctionByName("WaveFormat")
|
||||
core.addApiFunctionByName("WaveCrop");
|
||||
core.addApiFunctionByName("WaveFormat");
|
||||
// core.addApiFunctionByName("LoadWaveSamples")
|
||||
// core.addApiFunctionByName("UnloadWaveSamples")
|
||||
// Music management functions
|
||||
|
@ -1577,81 +1566,81 @@ function main() {
|
|||
core.addApiFunctionByName("Vector3One");
|
||||
core.addApiFunctionByName("Vector3Add");
|
||||
core.addApiFunctionByName("Vector3AddValue");
|
||||
// core.addApiFunctionByName("Vector3Subtract")
|
||||
// core.addApiFunctionByName("Vector3SubtractValue")
|
||||
// core.addApiFunctionByName("Vector3Scale")
|
||||
// core.addApiFunctionByName("Vector3Multiply")
|
||||
// core.addApiFunctionByName("Vector3CrossProduct")
|
||||
// core.addApiFunctionByName("Vector3Perpendicular")
|
||||
// core.addApiFunctionByName("Vector3Length")
|
||||
// core.addApiFunctionByName("Vector3LengthSqr")
|
||||
// core.addApiFunctionByName("Vector3DotProduct")
|
||||
// core.addApiFunctionByName("Vector3Distance")
|
||||
// core.addApiFunctionByName("Vector3DistanceSqr")
|
||||
// core.addApiFunctionByName("Vector3Angle")
|
||||
// core.addApiFunctionByName("Vector3Negate")
|
||||
// core.addApiFunctionByName("Vector3Divide")
|
||||
// core.addApiFunctionByName("Vector3Normalize")
|
||||
// core.addApiFunctionByName("Vector3OrthoNormalize")
|
||||
// core.addApiFunctionByName("Vector3Transform")
|
||||
// core.addApiFunctionByName("Vector3RotateByQuaternion")
|
||||
// core.addApiFunctionByName("Vector3RotateByAxisAngle")
|
||||
// core.addApiFunctionByName("Vector3Lerp")
|
||||
// core.addApiFunctionByName("Vector3Reflect")
|
||||
// core.addApiFunctionByName("Vector3Min")
|
||||
// core.addApiFunctionByName("Vector3Max")
|
||||
// core.addApiFunctionByName("Vector3Barycenter")
|
||||
// core.addApiFunctionByName("Vector3Unproject")
|
||||
// core.addApiFunctionByName("Vector3ToFloatV")
|
||||
// core.addApiFunctionByName("Vector3Invert")
|
||||
// core.addApiFunctionByName("Vector3Clamp")
|
||||
// core.addApiFunctionByName("Vector3ClampValue")
|
||||
// core.addApiFunctionByName("Vector3Equals")
|
||||
// core.addApiFunctionByName("Vector3Refract")
|
||||
// core.addApiFunctionByName("MatrixDeterminant")
|
||||
// core.addApiFunctionByName("MatrixTrace")
|
||||
// core.addApiFunctionByName("MatrixTranspose")
|
||||
// core.addApiFunctionByName("MatrixInvert")
|
||||
// core.addApiFunctionByName("MatrixIdentity")
|
||||
// core.addApiFunctionByName("MatrixAdd")
|
||||
// core.addApiFunctionByName("MatrixSubtract")
|
||||
// core.addApiFunctionByName("MatrixMultiply")
|
||||
// core.addApiFunctionByName("MatrixTranslate")
|
||||
// core.addApiFunctionByName("MatrixRotate")
|
||||
// core.addApiFunctionByName("MatrixRotateX")
|
||||
// core.addApiFunctionByName("MatrixRotateY")
|
||||
// core.addApiFunctionByName("MatrixRotateZ")
|
||||
// core.addApiFunctionByName("MatrixRotateXYZ")
|
||||
// core.addApiFunctionByName("MatrixRotateZYX")
|
||||
// core.addApiFunctionByName("MatrixScale")
|
||||
// core.addApiFunctionByName("MatrixFrustum")
|
||||
// core.addApiFunctionByName("MatrixPerspective")
|
||||
// core.addApiFunctionByName("MatrixOrtho")
|
||||
// core.addApiFunctionByName("MatrixLookAt")
|
||||
// core.addApiFunctionByName("MatrixToFloatV")
|
||||
// core.addApiFunctionByName("QuaternionAdd")
|
||||
// core.addApiFunctionByName("QuaternionAddValue")
|
||||
// core.addApiFunctionByName("QuaternionSubtract")
|
||||
// core.addApiFunctionByName("QuaternionSubtractValue")
|
||||
// core.addApiFunctionByName("QuaternionIdentity")
|
||||
// core.addApiFunctionByName("QuaternionLength")
|
||||
// core.addApiFunctionByName("QuaternionNormalize")
|
||||
// core.addApiFunctionByName("QuaternionInvert")
|
||||
// core.addApiFunctionByName("QuaternionMultiply")
|
||||
// core.addApiFunctionByName("QuaternionScale")
|
||||
// core.addApiFunctionByName("QuaternionDivide")
|
||||
// core.addApiFunctionByName("QuaternionLerp")
|
||||
// core.addApiFunctionByName("QuaternionNlerp")
|
||||
// core.addApiFunctionByName("QuaternionSlerp")
|
||||
// core.addApiFunctionByName("QuaternionFromVector3ToVector3")
|
||||
// core.addApiFunctionByName("QuaternionFromMatrix")
|
||||
// core.addApiFunctionByName("QuaternionToMatrix")
|
||||
// core.addApiFunctionByName("QuaternionFromAxisAngle")
|
||||
// core.addApiFunctionByName("QuaternionToAxisAngle")
|
||||
// core.addApiFunctionByName("QuaternionFromEuler")
|
||||
// core.addApiFunctionByName("QuaternionToEuler")
|
||||
// core.addApiFunctionByName("QuaternionTransform")
|
||||
// core.addApiFunctionByName("QuaternionEquals")
|
||||
core.addApiFunctionByName("Vector3Subtract");
|
||||
core.addApiFunctionByName("Vector3SubtractValue");
|
||||
core.addApiFunctionByName("Vector3Scale");
|
||||
core.addApiFunctionByName("Vector3Multiply");
|
||||
core.addApiFunctionByName("Vector3CrossProduct");
|
||||
core.addApiFunctionByName("Vector3Perpendicular");
|
||||
core.addApiFunctionByName("Vector3Length");
|
||||
core.addApiFunctionByName("Vector3LengthSqr");
|
||||
core.addApiFunctionByName("Vector3DotProduct");
|
||||
core.addApiFunctionByName("Vector3Distance");
|
||||
core.addApiFunctionByName("Vector3DistanceSqr");
|
||||
core.addApiFunctionByName("Vector3Angle");
|
||||
core.addApiFunctionByName("Vector3Negate");
|
||||
core.addApiFunctionByName("Vector3Divide");
|
||||
core.addApiFunctionByName("Vector3Normalize");
|
||||
//core.addApiFunctionByName("Vector3OrthoNormalize")
|
||||
core.addApiFunctionByName("Vector3Transform");
|
||||
core.addApiFunctionByName("Vector3RotateByQuaternion");
|
||||
core.addApiFunctionByName("Vector3RotateByAxisAngle");
|
||||
core.addApiFunctionByName("Vector3Lerp");
|
||||
core.addApiFunctionByName("Vector3Reflect");
|
||||
core.addApiFunctionByName("Vector3Min");
|
||||
core.addApiFunctionByName("Vector3Max");
|
||||
core.addApiFunctionByName("Vector3Barycenter");
|
||||
core.addApiFunctionByName("Vector3Unproject");
|
||||
//core.addApiFunctionByName("Vector3ToFloatV")
|
||||
core.addApiFunctionByName("Vector3Invert");
|
||||
core.addApiFunctionByName("Vector3Clamp");
|
||||
core.addApiFunctionByName("Vector3ClampValue");
|
||||
core.addApiFunctionByName("Vector3Equals");
|
||||
core.addApiFunctionByName("Vector3Refract");
|
||||
core.addApiFunctionByName("MatrixDeterminant");
|
||||
core.addApiFunctionByName("MatrixTrace");
|
||||
core.addApiFunctionByName("MatrixTranspose");
|
||||
core.addApiFunctionByName("MatrixInvert");
|
||||
core.addApiFunctionByName("MatrixIdentity");
|
||||
core.addApiFunctionByName("MatrixAdd");
|
||||
core.addApiFunctionByName("MatrixSubtract");
|
||||
core.addApiFunctionByName("MatrixMultiply");
|
||||
core.addApiFunctionByName("MatrixTranslate");
|
||||
core.addApiFunctionByName("MatrixRotate");
|
||||
core.addApiFunctionByName("MatrixRotateX");
|
||||
core.addApiFunctionByName("MatrixRotateY");
|
||||
core.addApiFunctionByName("MatrixRotateZ");
|
||||
core.addApiFunctionByName("MatrixRotateXYZ");
|
||||
core.addApiFunctionByName("MatrixRotateZYX");
|
||||
core.addApiFunctionByName("MatrixScale");
|
||||
core.addApiFunctionByName("MatrixFrustum");
|
||||
core.addApiFunctionByName("MatrixPerspective");
|
||||
core.addApiFunctionByName("MatrixOrtho");
|
||||
core.addApiFunctionByName("MatrixLookAt");
|
||||
//core.addApiFunctionByName("MatrixToFloatV")
|
||||
core.addApiFunctionByName("QuaternionAdd");
|
||||
core.addApiFunctionByName("QuaternionAddValue");
|
||||
core.addApiFunctionByName("QuaternionSubtract");
|
||||
core.addApiFunctionByName("QuaternionSubtractValue");
|
||||
core.addApiFunctionByName("QuaternionIdentity");
|
||||
core.addApiFunctionByName("QuaternionLength");
|
||||
core.addApiFunctionByName("QuaternionNormalize");
|
||||
core.addApiFunctionByName("QuaternionInvert");
|
||||
core.addApiFunctionByName("QuaternionMultiply");
|
||||
core.addApiFunctionByName("QuaternionScale");
|
||||
core.addApiFunctionByName("QuaternionDivide");
|
||||
core.addApiFunctionByName("QuaternionLerp");
|
||||
core.addApiFunctionByName("QuaternionNlerp");
|
||||
core.addApiFunctionByName("QuaternionSlerp");
|
||||
core.addApiFunctionByName("QuaternionFromVector3ToVector3");
|
||||
core.addApiFunctionByName("QuaternionFromMatrix");
|
||||
core.addApiFunctionByName("QuaternionToMatrix");
|
||||
core.addApiFunctionByName("QuaternionFromAxisAngle");
|
||||
//core.addApiFunctionByName("QuaternionToAxisAngle")
|
||||
core.addApiFunctionByName("QuaternionFromEuler");
|
||||
core.addApiFunctionByName("QuaternionToEuler");
|
||||
core.addApiFunctionByName("QuaternionTransform");
|
||||
core.addApiFunctionByName("QuaternionEquals");
|
||||
api.defines.filter(x => x.type === "COLOR").map(x => ({ name: x.name, description: x.description, values: (x.value.match(/\{([^}]+)\}/) || "")[1].split(',').map(x => x.trim()) })).forEach(x => {
|
||||
core.exportGlobalStruct("Color", x.name, x.values, x.description);
|
||||
});
|
||||
|
@ -1663,6 +1652,7 @@ function main() {
|
|||
api.enums.find(x => x.name === "MouseCursor")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description));
|
||||
api.enums.find(x => x.name === "PixelFormat")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description));
|
||||
api.enums.find(x => x.name === "CameraProjection")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description));
|
||||
api.enums.find(x => x.name === "CameraMode")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description));
|
||||
core.writeTo("src/bindings/js_raylib_core.h");
|
||||
core.typings.writeTo("examples/lib.raylib.d.ts");
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1 +1 @@
|
|||
Subproject commit 5573f0f1c7b29bfe46d0b70487e4adb4d01cba62
|
||||
Subproject commit a48bb6e1ed7b33190e486ba65b7875f0dff73701
|
Loading…
Reference in New Issue