Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt demo to WebGL (GLES 3) #225

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update
Maeiky committed Oct 3, 2023
commit b019a1aff0370782ea07dc4f85c211c129da4b62
13 changes: 0 additions & 13 deletions README.md

This file was deleted.

Binary file removed WebGL/Chipmunk.png
Binary file not shown.
7 changes: 0 additions & 7 deletions WebGL/Web_Emsc_Default_OS/App.html

This file was deleted.

17 changes: 0 additions & 17 deletions WebGL/Web_Emsc_Default_OS/App.js

This file was deleted.

292 changes: 0 additions & 292 deletions WebGL/Web_Emsc_Default_OS/Shell_Common.css

This file was deleted.

610 changes: 0 additions & 610 deletions WebGL/Web_Emsc_Default_OS/Shell_Common.js

This file was deleted.

1 change: 0 additions & 1 deletion cwc/Build.cwc
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@
;Build Engine
-c ../src/ !../src/cpHastySpace.c -o obj/{sOut}/lib/Chipmunk/
-{vIncl}
-{vOS_Flag}
>
;Generate Dynamic Lib
-o obj/{sOut}/lib/ -#To Lib/{sOut}/Chipmunk.{_sDynamic}
Binary file removed cwc/Lib/Web_Emsc_Default_OS/Chipmunk.so
Binary file not shown.
Binary file removed cwc/Lib/Web_Emsc_Default_OS/libChipmunk.a
Binary file not shown.
Binary file removed cwc/Lib/Windows_Clang_Debug/Chipmunk.dll
Binary file not shown.
Binary file removed cwc/Lib/Windows_Clang_Debug/libChipmunk.a
Binary file not shown.
Binary file modified cwc/Lib/Windows_Default_Debug/Chipmunk.dll
Binary file not shown.
Binary file modified cwc/Lib/Windows_Default_Debug/libChipmunk.a
Binary file not shown.
Binary file removed cwc/Lib/Windows_Default_O2/Chipmunk.dll
Binary file not shown.
Binary file removed cwc/Lib/Windows_Default_O2/libChipmunk.a
Binary file not shown.
4 changes: 2 additions & 2 deletions demo/ChipmunkDebugDraw.c
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@
#include <stddef.h>
#include <string.h>

#include "sokol/sokol_gfx.h"
#include "sokol/sokol.h"

#include "chipmunk/chipmunk_private.h"
#include "ChipmunkDebugDraw.h"
@@ -126,7 +126,7 @@ ChipmunkDebugDrawInit(void)

void main(){
float len = length(FRAG.uv);
float fw = length(fwidth(FRAG.uv));
float fw = length(vec2(dFdx(len), dFdy(len)));
float mask = smoothstep(-1.0, fw - 1.0, -len);

float outline = 1.0 - fw;
2 changes: 1 addition & 1 deletion demo/ChipmunkDemoTextSupport.c
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
#include <stddef.h>
#include <string.h>

#include "sokol/sokol_gfx.h"
#include "sokol/sokol.h"

// #include "chipmunk/chipmunk_private.h"
// #include "ChipmunkDemo.h"
8 changes: 8 additions & 0 deletions include/chipmunk/cpMarch.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright 2013 Howling Moon Software. All rights reserved.
// See http://chipmunk2d.net/legal.php for more information.

#ifdef __cplusplus
extern "C" {
#endif

/// Function type used as a callback from the marching squares algorithm to sample an image function.
/// It passes you the point to sample and your context pointer, and you return the density.
typedef cpFloat (*cpMarchSampleFunc)(cpVect point, void *data);
@@ -26,3 +30,7 @@ CP_EXPORT void cpMarchHard(
cpMarchSegmentFunc segment, void *segment_data,
cpMarchSampleFunc sample, void *sample_data
);

#ifdef __cplusplus
}
#endif
8 changes: 8 additions & 0 deletions include/chipmunk/cpPolyline.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright 2013 Howling Moon Software. All rights reserved.
// See http://chipmunk2d.net/legal.php for more information.

#ifdef __cplusplus
extern "C" {
#endif

// Polylines are just arrays of vertexes.
// They are looped if the first vertex is equal to the last.
// cpPolyline structs are intended to be passed by value and destroyed when you are done with them.
@@ -68,3 +72,7 @@ CP_EXPORT void cpPolylineSetCollectSegment(cpVect v0, cpVect v1, cpPolylineSet *
CP_EXPORT cpPolylineSet *cpPolylineConvexDecomposition(cpPolyline *line, cpFloat tol);

#define cpPolylineConvexDecomposition_BETA cpPolylineConvexDecomposition

#ifdef __cplusplus
}
#endif
6 changes: 3 additions & 3 deletions src/cpBody.c
Original file line number Diff line number Diff line change
@@ -103,9 +103,9 @@ cpBodyFree(cpBody *body)
#ifdef NDEBUG
#define cpAssertSaneBody(body)
#else
static void cpv_assert_nan(cpVect v, char *message){cpAssertHard(v.x == v.x && v.y == v.y, message);}
static void cpv_assert_infinite(cpVect v, char *message){cpAssertHard(cpfabs(v.x) != INFINITY && cpfabs(v.y) != INFINITY, message);}
static void cpv_assert_sane(cpVect v, char *message){cpv_assert_nan(v, message); cpv_assert_infinite(v, message);}
static void cpv_assert_nan(cpVect v, const char *message){cpAssertHard(v.x == v.x && v.y == v.y, message);}
static void cpv_assert_infinite(cpVect v, const char *message){cpAssertHard(cpfabs(v.x) != INFINITY && cpfabs(v.y) != INFINITY, message);}
static void cpv_assert_sane(cpVect v, const char *message){cpv_assert_nan(v, message); cpv_assert_infinite(v, message);}

static void
cpBodySanityCheck(const cpBody *body)