File tree Expand file tree Collapse file tree 14 files changed +23
-38
lines changed Expand file tree Collapse file tree 14 files changed +23
-38
lines changed Original file line number Diff line number Diff line change 1
1
CC = emcc
2
2
SRCS = main.c
3
3
4
- FILES = $(addprefix src/, $(SRCS ) ) # Add 'src/' to each source
4
+ FILES = $(addprefix src/c/ , $(SRCS ) ) # Add 'src/' to each source
5
5
OBJS = $(FILES:.c=.o ) # Modify file extensions of FILES
6
6
EOPT = USE_WEBGL2=1 FULL_ES3=1 USE_GLFW=3 # Emscripten specific options
7
7
EOPTS = $(addprefix -s $(EMPTY ) , $(EOPT ) ) # Add '-s ' to each option
@@ -11,8 +11,8 @@ build: $(OBJS)
11
11
mkdir build
12
12
mkdir app/wasm
13
13
$(CC ) $(FILES ) -O3 $(EOPTS ) -o app/wasm/module.js -s WASM=1 -Wall -s MODULARIZE=1
14
- $(CC ) src/counter.c -O3 $(EOPTS ) -s SIDE_MODULE=1 -s WASM=1 -o app/wasm/counter.wasm
15
- emcc src/engine.c -O3 -o app/wasm/engine.js -s WASM=1 -Wall -s MODULARIZE=1
14
+ $(CC ) src/c/ counter.c -O3 $(EOPTS ) -s SIDE_MODULE=1 -s WASM=1 -o app/wasm/counter.wasm
15
+ emcc src/c/ engine.c -O3 -o app/wasm/engine.js -s WASM=1 -Wall -s MODULARIZE=1
16
16
17
17
# O3 is is a optimization setting
18
18
# WASM=1 means set web assembly to ture
@@ -21,7 +21,7 @@ build: $(OBJS)
21
21
22
22
# Test run
23
23
test :
24
- emcc src/main.c -O3 $(EOPTS ) -o build/index.html -s WASM=1
24
+ emcc src/c/ main.c -O3 $(EOPTS ) -o build/index.html -s WASM=1
25
25
26
26
# Removes object files, but leaves build for serving
27
27
dist : build
Original file line number Diff line number Diff line change
1
+ import Module from './wasm/engine.js'
2
+
3
+ export class Engine {
4
+
5
+ module ;
6
+
7
+ constructor ( ) {
8
+ this . loadDemoWasm ( ) ;
9
+ }
10
+
11
+ loadDemoWasm ( ) {
12
+ this . module = Module ( {
13
+ wasmBinaryFile : '/wasm/engine.wasm' ,
14
+ } ) ;
15
+ }
16
+
17
+ }
18
+
Original file line number Diff line number Diff line change 1
1
import './style.scss' ;
2
2
import { Counter } from './counter' ;
3
3
import { OpenGLDemo } from "./opengl-demo" ;
4
- import Module from './wasm/engine.js'
5
4
6
5
// Get Worker Thread
7
6
// const WorkerThread = require('worker-loader!./worker.js');
@@ -10,7 +9,6 @@ function main() {
10
9
addHeader ( ) ;
11
10
const counter = new Counter ( ) ;
12
11
const demo = new OpenGLDemo ( ) ;
13
- let module = Module ( { wasmBinaryFile : '/wasm/engine.wasm' } ) ;
14
12
// const worker = new WorkerThread();
15
13
// handleWorkerThread(worker);
16
14
}
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- import { OpenGLDemo } from './opengl-demo' ;
2
-
3
1
// Post data to parent thread
4
2
postMessage ( { foo : 'foo' } ) ;
5
3
@@ -8,7 +6,6 @@ onmessage = (event) => {
8
6
} ;
9
7
10
8
function main ( ) {
11
- const demo = new OpenGLDemo ( ) ;
12
9
}
13
10
14
11
main ( ) ;
Original file line number Diff line number Diff line change 15
15
"type" : " git" ,
16
16
"url" : " git+https://github.com/1337programming/WebAssemblyOpenGL.git"
17
17
},
18
- "author" : " Patrick Opie <opiepj@plu.edu >" ,
18
+ "author" : " Patrick Opie <opiepat@gmail.com >" ,
19
19
"license" : " ISC" ,
20
20
"bugs" : {
21
21
"url" : " https://github.com/1337programming/WebAssemblyOpenGL/issues"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments