pcbjam/wasm/stubs/glu_stub.c
Viktor Vaczi 898e079ef2 Enable 3D viewer in KiCad WASM build
Build the 3D viewer code for WASM instead of stubbing it out.
This is simpler to maintain than complex header stubs.

Changes:
- Enable KICAD_BUILD_3D_VIEWER_WASM=ON in build script
- Remove -gsource-map to avoid OOM in wasm-emscripten-finalize
- Add OpenGL stubs for fixed-function pipeline (WebGL ES 2.0 only)
- Add GLU stub for gluErrorString
- Add NNG stub for IPC API (sockets don't work in WASM)
- Add PCBnew scripting stub
- Expand curl and libgit2 stubs

The 3D viewer code compiles but won't render at runtime since
OpenGL GAL is disabled and Cairo GAL is used instead.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 14:21:29 +01:00

44 lines
2.1 KiB
C

/* GLU stubs for WebAssembly builds
* GLU is not available in WebGL, these stubs prevent link errors.
* The gizmo won't render but the 3D view should work with LEGACY_GL_EMULATION.
*/
typedef struct GLUquadric GLUquadric;
typedef struct GLUtesselator GLUtesselator;
typedef double GLdouble;
typedef void (*_GLUfuncptr)(void);
/* Quadric stubs */
GLUquadric* gluNewQuadric(void) { return (GLUquadric*)0; }
void gluDeleteQuadric(GLUquadric* q) { (void)q; }
void gluQuadricDrawStyle(GLUquadric* q, int s) { (void)q; (void)s; }
void gluQuadricNormals(GLUquadric* q, int n) { (void)q; (void)n; }
void gluCylinder(GLUquadric* q, double b, double t, double h, int sl, int st) {
(void)q; (void)b; (void)t; (void)h; (void)sl; (void)st;
}
void gluDisk(GLUquadric* q, double i, double o, int sl, int lp) {
(void)q; (void)i; (void)o; (void)sl; (void)lp;
}
void gluSphere(GLUquadric* q, double r, int sl, int st) {
(void)q; (void)r; (void)sl; (void)st;
}
void gluPerspective(double fovy, double aspect, double zNear, double zFar) {
(void)fovy; (void)aspect; (void)zNear; (void)zFar;
}
/* Tessellation stubs */
GLUtesselator* gluNewTess(void) { return (GLUtesselator*)0; }
void gluDeleteTess(GLUtesselator* t) { (void)t; }
void gluTessBeginPolygon(GLUtesselator* t, void* d) { (void)t; (void)d; }
void gluTessEndPolygon(GLUtesselator* t) { (void)t; }
void gluTessBeginContour(GLUtesselator* t) { (void)t; }
void gluTessEndContour(GLUtesselator* t) { (void)t; }
void gluTessVertex(GLUtesselator* t, GLdouble* l, void* d) { (void)t; (void)l; (void)d; }
void gluTessNormal(GLUtesselator* t, GLdouble x, GLdouble y, GLdouble z) { (void)t; (void)x; (void)y; (void)z; }
void gluTessCallback(GLUtesselator* t, unsigned int w, _GLUfuncptr f) { (void)t; (void)w; (void)f; }
void gluTessProperty(GLUtesselator* t, unsigned int w, GLdouble v) { (void)t; (void)w; (void)v; }
void gluGetTessProperty(GLUtesselator* t, unsigned int w, GLdouble* d) { (void)t; (void)w; (void)d; }
/* Error string stub */
static const unsigned char glu_error_str[] = "GLU stub error";
const unsigned char* gluErrorString(unsigned int e) { (void)e; return glu_error_str; }