Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
162bc15
implementing NFT with threading support
kalwalt Jul 22, 2019
41eb40a
trackingInitGetResult instead of kpmGetResult
kalwalt Jul 22, 2019
ec03ab4
adding quit tracking and other stuf for the transpose matrix
kalwalt Jul 22, 2019
6f46ad1
improved getNFTMarkerInfo with threaded tracking
kalwalt Jul 22, 2019
a3e19c3
tested a different conditional
kalwalt Jul 24, 2019
f5694a9
adding pthreads also in the bytecode libs
kalwalt Jul 26, 2019
218cb8f
simplifying part of the code
kalwalt Jul 26, 2019
0914d82
this solved the issue: arc->videoFrame instead of arc->videoLuma !!!
kalwalt Jul 27, 2019
359292b
cleaning the code
kalwalt Jul 27, 2019
67b0413
restoring the previous conditional
kalwalt Jul 27, 2019
07a85f2
re-adding wasm support
kalwalt Jul 27, 2019
2cb54f9
fix for threejs_from_scratch.html
kalwalt Jul 28, 2019
5918469
new setupAR2Threads function threads initialization only for NFT
kalwalt Jul 28, 2019
966d6d7
optimization in dataHeap transfer, from comment https://github.com/je…
kalwalt Aug 2, 2019
14f67b5
transferDataToHeap also for debug lib version
kalwalt Aug 2, 2019
04233e1
new libjpeg and related changes
kalwalt Aug 30, 2019
f86f165
deleting files ARMarkerNFT
kalwalt Aug 30, 2019
43ecde3
added NFT example with a gltf model
kalwalt Sep 15, 2019
08eecc4
gltf model needs some lights
kalwalt Sep 18, 2019
e0beb69
gltf Duck example for NFT
kalwalt Sep 22, 2019
cb6d29e
scaling and repositioning the model solved the issue view
kalwalt Sep 22, 2019
e9a88e3
fix for CesiumMan example
kalwalt Sep 22, 2019
e50e52b
fix gitmodules
kalwalt Feb 15, 2023
759c846
fix to build with emsdk 3.1.20
kalwalt Feb 16, 2023
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
217,479 changes: 117,806 additions & 99,673 deletions build/artoolkitNft.debug.js

Large diffs are not rendered by default.

285 changes: 266 additions & 19 deletions build/artoolkitNft.min.js

Large diffs are not rendered by default.

176 changes: 1 addition & 175 deletions build/artoolkitNft.min.worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/artoolkitNft_wasm.js

Large diffs are not rendered by default.

Binary file modified build/artoolkitNft_wasm.wasm
Binary file not shown.
17 changes: 0 additions & 17 deletions emscripten/ARToolKitJS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -821,23 +821,6 @@ extern "C" {
return -1;
}

/*
* Transfer data
*/

void transferDataToHeap(int id, ARUint8 *data) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I m not sure but it seems that is not correct, i should check and maybe i will restore it.

if (arControllers.find(id) == arControllers.end()) { return; }
arController *arc = &(arControllers[id]);

if (data != NULL) {
arc->videoFrame = data;
} else {
ARLOGi("data for DataHeap empty!");
}
}



/*
* Marker processing
*/
Expand Down
8 changes: 1 addition & 7 deletions js/artoolkit.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ ARController.prototype.arglCameraViewRHf = function(glMatrix, glRhMatrix, scale)
}

if (this.dataHeap) {
transferDataToHeap(this.id, data );
this.dataHeap.set(data);
return true;
}
return false;
Expand Down Expand Up @@ -1937,19 +1937,13 @@ ARController.prototype.arglCameraViewRHf = function(glMatrix, glRhMatrix, scale)
scope.ARCameraParam = ARCameraParam;

if (scope.Module) {
scope.Module.preRun = function() {
transferDataToHeap = Module.cwrap('transferDataToHeap', 'null', ['number', 'array']);
scope.Module.onRuntimeInitialized = function() {
runWhenLoaded();
var event = new Event('artoolkit-loaded');
scope.dispatchEvent(event);
}
}
} else {
scope.Module = {
preRun: function() {
transferDataToHeap = Module.cwrap('transferDataToHeap', 'null', ['number', 'array']);
},
onRuntimeInitialized: function() {
runWhenLoaded();
}
Expand Down
78 changes: 5 additions & 73 deletions tools/makem.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ var HAVE_NFT = 1;

var EMSCRIPTEN_ROOT = process.env.EMSCRIPTEN;
var ARTOOLKIT5_ROOT = process.env.ARTOOLKIT5_ROOT || "../emscripten/artoolkit5";
var LIBJPEG_ROOT = process.env.LIBJPEG_ROOT || "../emscripten/libjpeg";

if (!EMSCRIPTEN_ROOT) {
console.log("\nWarning: EMSCRIPTEN environment variable not found.")
Expand All @@ -35,7 +34,6 @@ var BUILD_WASM_FILE = 'artoolkitNft_wasm.js';
var BUILD_MIN_FILE = 'artoolkitNft.min.js';

var MAIN_SOURCES = [
'ARMarkerNFT.c',
'trackingSub.c',
'ARToolKitJS.cpp'
];
Expand All @@ -51,7 +49,7 @@ var ar_sources = [
'ARMulti/*.c',
'Video/video.c',
'ARUtil/log.c',
'ARUtil/file_utils.c',
'ARUtil/file_utils.c',
'ARUtil/thread_sub.c',
//'Video/videoLuma.c',
//'Gl/gsub_lite.c',
Expand Down Expand Up @@ -117,10 +115,10 @@ var FLAGS = '' + OPTIMIZE_FLAGS;
FLAGS += ' -Wno-warn-absolute-paths ';
FLAGS += ' -s TOTAL_MEMORY=' + MEM + ' ';
FLAGS += ' -s USE_ZLIB=1';
FLAGS += ' -s USE_LIBJPEG=1 ';
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't needed anymore to include libjpeg source code since it's embedded inside Emscripten, just adding this flag...

//FLAGS += ' -s ERROR_ON_UNDEFINED_SYMBOLS=0';
//FLAGS += ' -s NO_BROWSER=1 '; // for 20k less
FLAGS += ' --memory-init-file 0 '; // for memless file
FLAGS += ' -s BINARYEN_TRAP_MODE=clamp'
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with newer emscripten (upstream) version it's not needed anymore.


var CFLAGS = ' -Wimplicit-function-declaration -DHAVE_NFT=1';

Expand All @@ -129,12 +127,8 @@ var PTHREADS = ' -s USE_PTHREADS=1 ';
var PRE_FLAGS = ' --pre-js ' + path.resolve(__dirname, '../js/artoolkit.api.js') +' ';

FLAGS += ' --bind ';
FLAGS += ' -msse';
FLAGS += ' -msse2';
FLAGS += ' -msse3';
FLAGS += ' -mssse3';

var EXPORTED_FUNCTION = ' -s EXPORTED_FUNCTIONS=["_transferDataToHeap"] -s EXTRA_EXPORTED_RUNTIME_METHODS=["cwrap"]';
var EXPORTED_FUNCTION = ' -s EXPORTED_RUNTIME_METHODS=["FS"]';

/* DEBUG FLAGS */
var DEBUG_FLAGS = ' -g ';
Expand All @@ -150,12 +144,6 @@ var INCLUDES = [
OUTPUT_PATH,
SOURCE_PATH,
path.resolve(__dirname, ARTOOLKIT5_ROOT + '/lib/SRC/KPM/FreakMatcher'),
//path.resolve(__dirname, ARTOOLKIT5_ROOT + '/lib/SRC/GL'),
path.resolve(__dirname, ARTOOLKIT5_ROOT + '/../libjpeg'),
//path.resolve(__dirname, ARTOOLKIT5_ROOT + '/Video'),
//'lib/SRC/KPM/FreakMatcher',
// 'include/macosx-universal/',
// '../jpeg-6b',
].map(function(s) { return '-I' + s }).join(' ');

function format(str) {
Expand All @@ -165,20 +153,6 @@ function format(str) {
return str;
}


// Lib JPEG Compilation

// Memory Allocations
// jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
var libjpeg_sources = 'jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \
jquant2.c jutils.c jmemmgr.c \
jmemansi.c'.split(/\s+/).join(' /home/walter/kalwalt-github/jsartoolkit5/emscripten/libjpeg/')
function clean_builds() {
try {
var stats = fs.statSync(OUTPUT_PATH);
Expand All @@ -200,41 +174,14 @@ function clean_builds() {

var compile_arlib = format(EMCC + ' ' + INCLUDES + ' '
+ ar_sources.join(' ')
+ FLAGS + ' ' + DEFINES + PTHREADS + ' -o {OUTPUT_PATH}libar.bc ',
OUTPUT_PATH);

var compile_kpm = format(EMCC + ' ' + INCLUDES + ' '
+ kpm_sources.join(' ')
+ FLAGS + ' ' + DEFINES + PTHREADS + ' -o {OUTPUT_PATH}libkpm.bc ',
OUTPUT_PATH);

var compile_libjpeg = format(EMCC + ' ' + INCLUDES + ' '
+ path.resolve(__dirname, LIBJPEG_ROOT) + '/' + libjpeg_sources
+ FLAGS + ' ' + DEFINES + PTHREADS + ' -o {OUTPUT_PATH}libjpeg.bc ',
+ FLAGS + ' ' + DEFINES + PTHREADS + ' -r -o {OUTPUT_PATH}libar.bc ',
OUTPUT_PATH);

/*
var compile_libjpeg = format(EMCC + ' ' + INCLUDES + ' '
+ '/home/walter/kalwalt-github/jsartoolkit5/emscripten/jpeg-6b/' + libjpeg_sources
+ FLAGS + ' ' + DEFINES + ' -o {OUTPUT_PATH}libjpeg.bc ',
OUTPUT_PATH);


var compile_combine = format(EMCC + ' ' + INCLUDES + ' '
+ ' {OUTPUT_PATH}*.bc ' + MAIN_SOURCES
+ FLAGS + ' ' + DEBUG_FLAGS + DEFINES + ' -o {OUTPUT_PATH}{BUILD_FILE} ',
OUTPUT_PATH, OUTPUT_PATH, BUILD_FILE);
*/
var compile_combine = format(EMCC + ' ' + INCLUDES + ' '
+ ' {OUTPUT_PATH}*.bc ' + MAIN_SOURCES
+ FLAGS + ' -s WASM=0' + ' ' + DEBUG_FLAGS + EXPORTED_FUNCTION + DEFINES + ' -o {OUTPUT_PATH}{BUILD_FILE} ',
OUTPUT_PATH, OUTPUT_PATH, BUILD_DEBUG_FILE);
/*
var compile_combine_min = format(EMCC + ' ' + INCLUDES + ' '
+ ' {OUTPUT_PATH}*.bc ' + MAIN_SOURCES
+ FLAGS + ' ' + DEFINES + PRE_FLAGS + ' -o {OUTPUT_PATH}{BUILD_FILE} ',
OUTPUT_PATH, OUTPUT_PATH, BUILD_MIN_FILE);
*/

var compile_combine_min = format(EMCC + ' ' + INCLUDES + ' '
+ ' {OUTPUT_PATH}*.bc ' + MAIN_SOURCES
+ FLAGS + ' -s WASM=0' + ' ' + EXPORTED_FUNCTION + DEFINES + PRE_FLAGS + CFLAGS + PTHREADS + ' -o {OUTPUT_PATH}{BUILD_FILE} ',
Expand All @@ -245,17 +192,6 @@ var compile_wasm = format(EMCC + ' ' + INCLUDES + ' '
+ FLAGS + EXPORTED_FUNCTION + DEFINES + PRE_FLAGS + ' -o {OUTPUT_PATH}{BUILD_FILE} ',
OUTPUT_PATH, OUTPUT_PATH, BUILD_WASM_FILE);

/*
var compile_all = format(EMCC + ' ' + INCLUDES + ' '
+ ar_sources.join(' ')
+ FLAGS + ' ' + DEFINES + ' -o {OUTPUT_PATH}{BUILD_FILE} ',
OUTPUT_PATH, BUILD_FILE);
*/
var compile_all = format(EMCC + ' ' + INCLUDES + ' '
+ ar_sources.join(' ')
+ FLAGS + ' ' + DEFINES + ' -o {OUTPUT_PATH}{BUILD_FILE} ',
OUTPUT_PATH, BUILD_DEBUG_FILE);

/*
* Run commands
*/
Expand Down Expand Up @@ -296,12 +232,8 @@ function addJob(job) {

addJob(clean_builds);
addJob(compile_arlib);
//addJob(compile_kpm);
// compile_kpm
addJob(compile_libjpeg);
addJob(compile_combine);
addJob(compile_wasm);
addJob(compile_combine_min);
// addJob(compile_all);

runJob();
Loading