Sfoglia il codice sorgente

Remove NaCl support. Google is deprecating it.

legacy
Sam Hocevar 5 anni fa
parent
commit
34fab09274
43 ha cambiato i file con 14 aggiunte e 2573 eliminazioni
  1. +0
    -2
      .gitignore
  2. +1
    -1
      build/Makefile.am
  3. +0
    -13
      build/autotools/m4/lol-conf.m4
  4. +0
    -10
      build/build-nacl32
  5. +0
    -10
      build/build-nacl64
  6. +0
    -10
      build/lol-build
  7. +0
    -15
      build/run-bitten.sh
  8. +0
    -1
      doc/doxygen.cfg.in
  9. +0
    -8
      doc/samples/Makefile.am
  10. +0
    -10
      doc/samples/javascript/empty.html
  11. +0
    -105
      doc/samples/javascript/naclloading.js
  12. +0
    -118
      doc/samples/javascript/progressstatus.js
  13. +0
    -319
      doc/samples/javascript/typedictionnary.js
  14. +0
    -131
      doc/samples/javascript/utils.js
  15. +1
    -1
      doc/samples/meshviewer/meshviewer.cpp
  16. +0
    -190
      doc/samples/meshviewer/meshviewer.em.html
  17. +0
    -396
      doc/samples/meshviewer/meshviewer.index.html
  18. +0
    -14
      doc/samples/meshviewer/meshviewer.nacl.html
  19. +0
    -40
      doc/samples/meshviewer/meshviewer.vcxproj
  20. +0
    -126
      doc/samples/nacl_phystest.cpp
  21. +0
    -64
      doc/samples/nacl_phystest.h
  22. +0
    -72
      doc/samples/nacl_phystest.vcxproj
  23. +0
    -20
      doc/samples/nacl_phystest.vcxproj.filters
  24. +0
    -17
      doc/tutorial/11_fractal.cpp
  25. +0
    -10
      src/Makefile.am
  26. +3
    -9
      src/application/application.cpp
  27. +1
    -1
      src/gpu/texture.cpp
  28. +0
    -64
      src/lol-core.vcxproj
  29. +2
    -27
      src/lol-core.vcxproj.filter
  30. +0
    -6
      src/lol/base/features.h
  31. +2
    -4
      src/lol/engine-internal.h
  32. +2
    -4
      src/lol/engine.h
  33. +0
    -3
      src/lol/math/bigint.h
  34. +2
    -2
      src/lol/math/functions.h
  35. +0
    -3
      src/lol/math/real.h
  36. +0
    -70
      src/platform/nacl/nacl-app.cpp
  37. +0
    -39
      src/platform/nacl/nacl-app.h
  38. +0
    -277
      src/platform/nacl/nacl-instance.cpp
  39. +0
    -106
      src/platform/nacl/nacl-instance.h
  40. +0
    -57
      src/platform/nacl/nacl-module.cpp
  41. +0
    -87
      src/platform/nacl/opengl_context.cpp
  42. +0
    -92
      src/platform/nacl/opengl_context.h
  43. +0
    -19
      src/platform/nacl/opengl_context_ptrs.h

+ 0
- 2
.gitignore Vedi File

@@ -82,11 +82,9 @@ doc/samples/benchsuite
doc/samples/bluenoise
doc/samples/btphystest
doc/samples/meshviewer/meshviewer
doc/samples/nacl_phystest
doc/samples/sandbox/sample
doc/samples/math/pi
doc/samples/math/poly
doc/samples/nacl_phystest
doc/samples/simplex
doc/tutorial/01_triangle
doc/tutorial/02_cube


+ 1
- 1
build/Makefile.am Vedi File

@@ -6,7 +6,7 @@ include $(top_srcdir)/build/autotools/common.am
EXTRA_DIST += lol-build \
check-source.sh run-bitten.sh \
build-linux build-mingw build-mingw64 \
build-nacl32 build-nacl64 build-android build-html \
build-android build-html \
\
msbuild/lolfx.targets \
msbuild/lolfx.xml \


+ 0
- 13
build/autotools/m4/lol-conf.m4 Vedi File

@@ -90,19 +90,6 @@ fi
AM_CONDITIONAL(LOL_USE_BULLET, test "${ac_cv_my_have_bullet}" = "yes")


dnl Use NativeClient?
ac_cv_my_have_nacl="no"
AC_LANG_PUSH(C++)
AC_CHECK_HEADERS(ppapi/cpp/instance.h,
[ac_cv_my_have_nacl="yes"
LOL_LIBS="${LOL_LIBS} -lnosys"
if test "${ac_cv_my_build_mode}" = "xrelease"; then
LOL_TRY_CXXFLAGS(-s, [AM_CXXFLAGS="${AM_CXXFLAGS} -s"])
fi])
AC_LANG_POP(C++)
AM_CONDITIONAL(LOL_USE_NACL, test "${ac_cv_my_have_nacl}" != "no")


dnl Use Android? FIXME: super hacks!
ac_cv_my_have_android="no"
AC_CHECK_LIB(log, __android_log_vprint,


+ 0
- 10
build/build-nacl32 Vedi File

@@ -1,10 +0,0 @@
#!/bin/sh

# This can't hurt
make distclean

set -e
./build/lol-build "$@" bootstrap nacl-i386
./build/lol-build "$@" configure nacl-i386
./build/lol-build "$@" build nacl-i386


+ 0
- 10
build/build-nacl64 Vedi File

@@ -1,10 +0,0 @@
#!/bin/sh

# This can't hurt
make distclean

set -e
./build/lol-build "$@" bootstrap nacl-amd64
./build/lol-build "$@" configure nacl-amd64
./build/lol-build "$@" build nacl-amd64


+ 0
- 10
build/lol-build Vedi File

@@ -20,8 +20,6 @@
# And <platform> is one of:
# - linux-i386
# - linux-amd64
# - nacl-i386
# - nacl-amd64
# - ios-arm
# - osx-amd64
# - android-arm
@@ -238,12 +236,6 @@ configure()
raspi-arm)
do_configure --host=arm-bcm2708hardfp-linux-gnueabi CPPFLAGS="-I$RASPI_SDK_ROOT/firmware/opt/vc/include -I$RASPI_SDK_ROOT/firmware/opt/vc/include/interface/vmcs_host/linux -I$RASPI_SDK_ROOT/chroot/usr/include -I$RASPI_SDK_ROOT/chroot/usr/include/arm-linux-gnueabihf" LDFLAGS="-L$RASPI_SDK_ROOT/firmware/opt/vc/lib -L$RASPI_SDK_ROOT/chroot/lib/arm-linux-gnueabihf -Wl,-rpath-link -Wl,$RASPI_SDK_ROOT/chroot/lib/arm-linux-gnueabihf -L$RASPI_SDK_ROOT/chroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link -Wl,$RASPI_SDK_ROOT/chroot/usr/lib/arm-linux-gnueabihf -Wl,--unresolved-symbols=ignore-in-shared-libs"
;;
nacl-i386)
do_configure CXX=i686-nacl-g++ CC=i686-nacl-gcc ac_cv_exeext=.32.nexe --host=i386 CPPFLAGS="-I$NACL_SDK_ROOT/include" LOL_LIBS="-lppapi -lppapi_gles2 -lppapi_cpp -u _ZN2pp12CreateModuleEv"
;;
nacl-amd64)
do_configure CXX=x86_64-nacl-g++ CC=x86_64-nacl-gcc ac_cv_exeext=.64.nexe --host=x86_64 CPPFLAGS="-I$NACL_SDK_ROOT/include" LOL_LIBS="-lppapi -lppapi_gles2 -lppapi_cpp -u _ZN2pp12CreateModuleEv"
;;
osx-amd64)
# HACK: use clang++ because of a memory leak in llvm-g++.
do_configure CXX=clang++ CC=clang
@@ -312,8 +304,6 @@ check()
;;
raspi-arm)
;;
nacl-*)
;;
web-*)
;;
win*-i386)


+ 0
- 15
build/run-bitten.sh Vedi File

@@ -188,21 +188,6 @@ if [ "$family" != "windows" ]; then
fi
append ""

#
# Google NaCl SDK
#

append "[pepper]"
if [ "$family" != "windows" ]; then
if [ -f "$NACL_SDK_ROOT/README" ]; then
pepper_version=$(sed -ne 's/Version: //p' "$NACL_SDK_ROOT/README")
if [ "x$pepper_version" != "x" ]; then
append "version = $pepper_version"
fi
fi
fi
append ""

#
# Raspberry Pi cross-compiler
#


+ 0
- 1
doc/doxygen.cfg.in Vedi File

@@ -799,7 +799,6 @@ INPUT = .. \
../src/platform \
../src/platform/android \
../src/platform/d3d9 \
../src/platform/nacl \
../src/platform/sdl \
../src/platform/xbox \
../src/thread


+ 0
- 8
doc/samples/Makefile.am Vedi File

@@ -9,7 +9,6 @@ bench: benchsuite$(EXEEXT)
if BUILD_SAMPLES
noinst_PROGRAMS = bluenoise benchsuite simplex
if LOL_USE_GL
noinst_PROGRAMS += nacl_phystest
if LOL_USE_BULLET
noinst_PROGRAMS += btphystest
endif
@@ -44,13 +43,6 @@ btphystest_LDFLAGS += \
-s TOTAL_MEMORY=$(shell expr 32 '*' 1024 '*' 1024)
endif

nacl_phystest_SOURCES = \
nacl_phystest.cpp nacl_phystest.h
nacl_phystest_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/3rdparty/bullet3/src \
-DHAVE_PHYS_USE_BULLET
nacl_phystest_DEPENDENCIES = @LOL_DEPS@
nacl_phystest_LDFLAGS = $(AM_LDFLAGS)

simplex_SOURCES = simplex.cpp
simplex_CPPFLAGS = $(AM_CPPFLAGS)
simplex_DEPENDENCIES = @LOL_DEPS@


+ 0
- 10
doc/samples/javascript/empty.html Vedi File

@@ -1,10 +0,0 @@
<DOCTYPE html>
<html>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />

<head>
</head>
<body>
<!-- I'm only here to ensure embed viewport of NaCl/Emscripten is "not empty" -->
</body>
</html>

+ 0
- 105
doc/samples/javascript/naclloading.js Vedi File

@@ -1,105 +0,0 @@
//-------------------------------------------------------------------------
// MODULE INIT FUNCTIONS
//-------------------------------------------------------------------------
function RegisterListener()
{
//Register all the correct functions to the listener
var div_listener = GetiFrameDivEmbed();
if (div_listener)
{
div_listener.addEventListener('loadstart', NaClModuleStartedLoad, true);
div_listener.addEventListener('load', NaClModuleDidLoad, true);
div_listener.addEventListener('error', NaClModuleError, true);
div_listener.addEventListener('progress', NaClModuleLoadUpdate, true);
div_listener.addEventListener('message', NaClModuleSentMessage, true);
div_listener.addEventListener('crash', NaClModuleCrash, true);
window.setTimeout("UpdateTextStatus(0.1)", 100);
}
else if (IsUsingNaCl())
window.setTimeout("RegisterListener()", 200);
}

function NaClInitModuleVar()
{
InitModuleVar();
if (g_embed_module)
g_embed_module['SendMessage'] = function(message) { g_embed_module.postMessage(message); }
}

//-------------------------------------------------------------------------
// MODULE LOADING FUNCTIONS
//-------------------------------------------------------------------------
//Indicate page has been loaded.
function NaClLoadingInit()
{
HideProgressStatus(false);
//Page did load before NaCl module
if (!g_embed_module)
AddTextStatus('Please wait for module loading');
RegisterListener();
}

//Module starts load
function NaClModuleStartedLoad()
{
AddTextStatus('Module Started Loading');
NaClInitModuleVar();
}

//Module progress event
function NaClModuleLoadUpdate(event)
{
if (event.lengthComputable)
UpdateProgressBarValue('Please wait, loading', event.loaded, event.total);
else
UpdateProgressBarValue('Please wait, calculating load balance ...');
}

//Indicate module load success.
function NaClModuleDidLoad()
{
if (!g_embed_module)
NaClInitModuleVar();

//Hide the progress div
AddTextStatus('Module is live, thank you for your patience.');
window.setTimeout('HideProgressStatus(true)', GetMaxStatusTime(0.5) * 1000);

ModuleIsLive();
}

//Module did crash
function NaClModuleCrash(event)
{
NaClRestartModule();
AddTextStatus("Module has crashed ! Restarting ...");
}

//Module had an error
function NaClModuleError(event)
{
NaClRestartModule();
AddTextStatus("Module Load/start Error ! Restarting ...");
}

//Used to restart module on crash/error/load fail ....
function NaClRestartModule()
{
var id_frame_embed = GetFrameData();
if (id_frame_embed)
{
HideProgressStatus(false);
window.setTimeout('GetFrameData().contentDocument.location.reload(true)', 1000);
}
}

//-------------------------------------------------------------------------
// MODULE COMMUNICATION FUNCTIONS
//-------------------------------------------------------------------------

//Handle message from the NaCl module
function NaClModuleSentMessage(message)
{
ModuleSentMessage(message);
}


+ 0
- 118
doc/samples/javascript/progressstatus.js Vedi File

@@ -1,118 +0,0 @@
g_var_progress_bar = -1;
g_status_text = [null];
g_status_timer = [-1.0];

//-------------------------------------------------------------------------
// PROGRESS BAR STATUS FUNCTIONS
//-------------------------------------------------------------------------

//Update the actual progress bar
function UpdateProgressBarValue(new_status, new_value, new_max)
{
var progress_bar = GetProgressBar();
if (progress_bar)
{
if (new_value != undefined && new_max != undefined)
{
if (progress_bar.value < 0)
g_var_progress_bar = -1;
var loading_text = new_status + '[' + (Math.min(1.0, new_value / new_max) * 100.0).toFixed(0) + '%]';
//update the progress status
progress_bar.max = new_max;
progress_bar.value = new_value;
g_var_progress_bar = AddTextStatus(loading_text, g_var_progress_bar);
}
//Load length is not usable
else
{
if (progress_bar.value > 0)
g_var_progress_bar = -1;
progress_bar.value = -1;
g_var_progress_bar = AddTextStatus(new_status, g_var_progress_bar);
}
//Force Status text update for coherency
UpdateTextStatus(0.0);
}
}

//Add text status to the stack
function GetMaxStatusTime(min_value)
{
var higher_time = (min_value) ? (min_value) : (0.0);
for (var i = 0; i < g_status_timer.length; i++)
if (g_status_timer[i])
higher_time = Math.max(higher_time, g_status_timer[i]);
}

//Update progress bar status
function UpdateTextStatus(seconds)
{
var div_progress_status = GetDivProgressStatus();
if (div_progress_status)
{
div_progress_status.innerHTML = '';
for (var i = 0; i < g_status_text.length; i++)
{
if (g_status_timer[i] == undefined || g_status_timer[i] < 0.0)
{
g_status_timer[i] = -1.0;
g_status_text[i] = undefined;
}
else
{
g_status_timer[i] -= seconds;
div_progress_status.innerHTML += g_status_text[i];
//div_progress_status.innerHTML += '[' + g_status_timer[i].toFixed(2) + ']';
if (i < g_status_text.length - 1)
div_progress_status.innerHTML += '<br>';
}
}
window.setTimeout("UpdateTextStatus(0.1)", 100);
}
}

//Add text status to the stack
function AddTextStatus(message, message_id)
{
var msg_timer = 2.0;
if (message_id == undefined || message_id < 0)
{
g_status_text[g_status_text.length] = message;
g_status_timer[g_status_timer.length] = GetMaxStatusTime(msg_timer) + 0.5;
return g_status_timer.length - 1;
}
else
{
g_status_text[message_id] = message;
g_status_timer[message_id] = msg_timer;
return message_id;
}
}

//Hide Progress Status and empty status texts
function HideProgressStatus(should_hide)
{
var progress_bar = GetProgressBar();
var div_progress = GetDivProgress();
if (div_progress && progress_bar)
{
if (should_hide == true)
{
div_progress.style.visibility = "hidden";
div_progress.style.zIndex = "-999";
g_status_text.splice(0, g_status_text.length);
g_status_timer.splice(0, g_status_timer.length);
progress_bar.value = -1;
UpdateTextStatus(1.0);
}
else
{
div_progress.style.visibility = "visible";
div_progress.style.zIndex = "999";
progress_bar.value = -1;
AddTextStatus('Please wait for module loading');
UpdateTextStatus(1.0);
}
}
}


+ 0
- 319
doc/samples/javascript/typedictionnary.js Vedi File

@@ -1,319 +0,0 @@
function TypeDictionnary(m_name)
{
this.m_name = m_name;
this.m_alphabet = '';
this.m_cmds = new Array();
this.m_vars = new Array();
}

//-----------------------------------------------------------------------------
//Command Var object
//-----------------------------------------------------------------------------
function CmdVarObj() { }
function CmdVar(m_type, m_syntax)
{
var current_dict = GetCmdDictionnary();

new_obj = new CmdVarObj();
new_obj.m_type = m_type;
new_obj.m_syntax = m_syntax;

current_dict.m_vars[current_dict.m_vars.length] = new_obj;
}

//-----------------------------------------------------------------------------
//Command Argument object
//-----------------------------------------------------------------------------
function CmdArgObj() { }
function CmdArg(m_type, m_name, m_optional)
{
new_obj = new CmdArgObj();

new_obj.m_type = m_type;
new_obj.m_name = m_name;
new_obj.m_optional = m_optional;

return new_obj;
}

//-----------------------------------------------------------------------------
//Command Typing object
//-----------------------------------------------------------------------------
function CmdTypeObj() { }
function CmdType(m_name, m_comment, m_arg)
{
var current_dict = GetCmdDictionnary();

new_obj = new CmdTypeObj();
new_obj.m_name = m_name;
new_obj.m_comment = m_comment;
new_obj.m_arg = m_arg;

new_obj.CheckCommand = function(check_name)
{
if (m_name != undefined && check_name.length > 0)
{
for (var i = 0; i < m_name.length; i++)
{
if (m_name[i] != undefined)
{
var pattern = new RegExp("^[ ]*" + check_name + "[a-z]*");
if (pattern.test(m_name[i]))
return true;
}
}
}
return false;
}
current_dict.m_cmds[current_dict.m_cmds.length] = new_obj;
}

//-----------------------------------------------------------------------------
//Tries to find a matching command in the dictionnary based on the current cursor location in the given TextArea.
//-----------------------------------------------------------------------------
function FindMatchingCommand(src_text_area)
{
if (src_text_area != undefined)
{
var current_dict = GetCmdDictionnary();
var found_match = "";
var check = true;
var cursor = Math.min(src_text_area.selectionStart, src_text_area.value.length - 1);
//Weird test to ensure we don't start searching on the next line or on the next word.
if (!src_text_area.value[cursor].match(/^[ \n]$/))
cursor++;
cursor = Math.min(cursor, src_text_area.value.length - 1);

var o = 0;
while (check && o < 10)
{
//Move backward to find the first letter on this line
for (; cursor > 0; cursor--)
if (src_text_area.value[cursor].match(/^[a-z\n]+$/))
break;

//Move backward to find the start of the command
for (; cursor > 0; cursor--)
if (!src_text_area.value[cursor - 1].match(/^[#0-9a-z]+$/))
break;

//If the cursor is on a "#" and the previous is a " ", we're on a color, repeat the operation
if (cursor > 0 && src_text_area.value[cursor - 1].match(/[ ]/) &&
src_text_area.value[cursor].match(/[#]/))
check = true;
else
check = false;
o++;
}

//Move forward to find the end of the word
for (; cursor < src_text_area.value.length; cursor++)
{
if (src_text_area.value[cursor].match(/^[a-z]+$/))
found_match += src_text_area.value[cursor];
else
break;
}

//Try to match the command with the dictionnary
var match_data = new Object();
match_data.match = found_match;
match_data.match_list = new Array();
for (cursor = 0; cursor < current_dict.m_cmds.length; cursor++)
if (current_dict.m_cmds[cursor].CheckCommand(found_match))
match_data.match_list[match_data.match_list.length] = cursor;

return match_data;
}
}

//-----------------------------------------------------------------------------
//Build a TOC from all commands first letter
//-----------------------------------------------------------------------------
function BuildTOC(with_dot)
{
var res = '';
var current_dict = GetCmdDictionnary();
for (var a = 'a'.charCodeAt(0); a <= 'z'.charCodeAt(0); a++)
{
var stop = false;
for (var i = 0; !stop && i < current_dict.m_cmds.length; i++)
{
for (var j = 0; j < current_dict.m_cmds[i].m_name.length; j++)
{
if (current_dict.m_cmds[i].m_name[j][0] == String.fromCharCode(a))
{
res += String.fromCharCode(a);
stop = true;
break;
}
}
}
if (!stop && with_dot)
res += '.';
}
return res;
}

//-----------------------------------------------------------------------------
//Setup code lookup logic
//-----------------------------------------------------------------------------
function CmdLookup(div_cmds, div_args, div_cmnt, div_vars, text_src)
{
var cur_dict = GetCmdDictionnary();
if (text_src != undefined)
{
var type_list = new Array();
var cmd_size = 8;
var found = FindMatchingCommand(text_src);
if (found.match_list.length > 0)
{
var perfect_match = false;
var best_match = 0;
var best_length = 300000;
//Find the best match to put it in first in the list
for (var i = 0; i < found.match_list.length && best_length > 0; i++)
{
var cur_match = cur_dict.m_cmds[found.match_list[i]];
for (var j = 0; j < cur_match.m_name.length && best_length > 0; j++)
{
if (cur_match.m_name[j].length == found.match.length)
{
perfect_match = true;
best_match = i;
best_length = 0;
}
else if (cur_match.m_name[j].length < best_length &&
cur_match.m_name[j].length > found.match.length)
{
best_match = i;
best_length = cur_match.m_name[j].length;
}
}
}
var tmp = found.match_list[0];
found.match_list[0] = found.match_list[best_match];
found.match_list[best_match] = tmp;

div_cmds[0].innerHTML = "";
div_cmds[1].innerHTML = "";
div_args.innerHTML = "";
div_cmnt.innerHTML = "";
//Go through the found matches and show them.
for (var i = 0; i < found.match_list.length; i++)
{
var cur_match = cur_dict.m_cmds[found.match_list[i]];
div_cmds[0].innerHTML += '[';
var max = cur_match.m_name.length;
var word = 0;
for (var j = 0; j < max; j++)
{
var mth = found.match;
var cmd = cur_match.m_name[j];
//Matching start caracters should be bold
if (mth == cmd.slice(0, mth.length))
{
div_cmds[word].innerHTML += '&nbsp;';
div_cmds[word].innerHTML += '<b>' + mth + '</b>';
div_cmds[word].innerHTML += cmd.slice(mth.length, cmd.length);
word++;
}
}
//Complete empty command by <br> so commands in the two columns are on the same line
word = (word > 0)?(2):(0);
while (word-- > 0)
div_cmds[word].innerHTML += "<br>";
//Go through the arguments and show them, force if we found the perfect match
if ((perfect_match || found.match_list.length < 4) && i == 0)
{
div_args.innerHTML += "&nbsp;>&nbsp;";
if (cur_match.m_arg != undefined)
{
max = cur_match.m_arg.length;
var found_optional = false;
for (var j = 0; j < max; j++)
{
if (cur_match.m_arg[j].m_optional != undefined && found_optional == false)
{
var tab = '<br>'; for (var l = 0; l < 5; l++) tab += '&nbsp;';
div_args.innerHTML += tab + 'Opt: [';
found_optional = true;
}
else if (j > 0)
div_args.innerHTML += ', ';

//Types are bold
div_args.innerHTML += '<b>' + cur_match.m_arg[j].m_type + '</b> ';
type_list[type_list.length] = cur_match.m_arg[j].m_type;
//Names are not
div_args.innerHTML += cur_match.m_arg[j].m_name;
if (cur_match.m_arg[j].m_optional != undefined)
div_args.innerHTML += ' = <b>' + cur_match.m_arg[j].m_optional + '</b>';
}
if (found_optional == true)
div_args.innerHTML += '] ';
div_args.innerHTML += '&nbsp;<br>';
}
//Add the comment
if (cur_match.m_comment != undefined)
{
var tb_i = 16; var in_i = 8;
var tab = '<br>';
if (cur_match.m_arg == undefined) { tb_i -= 8; in_i -= 8; }
for (var l = 0; l < in_i; l++) div_args.innerHTML += '&nbsp;';
for (var l = 0; l < tb_i; l++) tab += '&nbsp;';
div_args.innerHTML += cur_match.m_comment + '&nbsp;';
while (div_args.innerHTML.indexOf('\n') > -1)
div_args.innerHTML = div_args.innerHTML.replace('\n', tab);
}
}
}
}
else
{
div_cmds[0].innerHTML = "[ ...&nbsp;";
div_cmds[1].innerHTML = "";
div_args.innerHTML = "";
div_cmnt.innerHTML = "";
}
//Go through the type list and bold the used ones.
if (cur_dict.m_vars != undefined)
{
div_vars.innerHTML = "";
var max = cur_dict.m_vars.length;
for (var j = 0; j < max; j++)
{
var cur_var = cur_dict.m_vars[j];
div_vars.innerHTML += "&nbsp;>&nbsp;";
var k = 0;
for (; k < type_list.length; k++)
if (cur_var.m_type == type_list[k])
break;

//Bold the used variables
if (k < type_list.length)
div_vars.innerHTML += "<b>" + cur_var.m_type + "</b>";
else
div_vars.innerHTML += cur_var.m_type;
if (cur_var.m_syntax != undefined)
{
var align_size = 9;
var cmd_size = cur_var.m_type.length + 3;
for (var m = 0; m < cur_var.m_syntax.length; m++)
{
for (var l = 0; l < align_size - cmd_size; l++)
div_vars.innerHTML += "&nbsp;";
div_vars.innerHTML += cur_var.m_syntax[m] + "<br>";
cmd_size = 0;
}
var tab = '';
for (var l = 0; l < align_size - cmd_size; l++)
tab += "&nbsp;";
while (div_vars.innerHTML.indexOf('\n') > -1)
div_vars.innerHTML = div_vars.innerHTML.replace('\n', '<br>' + tab);
}
}
}
}
}

+ 0
- 131
doc/samples/javascript/utils.js Vedi File

@@ -1,131 +0,0 @@
//-----------------------------------------------------------------------------
// COOKIE MANAGEMENT - nom nom nom nom -
//-----------------------------------------------------------------------------

function LolCookie() { }
function LolCookieDays(m_name, m_value, m_expire_days)
{
var cookie = new LolCookie();

cookie.m_name = m_name;
cookie.m_value = m_value;
cookie.m_expire_date = new Date();
cookie.m_expire_date.setDate(cookie.m_expire_date.getDate() + m_expire_days);

return cookie;
}
function LolCookieDate(m_name, m_value, m_expire_date)
{
var cookie = new LolCookie();

cookie.m_name = m_name;
cookie.m_value = m_value;
cookie.m_expire_date = m_expire_date;

return cookie;
}

//Set a cookie
function StoreLolCookie(cookie)
{
GetLolCookie(cookie.m_name, true);

var enc_value = escape(cookie.m_value) + ";";

//Add expire days
if (cookie.m_expire_date)
enc_value += " expires=" + cookie.m_expire_date.toUTCString() + ";";
enc_value = cookie.m_name + "=" + enc_value;

//Store cookies
document.cookie = enc_value;
}

//Get a cookie
function GetLolCookie(name, remove)
{
var cki_doc = document.cookie;
var cookie = null;

var cki_start = cki_doc.indexOf(name + "=");
if (cki_start > -1)
{
cookie = new LolCookie();
cookie.m_name = name;
cookie.m_expire_date = null;

//Retrieve value
var val_start = cki_doc.indexOf("=", cki_start) + 1;
var val_end = cki_doc.indexOf(";", cki_start);
if (val_end < 0)
val_end = cki_doc.length;
cookie.m_value = unescape(cki_doc.substring(val_start, val_end));

if (remove)
document.cookie = name + "=; expires=0;";
}
return cookie;
}

//Check the existence of a cookie
function DoesLolCookieExist(name)
{
var cki_doc = document.cookie;
if (cki_doc.indexOf(name + "=") > -1)
return true;
return false;
}

//-----------------------------------------------------------------------------
// FILE MANAGEMENT
//-----------------------------------------------------------------------------

//Dynamic load
function DynLoadFile(filename)
{
var filetype = filename.match(/\.[a-zA-Z]+$/);
//if filename is a external JavaScript file
if (filetype == ".js")
{
var fileref = document.createElement('script');
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", filename);
}
//if filename is an external CSS file
else if (filetype == ".css")
{
var fileref = document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", filename);
}
if (fileref)
document.getElementsByTagName("head")[0].appendChild(fileref);
}

//Dynamic remove
function DynRemoveFile(filename)
{
var filetype = filename.match(/\.[a-zA-Z]+$/);
var targetelement = "none";
var targetattr = "none";
//Determine element type to create nodelist from and corresponding attribute to test for
if (filetype==".js")
{
targetelement = "script";
targetattr = "src";
}
else if (filetype == ".css")
{
targetelement = "link";
targetattr = "href";
}

var allsuspects = document.getElementsByTagName(targetelement);
//Search backwards within nodelist for matching elements to remove
for (var i = allsuspects.length; i >= 0; i--)
if (allsuspects[i] &&
allsuspects[i].getAttribute(targetattr) &&
allsuspects[i].getAttribute(targetattr).indexOf(filename) != -1)
allsuspects[i].parentNode.removeChild(allsuspects[i]); //remove element by calling parentNode.removeChild()
}

+ 1
- 1
doc/samples/meshviewer/meshviewer.cpp Vedi File

@@ -29,7 +29,7 @@ using namespace lol;
static int const TEXTURE_WIDTH = 256;

//Basic build defines ---------------------------------------------------------
#define HAS_WEB (__native_client__ || EMSCRIPTEN)
#define HAS_WEB (EMSCRIPTEN)
#define HAS_INPUT (_WIN32 && !HAS_WEB)

//Basic config defines --------------------------------------------------------


+ 0
- 190
doc/samples/meshviewer/meshviewer.em.html Vedi File

@@ -1,190 +0,0 @@
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>YOUR PAGE NAME HERE</title>

<style>
.emscripten
{
padding-right: 0;
margin-left: auto;
margin-right: auto;
display: block;
}
textarea.emscripten
{
font-family: monospace;
width: 80%;
}
div.emscripten
{
text-align: center;
}
div.emscripten_border
{
border: 1px solid black;
position: absolute;
left: 0px;
top: 0px;
}
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
canvas.emscripten
{
border: 0px none;
}
</style>
</head>

<body>
<div class="emscripten_border" id="id_div_embed_data">
<canvas class="emscripten" id="id_cvas_render" oncontextmenu="event.preventDefault()"></canvas>
</div>

<!-- this part is a little weird, I don't really know what to do with it. -->
<div class="emscripten">
<input type="checkbox" id="id_ckbox_resize">Resize canvas
<input type="checkbox" id="id_ckbox_pointer_lock" checked>Lock/hide mouse pointer
&nbsp;&nbsp;&nbsp;
<input type="button" value="Fullscreen" onclick="ClickFullscreen()">
</div>
<textarea class="emscripten" id="id_txt_output" rows="8"> </textarea>

<script type='text/javascript'>
// connect to canvas
var Module =
{
output: document.getElementById('id_txt_output'),
canvas: document.getElementById('id_cvas_render'),
preRun: [],
postRun: [],
clickFullsreen: function()
{
Module.requestFullScreen(document.getElementById('id_ckbox_pointer_lock').checked,
document.getElementById('id_ckbox_resize').checked);
},
print: (function()
{
if (this.output)
{
this.output.value = ''; // clear browser cache
return function(text)
{
this.text = Array.prototype.slice.call(arguments).join(' ');
// These replacements are necessary if you render to raw HTML
/*
text = text.replace(/&/g, "&amp;");
text = text.replace(/</g, "&lt;");
text = text.replace(/ >/g, "&gt;");
text = text.replace('\n', '<br>', 'g');
*/
this.output.value += text + "\n";
this.output.scrollTop = 99999; // focus on bottom
};
}
else
return '';
})(),
printErr: function(text)
{
text = Array.prototype.slice.call(arguments).join(' ');
if (0) // XXX disabled for safety typeof dump == 'function')
dump(text + '\n'); // fast, straight to the real console
else
console.log(text);
},
//Load Status handling
setStatus: function(text, new_value, new_max)
{
var tmp_status = '';
var tmp_value = undefined;
var tmp_max = undefined;
var should_hide = false;

//Clear any interval put on this Status.
if (Module.setStatus.interval)
clearInterval(Module.setStatus.interval);
//If value and max have been set, directly go for the win.
if (new_value != undefined && new_max != undefined)
{
tmp_status = text;
tmp_value = new_value;
tmp_max = new_max;
}
else
//Else do the complicated stuff.
{
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
if (m)
{
text = m[1];
tmp_value = parseInt(m[2]) * 100;
tmp_max = parseInt(m[4]) * 100;
}
else
should_hide = true;
}
if (parent)
{
//parent.UpdateProgressBarValue(tmp_status, tmp_value, tmp_max);
//parent.HideProgressStatus(should_hide);
}
},
totalDependencies: 0,
monitorRunDependencies:
function(left)
{
this.totalDependencies = Math.max(this.totalDependencies, left);
if (left)
Module.setStatus('Downloading dependencies ', (this.totalDependencies - left), this.totalDependencies);
else
{
Module.setStatus('All downloads complete.', 1, 1);
parent.ModuleIsLive();
}
},
//IMPORTANT : This is the C -> Javascript wraping, add your functions list here.
wrapup_list: [ {src_obj: null, func_name: 'DoSendMessage', c_func_name: 'C_Send', return_var: 'number', args: ['string'] } ],
do_wrapup: function()
{
for (var i = 0; i < this.wrapup_list.length; i++)
{
if (!this.wrapup_list[i].src_obj)
this.wrapup_list[i].src_obj = this;
this.wrapup_list[i].src_obj[this.wrapup_list[i].func_name] =
cwrap(this.wrapup_list[i].c_func_name,
this.wrapup_list[i].return_var,
this.wrapup_list[i].args);
}
},
//Module <-> Page communication setup
SendMessage:function(message)
{
this.DoSendMessage(message);
},
ModuleSendMessage:function(message)
{
alert(message);
}
};
</script>

<!-- Copy this HTML in your site folder and put your built program script in the src. -->
<script src="./meshviewer.em.js"></script>
<!-- -->

<script type='text/javascript'>
//This call NEEDS TO BE after the .js include, because "cwrap" is set in it.
Module.do_wrapup();

//Parent communication datas
function GetDivEmbed() { return document.getElementById('id_div_embed_data'); }
function GetEmbedModule() { return Module; }

parent.InitModuleVar();
Module.setStatus('Please wait, calculating load balance ...', 0, 1);
</script>

</body>
</html>

+ 0
- 396
doc/samples/meshviewer/meshviewer.index.html Vedi File

@@ -1,396 +0,0 @@
<DOCTYPE html>
<html>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />

<!--
Copyright (c) 2012 The Native Client Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<head>

<style type="text/css">
body
{
font:12px Consolas;
}
button
{
font:14px Consolas;
}
textarea
{
font:14px Consolas;
}
#id_div_progress_status
{
font:12px Consolas;
}
#id_div_progress
{
position: absolute;
top: 20%;
left: 30%;
right: 30%;
z-index: 3;
background-color:white;
border:1px solid #000000;
visibility: hidden;
z-index: 1;
}
progress
{
background-color: #f3f3f3;
border: 0;
height: 18px;
width: 200px;
border-radius: 9px;
}
progress::-webkit-progress-bar
{
background-color: #f3f3f3;
border: 1px solid #000000;
padding: 2px 2px;
height: 20px;
border-radius: 0px;
}
progress::-webkit-progress-value
{
background-color: #22BB22;
border: 0px;
height: 14px;
border-radius: 0px;
}
#id_div_listener
{
position: relative;
}
#id_div_frame_embed
{
position: absolute;
top: 2px;
left: 2px;
z-index: 0;
}
#BGCanvas
{
border:1px solid #000000;
}
#id_div_helper_cmd_0
{
margin-left: 5px;
}
</style>

<title>Mesh Viewer Web Edition</title>

</head>

<script type="text/javascript">
//Base data Setup : GLOBAL STYLE
g_div_frame_embed_save = '';
g_div_frame_embed = null;
g_txtarea_code_src = null;
g_div_helper_cmd = [null, null];
g_div_helper_args = null;
g_div_helper_cmnt = null;
g_div_helper_vars = null;
g_div_alphabet = null;
g_div_progress = null;
g_div_progress_status = null;
g_progress_bar = null;
g_var_progress_bar = -1;
g_frame_embed = null;
//This is the module pointer : can be either the NaCl or Em one depending on the context.
g_embed_module = null;

var g_autosave_timer = 4.0;
var g_autosave_time = 4.0;
var g_code_addin = [' custom setmesh "#CODE#" ', '#CODE#'];
var g_code_base = [];
var CodeDictionnary = [];

var g_code_id = 0;
g_code_base[0] = "//This is a comment\nsc#f8f afcb 1 1 1 0";
g_code_base[1] = "//This is a comment\naddlight 0.0 position (4 -1 -4) color (.0 .2 .5 1)\naddlight 0.0 position (8 2 6) color #ffff\nshowgizmo true\nshowlight true";
function machinchose() { return 'test machin '; }
function GetTextAreaCodeSrc() { return g_txtarea_code_src; }
function GetDivProgress() { return g_div_progress; }
function GetProgressBar() { return g_progress_bar; }
function GetDivProgressStatus() { return g_div_progress_status; }
function GetDivEmbedData() { return g_div_frame_embed; }
function GetDivEmbedDataSave() { return g_div_frame_embed_save; }
function GetFrameData() { return g_frame_embed; }

//Communication with iframe content.
function InitModuleVar() { g_embed_module = GetiFrameModuleVar(); }
function GetiFrameDivEmbed() { return (!g_frame_embed) ? (null) : (g_frame_embed.contentWindow.GetDivEmbed()); }
function GetiFrameModuleVar() { return (!g_frame_embed) ? (null) : (g_frame_embed.contentWindow.GetEmbedModule()); }
function IsUsingNaCl() { return window.chrome; }
</script>

<script src="../javascript/utils.js"></script>
<script src="../javascript/progressstatus.js"></script>
<script type="text/javascript">
//Used by typedictionnary.js
function GetCmdDictionnary() { return CodeDictionnary[g_code_id]; }
g_code_id = 1;
</script>
<script src="../javascript/typedictionnary.js"></script>
<!-- Init Scene setup dictionnary -->
<script type="text/javascript">
CodeDictionnary[g_code_id] = new TypeDictionnary("SceneSetup");
</script>
<script src="./scenesetupdictionnary.js"></script>
<!-- Init Easy mesh dictionnary -->
<script type="text/javascript">
g_code_id--;
CodeDictionnary[g_code_id] = new TypeDictionnary("EasyMesh");
</script>
<script src="./easymeshdictionnary.js"></script>
<!-- Revert datas to normal -->
<script type="text/javascript">
g_code_id = 0;
</script>

<script type="text/javascript">
//Base init for all datas
function VarInit()
{
//Init frame variable first.
g_frame_embed = document.getElementById('id_frame_embed');
//This is in an iframe.
g_div_frame_embed = g_frame_embed.contentDocument.getElementById('id_div_frame_embed');
//The rest of these are in this page.
g_txtarea_code_src = document.getElementById('id_txtarea_code_src');
g_div_helper_cmd[0] = document.getElementById('id_div_helper_cmd_0');
g_div_helper_cmd[1] = document.getElementById('id_div_helper_cmd_1');
g_div_helper_args = document.getElementById('id_div_helper_args');
g_div_helper_cmnt = document.getElementById('id_div_helper_cmnt');
g_div_helper_vars = document.getElementById('id_div_helper_vars');
g_div_alphabet = document.getElementById('id_div_alphabet');
g_div_progress = document.getElementById('id_div_progress');
g_div_progress_status = document.getElementById('id_div_progress_status');
g_progress_bar = document.getElementById('id_progress_bar');
}

//Base init
function Init()
{
VarInit();

//Put here any cookie update
if (DoesLolCookieExist("LolMeshViewerAutosave"))
{
var lol_cookie = GetLolCookie("LolMeshViewerAutosave", false);
var value_list = lol_cookie.m_value.split(";");
for (var i = 0; i < g_code_base.length && i < value_list.length; i++)
{
g_code_base[i] = value_list[i];
var addins = g_code_addin[i].split('#CODE#');
for (var j = 0; j < addins.length; j++)
if (addins[j] && addins[j] != '')
g_code_base[i] = g_code_base[i].replace(addins[j], "");
}
g_txtarea_code_src.value = g_code_base[g_code_id];
}
else if (!g_txtarea_code_src.value)
g_txtarea_code_src.value = g_code_base[g_code_id];

//Fill the TOC
if (!g_div_alphabet.innerHTML)
{
for (var i = 0; i < CodeDictionnary.length; i++)
{
g_code_id = i;
var new_toc = BuildTOC(true);
var pattern = new RegExp("^[a-zA-Z\.]");
while (pattern.test(new_toc))
new_toc = new_toc.replace(pattern, "<b>$&");
pattern = new RegExp("[a-zA-Z\.]$");
while (pattern.test(new_toc))
new_toc = new_toc.replace(pattern, "$&</b>");
pattern = new RegExp("([a-zA-Z])([\.])");
while (pattern.test(new_toc))
new_toc = new_toc.replace(pattern, "$1</b>$2");
pattern = new RegExp("([\.])([a-zA-Z])");
while (pattern.test(new_toc))
new_toc = new_toc.replace(pattern, "$1<b>$2");
CodeDictionnary[i].m_alphabet = new_toc;
}
g_code_id = 0;
InitEditValues();
}

//NaCl Specific
if (IsUsingNaCl())
{
DynLoadFile("../javascript/naclloading.js");
g_frame_embed.src = 'meshviewer.nacl.html';
}
else
g_frame_embed.src = 'meshviewer.em.html';

g_frame_embed.onload = function() { VarInit(); }

//Tick has been done, start Tick
window.setTimeout("Tick(.2)", 200);
}

function Tick(seconds)
{
window.setTimeout("Tick(.1)", 100);

var text_src = g_txtarea_code_src;
var div_cmds = g_div_helper_cmd;
var div_args = g_div_helper_args;
var div_cmnt = g_div_helper_cmnt;
var div_vars = g_div_helper_vars;
CmdLookup(div_cmds, div_args, div_cmnt, div_vars, text_src);

g_autosave_timer -= seconds;
if (g_autosave_timer < 0.0)
{
g_autosave_timer = g_autosave_time;
StoreCodeCookie();
}
}

function StoreCodeCookie()
{
var result = '';
for (var i = 0; i < g_code_base.length; i++)
{ result += g_code_addin[i].replace('#CODE#', g_code_base[i]) + ";"; }
StoreLolCookie(new LolCookieDays("LolMeshViewerAutosave", result, 10));
}

function StoreTextAreaValue()
{
g_code_base[g_code_id] = GetTextAreaCodeSrc().value;
}

function ExchangeSetup()
{
StoreTextAreaValue();
g_code_id = (g_code_id + 1) % 2;
InitEditValues();
}

function InitEditValues()
{
GetTextAreaCodeSrc().value = g_code_base[g_code_id];
g_div_alphabet.innerHTML = '&nbsp;Table of content<br>&nbsp;[' + CodeDictionnary[g_code_id].m_alphabet + ']&nbsp;<br>&nbsp;';
}

//Handle message from the NaCl module
function ModuleSentMessage(message)
{
alert('Module sent message: ' + message.data);
}

//When module is live, it calls this.
function ModuleIsLive()
{
for (var i = 0; i < g_code_base.length; i++)
{
SendMessageToModule();
ExchangeSetup();
}
}

//Called by the "Send Mesh Command !" button
function SendMessageToModule()
{
StoreTextAreaValue();
if (g_embed_module)
{
StoreCodeCookie();
g_embed_module.SendMessage(g_code_addin[g_code_id].replace('#CODE#', g_code_base[g_code_id]));
}
else
alert("Module not loaded !");
}
</script>

<body>

<h1>Mesh Viewer : Web version.</h1>

<table border="0" cellpadding="0" cellspacing="0">
<tr height="404">
<td>

<p>
<div id="final_div">
<div id="id_div_listener" align="center" style="width:800px;height:400px">
<canvas id="BGCanvas" width="802" height="402"></canvas>
<div id="id_div_progress">
<br>&nbsp;
<progress id="id_progress_bar" align="left"></progress>
<div id="id_div_progress_status">....</div>&nbsp;
</div>
<div id="id_div_frame_embed">
<iframe onload="Init();" id="id_frame_embed" src="../javascript/empty.html" width=800 height=400 frameborder=0 scrolling=no></iframe>
</div>
</div>
</div>
</p>

</td>
<td>
</td>
</tr>
<tr>
<td rowspan="2">

<table border="0" cellpadding="0" cellspacing="0" width="802">
<tr>
<td align="left">
<div><button onclick="SendMessageToModule()">Update program</button></div>
</td>
<td align="right">
<div><button onclick="ExchangeSetup()">Change edit data</button></div>
</td>
</tr>
</table>

<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="1%">
<div id="bouton">
<textarea autofocus id="id_txtarea_code_src" rows="6" cols="94" style="font: 14px Consolas; resize: none;"></textarea>
</div>
</td>
<td valign="top" rowspan="3">&nbsp;</td>
<td valign="top" rowspan="3">
<div><b><u>Variable Types usage :</u></b></div>
<div id="id_div_helper_vars"></div>
</td>
</tr>
<tr>
<td height="1%">
<div id="id_div_alphabet"></div>
</td>
</tr>
<tr>
<td valign="top">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><div id="id_div_helper_cmd_0"></div></td>
<td valign="top"><div id="id_div_helper_cmd_1"></div></td>
<td valign="top"><div id="id_div_helper_args" ></div></td>
<td valign="top"><div id="id_div_helper_cmnt" ></div></td>
</tr>
</table>
</td>
</tr>
</table>

</td>
</tr>
</table>

</body>
</html>

+ 0
- 14
doc/samples/meshviewer/meshviewer.nacl.html Vedi File

@@ -1,14 +0,0 @@
<DOCTYPE html>
<html>
<body>
<script type="text/javascript">
function GetDivEmbed() { return document.getElementById('id_div_embed_data'); }
function GetEmbedModule() { return document.getElementById('id_embed_nacl_module'); }

if (parent.IsUsingNaCl()) parent.NaClLoadingInit();
</script>
<div id="id_div_embed_data" style="left:0px;top:0px;position:absolute;">
<embed name="name_embed_nacl_module" id="id_embed_nacl_module" width=800 height=400 src="meshviewer.nacl.nmf" type="application/x-nacl" />
</div>
</body>
</html>

+ 0
- 40
doc/samples/meshviewer/meshviewer.vcxproj Vedi File

@@ -56,46 +56,6 @@
<None Include="..\data\meshviewer.init.lua">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</None>
<None Include="meshviewer.index.html">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</None>
<None Include="meshviewer.nacl.html">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</None>
<None Include="meshviewer.em.html">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</None>
<None Include="meshviewer.nacl.nmf">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</None>
<None Include="easymeshdictionnary.js">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</None>
<None Include="scenesetupdictionnary.js">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</None>
<None Include="../javascript/naclloading.js">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</None>
<None Include="../javascript/progressstatus.js">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</None>
<None Include="../javascript/utils.js">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</None>
<None Include="../javascript/typedictionnary.js">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</None>
</ItemGroup>
<ItemGroup>
<LolFxCompile Include="shinyfur.lolfx" />


+ 0
- 126
doc/samples/nacl_phystest.cpp Vedi File

@@ -1,126 +0,0 @@
//
// Lol Engine — BtPhys tutorial
//
// Copyright © 2009—2015 Benjamin “Touky” Huet <huet.benjamin@gmail.com>
// © 2012—2015 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What the Fuck You Want
// to Public License, Version 2, as published by the WTFPL Task Force.
// See http://www.wtfpl.net/ for more details.
//

#if HAVE_CONFIG_H
# include "config.h"
#endif

#include <lol/engine.h>
#include "loldebug.h"

using namespace lol;

//#include "physics/lolphysics.h"
//#include "physics/easyphysics.h"

#include "nacl_phystest.h"

//using namespace lol::phys;

int gNumObjects = 64;

Nacl_PhysTest::Nacl_PhysTest(bool editor)
{
/* Register an input controller for the keyboard */
m_controller = new Controller("Default");
m_controller->GetKey(KEY_MOVE_FORWARD).Bind("Keyboard", "Up");
m_controller->GetKey(KEY_MOVE_BACK).Bind("Keyboard", "Down");
m_controller->GetKey(KEY_MOVE_LEFT).Bind("Keyboard", "Left");
m_controller->GetKey(KEY_MOVE_RIGHT).Bind("Keyboard", "Right");
m_controller->GetKey(KEY_MOVE_JUMP).Bind("Keyboard", "Space");
m_controller->GetKey(KEY_MOVE_UP).Bind("Keyboard", "PageUp");
m_controller->GetKey(KEY_MOVE_DOWN).Bind("Keyboard", "PageDown");
m_controller->GetKey(KEY_QUIT).Bind("Keyboard", "Escape");

/* Create a camera that matches the settings of XNA BtPhysTest */
m_camera = new Camera();
m_camera->SetView(vec3(50.f, 50.f, 0.f),
vec3(0.f, 0.f, 0.f),
vec3(0, 1, 0));
m_camera->SetProjection(radians(45.f), .1f, 1000.f, (float)Video::GetSize().x, (float)Video::GetSize().y / (float)Video::GetSize().x);
Scene::GetScene().PushCamera(m_camera);

m_ready = false;

/*
m_simulation = new Simulation();
m_simulation->SetWorldLimit(vec3(-1000.0f, -1000.0f, -1000.0f), vec3(1000.0f, 1000.0f, 1000.0f));
m_simulation->Init();
vec3 NewGravity = vec3(.0f, -10.0f, .0f);
m_simulation->SetGravity(NewGravity);
m_simulation->SetContinuousDetection(true);
m_simulation->SetTimestep(1.f / 120.f);
Ticker::Ref(m_simulation);
*/

/* Add a white directional light */
m_light1 = new Light();
m_light1->SetPosition(vec3(0.2f, 0.2f, 0.f));
m_light1->SetColor(vec4(0.5f, 0.5f, 0.5f, 1.f));
m_light1->SetType(LightType::Directional);
Ticker::Ref(m_light1);

/* Add an orangeish point light */
m_light2 = new Light();
m_light2->SetPosition(vec3(-15.f, 15.f, 15.f));
m_light2->SetColor(vec4(0.4f, 0.3f, 0.2f, 1.f));
m_light2->SetType(LightType::Point);
Ticker::Ref(m_light2);
}

void Nacl_PhysTest::tick_game(float seconds)
{
WorldEntity::tick_game(seconds);

if (m_controller->IsKeyReleased(KEY_QUIT))
Ticker::Shutdown();
}

void Nacl_PhysTest::tick_draw(float seconds, Scene &scene)
{
WorldEntity::tick_draw(seconds, scene);

if (!m_ready)
{
/* FIXME: this object never cleans up */
m_ready = true;
}
else
{
}
}

Nacl_PhysTest::~Nacl_PhysTest()
{
Scene::GetScene().PopCamera(m_camera);

Ticker::Unref(m_light1);
Ticker::Unref(m_light2);

//Ticker::Unref(m_simulation);
}

int main(int argc, char **argv)
{
sys::init(argc, argv);

Application app("Nacl_PhysTest", ivec2(1280, 960), 60.0f);

new Nacl_PhysTest(argc > 1);
app.ShowPointer(false);

app.Run();

return EXIT_SUCCESS;
}


+ 0
- 64
doc/samples/nacl_phystest.h Vedi File

@@ -1,64 +0,0 @@
//
// Lol Engine — Bullet physics test
//
// Copyright © 2009—2013 Benjamin “Touky” Huet <huet.benjamin@gmail.com>
// © 2012—2018 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What the Fuck You Want
// to Public License, Version 2, as published by the WTFPL Task Force.
// See http://www.wtfpl.net/ for more details.
//

#pragma once

class Nacl_PhysTest : public WorldEntity
{
public:
Nacl_PhysTest(bool editor = false);
virtual ~Nacl_PhysTest();

std::string GetName() const { return "<Nacl_PhysTest>"; }

protected:
virtual void tick_game(float seconds);
virtual void tick_draw(float seconds, Scene &scene);

private:
enum
{
KEY_MOVE_FORWARD,
KEY_MOVE_BACK,
KEY_MOVE_LEFT,
KEY_MOVE_RIGHT,
KEY_MOVE_UP,
KEY_MOVE_DOWN,
KEY_MOVE_JUMP,
KEY_QUIT,
KEY_MAX,
};

TileSet* m_cat_texture;
Shader* m_cat_shader;
Camera* m_camera;
Controller * m_controller;
Light * m_light1;
Light * m_light2;
bool m_ready;

//lol::phys::Simulation* m_simulation;
//array<EasyConstraint*> m_constraint_list;
//array<PhysicsObject*, float> m_physobj_list;
//array<PhysicsObject*> m_ground_list;
//array<PhysicsObject*> m_platform_list;
//array<PhysicsObject*> m_character_list;
//array<PhysicsObject*> m_stairs_list;

float m_loop_value;
float m_target_timer;
int m_cam_target;
float m_fov_dp;
float m_loc_dp;
};


+ 0
- 72
doc/samples/nacl_phystest.vcxproj Vedi File

@@ -1,72 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="LolMacros">
<LolDir Condition="Exists('$(SolutionDir)\lol')">$(SolutionDir)\lol</LolDir>
<LolDir Condition="!Exists('$(SolutionDir)\lol')">$(SolutionDir)</LolDir>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ORBIS">
<Configuration>Debug</Configuration>
<Platform>ORBIS</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ORBIS">
<Configuration>Release</Configuration>
<Platform>ORBIS</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="nacl_phystest.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="nacl_phystest.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(LolDir)\src\lol-core.vcxproj">
<Project>{9e62f2fe-3408-4eae-8238-fd84238ceeda}</Project>
</ProjectReference>
<ProjectReference Condition="'$(enable_bullet)'!='no'" Include="$(LolDir)\src\3rdparty\lol-bullet.vcxproj">
<Project>{83d3b207-c601-4025-8f41-01dedc354661}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Makefile.am">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</None>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{ee203b88-44cf-4859-9d42-7a1f43fecb53}</ProjectGuid>
<ConfigurationType>Application</ConfigurationType>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(LolDir)\build\msbuild\lol.config.props" />
<ImportGroup Label="ExtensionSettings">
<Import Project="$(LolDir)\build\msbuild\lolfx.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(LolDir)\build\msbuild\lol.vars.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<Import Project="$(LolDir)\build\msbuild\lol.rules.props" />
<ItemDefinitionGroup />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(LolDir)\build\msbuild\lolfx.targets" />
</ImportGroup>
</Project>

+ 0
- 20
doc/samples/nacl_phystest.vcxproj.filters Vedi File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClInclude Include="nacl_phystest.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="nacl_phystest.cpp" />
</ItemGroup>
<ItemGroup>
<Filter Include="generated">
<UniqueIdentifier>{4fc7662b-b17a-49b9-acd1-0cf767183b07}</UniqueIdentifier>
</Filter>
<Filter Include="physics">
<UniqueIdentifier>{ccecd634-9321-4c49-9471-e9da50dda6d4}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="Makefile.am" />
</ItemGroup>
</Project>

+ 0
- 17
doc/tutorial/11_fractal.cpp Vedi File

@@ -51,12 +51,7 @@ public:

/* Window size decides the world aspect ratio. For instance, 640×480
* will be mapped to (-0.66,-0.5) - (0.66,0.5). */
#if !defined __native_client__
m_window_size = Video::GetSize();
#else
/* FIXME: it's illegal to call this on the game thread! */
m_window_size = ivec2(640, 480);
#endif
if (m_window_size.y < m_window_size.x)
m_window2world = 0.5 / m_window_size.y;
else
@@ -98,14 +93,9 @@ public:
uint8_t red = (uint8_t)(rgb.r * 256);
uint8_t green = (uint8_t)(rgb.g * 256);
uint8_t blue = (uint8_t)(rgb.b * 256);
#if defined __native_client__
m_palette.push(u8vec4(red, green, blue, 255));
#else
m_palette.push(u8vec4(blue, green, red, 255));
#endif
}

#if !defined __native_client__
m_zoomtext = new Text("", "data/font/ascii.png");
m_zoomtext->SetPos(vec3(5, (float)m_window_size.y - 15, 1));
Ticker::Ref(m_zoomtext);
@@ -117,7 +107,6 @@ public:
m_mousetext = new Text("", "data/font/ascii.png");
m_mousetext->SetPos(vec3(5, (float)m_window_size.y - 43, 1));
Ticker::Ref(m_mousetext);
#endif

m_position = vec3::zero;
m_aabb.aa = m_position;
@@ -143,11 +132,9 @@ public:
m_donequeue.pop();
#endif

#if !defined __native_client__
Ticker::Unref(m_centertext);
Ticker::Unref(m_mousetext);
Ticker::Unref(m_zoomtext);
#endif
}

inline f128cmplx TexelToWorldOffset(vec2 texel)
@@ -299,7 +286,6 @@ public:
m_zoom_settings[i][1] -= 0.5f * (1.0f - m_zoom_settings[i][2]);
}

#if !defined __native_client__
char buf[256];
std::sprintf(buf, "center: ");
m_view.center.x.sprintf(buf + strlen(buf), 30);
@@ -313,7 +299,6 @@ public:
m_mousetext->SetText(buf);
std::sprintf(buf, "[%s] zoom: %g", m_julia ? "Julia" : "Mandelbrot", 1.0 / m_view.radius);
m_zoomtext->SetText(buf);
#endif

if (m_dirty[m_frame])
{
@@ -590,10 +575,8 @@ private:
queue<int> m_spawnqueue, m_jobqueue, m_donequeue;
#endif

#if !defined __native_client__
/* Debug information */
Text *m_centertext, *m_mousetext, *m_zoomtext;
#endif
};

int main(int argc, char **argv)


+ 0
- 10
src/Makefile.am Vedi File

@@ -21,7 +21,6 @@ liblol_core_a_SOURCES = \
$(liblol_core_sources) \
\
$(imgui_sources) \
$(nacl_sources) \
$(sdl_sources) \
$(d3d9_sources) \
$(android_sources)
@@ -156,15 +155,6 @@ imgui_sources += \
lolimgui.cpp lolimgui.h \
$(NULL)

if LOL_USE_NACL
nacl_sources = \
platform/nacl/nacl-app.cpp platform/nacl/nacl-app.h \
platform/nacl/nacl-instance.cpp platform/nacl/nacl-instance.h \
platform/nacl/nacl-module.cpp \
platform/nacl/opengl_context.cpp platform/nacl/opengl_context.h \
platform/nacl/opengl_context_ptrs.h
endif

android_sources = \
image/codec/android-image.cpp \
platform/android/androidapp.cpp platform/android/androidapp.h


+ 3
- 9
src/application/application.cpp Vedi File

@@ -18,9 +18,7 @@

#include "lolgl.h"

#if __native_client__
# include "platform/nacl/nacl-app.h"
#elif __ANDROID__
#if __ANDROID__
# include "platform/android/androidapp.h"
#elif LOL_USE_SDL
# include "platform/sdl/sdlapp.h"
@@ -73,9 +71,7 @@ class ApplicationDisplayData
{ }

protected:
#if __native_client__
//NOT HANDLED YET
#elif __ANDROID__
#if __ANDROID__
//NOT HANDLED YET
#elif LOL_USE_SDL
SdlAppDisplay display;
@@ -139,9 +135,7 @@ class ApplicationData
: app(name, res, framerate)
{ }

#if __native_client__
NaClApp app;
#elif __ANDROID__
#if __ANDROID__
AndroidApp app;
#elif LOL_USE_SDL
SdlApp app;


+ 1
- 1
src/gpu/texture.cpp Vedi File

@@ -64,7 +64,7 @@ Texture::Texture(ivec2 size, PixelFormat format)
{ 0, 0, 0, 0 }, /* Unknown */

/* FIXME: this is all mixed up for the RGBA/ARGB combinations */
#if defined __native_client__ || defined HAVE_GLES_2X
#if defined HAVE_GLES_2X
{ GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE, 1 },
{ GL_RGB, GL_RGB, GL_UNSIGNED_BYTE, 3 },
{ GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 4 },


+ 0
- 64
src/lol-core.vcxproj Vedi File

@@ -164,38 +164,6 @@
<ClCompile Include="messageservice.cpp" />
<ClCompile Include="platform.cpp" />
<ClCompile Include="platform\d3d9\d3d9input.cpp" />
<ClCompile Include="platform\nacl\nacl-app.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ORBIS'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ORBIS'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="platform\nacl\nacl-instance.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ORBIS'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ORBIS'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="platform\nacl\nacl-module.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ORBIS'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ORBIS'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="platform\nacl\opengl_context.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ORBIS'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ORBIS'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="platform\sdl\sdlapp.cpp">
<ExcludedFromBuild Condition="'$(enable_sdl)'=='no'">true</ExcludedFromBuild>
</ClCompile>
@@ -317,38 +285,6 @@
<ClInclude Include="numeric.h" />
<ClInclude Include="platform.h" />
<ClInclude Include="platform\d3d9\d3d9input.h" />
<ClInclude Include="platform\nacl\nacl-app.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ORBIS'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ORBIS'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="platform\nacl\nacl-instance.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ORBIS'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ORBIS'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="platform\nacl\opengl_context.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ORBIS'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ORBIS'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="platform\nacl\opengl_context_ptrs.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ORBIS'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ORBIS'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="platform\sdl\sdlapp.h">
<ExcludedFromBuild Condition="'$(enable_sdl)'=='no'">true</ExcludedFromBuild>
</ClInclude>


+ 2
- 27
src/lol-core.vcxproj.filter Vedi File

@@ -79,9 +79,6 @@
<Filter Include="platform\d3d9">
<UniqueIdentifier>{a914e15d-3201-467a-a9c9-d7c5244b13ee}</UniqueIdentifier>
</Filter>
<Filter Include="platform\nacl">
<UniqueIdentifier>{f6cc3470-c841-4581-969b-e60cea841c27}</UniqueIdentifier>
</Filter>
<Filter Include="image\dither">
<UniqueIdentifier>{63e63eea-c96e-4d37-81f6-f3f17e18b751}</UniqueIdentifier>
</Filter>
@@ -291,18 +288,8 @@
<ClCompile Include="MessageService.cpp">
<Filter>...</Filter>
</ClCompile>
<ClCompile Include="math\constants.cpp" />
<ClCompile Include="platform\nacl\nacl-app.cpp">
<Filter>platform\nacl</Filter>
</ClCompile>
<ClCompile Include="platform\nacl\nacl-instance.cpp">
<Filter>platform\nacl</Filter>
</ClCompile>
<ClCompile Include="platform\nacl\nacl-module.cpp">
<Filter>platform\nacl</Filter>
</ClCompile>
<ClCompile Include="platform\nacl\opengl_context.cpp">
<Filter>platform\nacl</Filter>
<ClCompile Include="math\constants.cpp">
<Filter>math</Filter>
</ClCompile>
<ClCompile Include="easymesh\easymeshrender.cpp">
<Filter>easymesh</Filter>
@@ -706,18 +693,6 @@
<ClInclude Include="messageservice.h">
<Filter>...</Filter>
</ClInclude>
<ClInclude Include="platform\nacl\nacl-app.h">
<Filter>platform\nacl</Filter>
</ClInclude>
<ClInclude Include="platform\nacl\nacl-instance.h">
<Filter>platform\nacl</Filter>
</ClInclude>
<ClInclude Include="platform\nacl\opengl_context.h">
<Filter>platform\nacl</Filter>
</ClInclude>
<ClInclude Include="platform\nacl\opengl_context_ptrs.h">
<Filter>platform\nacl</Filter>
</ClInclude>
<ClInclude Include="easymesh\easymeshrender.h">
<Filter>easymesh</Filter>
</ClInclude>


+ 0
- 6
src/lol/base/features.h Vedi File

@@ -195,12 +195,6 @@ namespace lol
}


/* XXX: workaround for a compilation bug in NaCl headers */
#if defined __native_client__
# define typeid(x) (*(type_info*)nullptr)
#endif


/* XXX: workaround for X11 headers that try to #define these */
#undef Always
#define Always Always


+ 2
- 4
src/lol/engine-internal.h Vedi File

@@ -22,10 +22,8 @@
# include "config.h"
#endif

/* If using NaCl or Android, override main() with our version */
#if __native_client__
# define main lol_nacl_main
#elif __ANDROID__
/* If using Android, override main() with our version */
#if __ANDROID__
# define main lol_android_main
#endif



+ 2
- 4
src/lol/engine.h Vedi File

@@ -17,10 +17,8 @@
// --------------------------------------
//

/* If using NaCl or Android, override main() with our version */
#if __native_client__
# define main lol_nacl_main
#elif __ANDROID__
/* If using Android, override main() with our version */
#if __ANDROID__
# define main lol_android_main
#endif



+ 0
- 3
src/lol/math/bigint.h Vedi File

@@ -29,9 +29,6 @@ namespace lol
#undef min
#undef max

/* Avoid issues with NaCl headers */
#undef log2

/*
* A bigint stores its digits in an array of integers. The MSB of the
* integers are unused. The highest used bit is the sign bit.


+ 2
- 2
src/lol/math/functions.h Vedi File

@@ -180,8 +180,8 @@ LOL_ATTR_NODISCARD static inline int16_t abs(int16_t x) { return std::abs(x); }
LOL_ATTR_NODISCARD static inline uint16_t abs(uint16_t x) { return x; }
LOL_ATTR_NODISCARD static inline int32_t abs(int32_t x) { return std::abs(x); }
LOL_ATTR_NODISCARD static inline uint32_t abs(uint32_t x) { return x; }
#if defined __native_client__ || defined __ANDROID__
/* The pepper 19 toolchain doesn't provide abs() for long long int. */
#if defined __ANDROID__
/* The Android toolchain doesn't provide abs() for int64_t. */
LOL_ATTR_NODISCARD static inline int64_t abs(int64_t x) { return x > 0 ? x : -x; }
#else
LOL_ATTR_NODISCARD static inline int64_t abs(int64_t x) { return std::abs(x); }


+ 0
- 3
src/lol/math/real.h Vedi File

@@ -29,9 +29,6 @@ namespace lol
#undef min
#undef max

/* Avoid issues with NaCl headers */
#undef log2

/*
* The base class for reals. The only real reason for making this a template
* class is so we can have implicit constructors ("real x = 1" works) but


+ 0
- 70
src/platform/nacl/nacl-app.cpp Vedi File

@@ -1,70 +0,0 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
//

#include <lol/engine-internal.h>

#include "nacl-app.h"
#include "nacl-instance.h"

namespace lol
{

/*
* NaCl App implementation class
*/

class NaClAppData
{
friend class NaClApp;

private:
#if defined __native_client__
#endif
};

/*
* Public NaClApp class
*/

NaClApp::NaClApp(char const *title, ivec2 res, float fps) :
data(new NaClAppData())
{
Ticker::Setup(fps);
#if defined __native_client__
#endif
}

void NaClApp::ShowPointer(bool show)
{
;
}

void NaClApp::Tick()
{
/* The caller should run forever */
#if defined __native_client__
static int init = 0;
if (!init)
{
NaClInstance::MainSignal();
init = 1;
}
#endif
}

NaClApp::~NaClApp()
{
#if defined __native_client__
#endif
delete data;
}

} /* namespace lol */


+ 0
- 39
src/platform/nacl/nacl-app.h Vedi File

@@ -1,39 +0,0 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
//

#pragma once

//
// The NaClApp class
// -----------------
//

#include <lol/math/vector.h>

namespace lol
{

class NaClAppData;

class NaClApp
{
public:
NaClApp(char const *title, ivec2 res, float fps);
virtual ~NaClApp();

void ShowPointer(bool show);
void Tick();

private:
NaClAppData *data;
};

} /* namespace lol */


+ 0
- 277
src/platform/nacl/nacl-instance.cpp Vedi File

@@ -1,277 +0,0 @@
// Copyright (c) 2011 The Native Client Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <lol/engine-internal.h>

#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>

#include <ppapi/cpp/rect.h>
#include <ppapi/cpp/size.h>
#include <ppapi/cpp/var.h>
#include <ppapi/cpp/module.h>
#include <ppapi/cpp/completion_callback.h>

#include "platform/nacl/nacl-instance.h"
#include "platform/nacl/opengl_context.h"

/* One of these wrappers will be overridden by the user's version */
void lol_nacl_main(void) __attribute__((weak));
void lol_nacl_main(void) {}
void lol_nacl_main(int argc, char **argv) __attribute__((weak));
void lol_nacl_main(int argc, char **argv) { UNUSED(argc, argv); }
void lol_nacl_main(int argc, char **argv, char **envp) __attribute__((weak));
void lol_nacl_main(int argc, char **argv, char **envp) { UNUSED(argc, argv, envp); }

namespace lol
{

/*
* NACL Input implementation class
* This is a ripoff of the SDL one
*/

NaClInstance::NaClInstance(PP_Instance instance)
: pp::Instance(instance),
m_size(0, 0)
{
RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE | PP_INPUTEVENT_CLASS_WHEEL);
RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD);

m_input_data = new NaClInputData();
m_input_data->m_keyboard = InputDeviceInternal::CreateStandardKeyboard();
m_input_data->m_mouse = InputDeviceInternal::CreateStandardMouse();
}

NaClInstance::~NaClInstance()
{
// Destroy the cube view while GL context is current.
m_opengl_ctx->MakeContextCurrent(this);
delete m_input_data;
}

static double const DELTA_MS = 1000.0 / 60.0;

void NaClInstance::TickCallback(void* data, int32_t result)
{
UNUSED(result);
NaClInstance *instance = (NaClInstance *)data;
instance->DrawSelf();

/* FIXME: only set if if Ticker isn't finished */
pp::Module::Get()->core()->CallOnMainThread(
DELTA_MS, pp::CompletionCallback(&TickCallback, data), PP_OK);

//Tick input : TODO: DELTA_MS is not exactly kasher ?
instance->m_input_data->Tick(DELTA_MS);
}

mutex NaClInstance::main_mutex;
queue<NaClInstance::Args *, 1> NaClInstance::main_queue;

bool NaClInstance::Init(uint32_t argc,
const char* /* argn */[],
const char* argv[])
{
/* Ensure only one NaClInstance does Init() at the same time. */
main_mutex.Lock();
char *env[] = { nullptr };
Args arglist(argc, const_cast<char **>(argv), const_cast<char **>(env));
main_queue.push(&arglist);
m_main_thread = new thread(MainRun, nullptr);
/* Push so that only MainSignal() can unblock us */
main_queue.push(nullptr);
main_queue.push(nullptr);
main_mutex.Unlock();

// My timer callback
pp::Module::Get()->core()->CallOnMainThread(
DELTA_MS, pp::CompletionCallback(&TickCallback, this), PP_OK);

/* The gamepad interface */
m_pad_interface = static_cast<PPB_Gamepad const *>(
pp::Module::Get()->GetBrowserInterface(PPB_GAMEPAD_INTERFACE));

return true;
}

void * NaClInstance::MainRun(void *data)
{
UNUSED(data);
Args *arglist = main_queue.pop();

/* Call the user's main() function. One of these will work. */
lol_nacl_main();
lol_nacl_main(arglist->m_argc, arglist->m_argv);
lol_nacl_main(arglist->m_argc, arglist->m_argv, arglist->m_env);

return nullptr;
}

void NaClInstance::MainSignal()
{
/* FIXME: find something more elegant. */
main_queue.pop();
main_queue.pop();
}

void NaClInstance::HandleMessage(const pp::Var& message)
{
if (!message.is_string())
return;

/* FIXME: do some shit here */
MessageService::Send(MessageBucket::AppIn, message.AsString().c_str());
}

void NaClInstance::DidChangeView(const pp::Rect& position, const pp::Rect& clip)
{
UNUSED(clip);
if (position.size().width() == m_size.x &&
position.size().height() == m_size.y)
return; // Size didn't change, no need to update anything.

m_size = ivec2(position.size().width(), position.size().height());

if (m_opengl_ctx == nullptr)
m_opengl_ctx.reset(new OpenGLContext(this));
m_opengl_ctx->InvalidateContext(this);
m_opengl_ctx->ResizeContext(position.size());
if (!m_opengl_ctx->MakeContextCurrent(this))
return;

Video::Setup(m_size);
DrawSelf();
}

bool NaClInstance::HandleInputEvent(const pp::InputEvent& event)
{
m_input_data->m_input_events << event;
return true;
}

void NaClInstance::DrawSelf()
{
if (m_opengl_ctx == nullptr)
return;

m_opengl_ctx->MakeContextCurrent(this);
Ticker::tick_draw();
m_opengl_ctx->FlushContext();
}

void NaClInputData::Tick(float seconds)
{
UNUSED(seconds);
if (!IsViewportSizeValid())
InitViewportSize();

//Init cursor position, if mouse didn't move.
ivec2 mousepos = m_mouse->GetCursorPixelPos(0);
vec2 mousepos_prev = vec2(mousepos);
/* Handle keyboard and WM events */
for (int i = 0; i < m_input_events.count(); ++i)
{
pp::InputEvent &e = m_input_events[i];
switch (e.GetType())
{
case PP_INPUTEVENT_TYPE_MOUSEDOWN:
case PP_INPUTEVENT_TYPE_MOUSEUP:
{
pp::MouseInputEvent em = pp::MouseInputEvent(e);
//Show probably do a switch.
if (em.GetButton() != PP_INPUTEVENT_MOUSEBUTTON_NONE)
m_mouse->SetKey(em.GetButton(), em.GetType() == PP_INPUTEVENT_TYPE_MOUSEDOWN);
break;
}
case PP_INPUTEVENT_TYPE_MOUSELEAVE:
case PP_INPUTEVENT_TYPE_MOUSEENTER:
{
/* TODO: "InScreen" idx hardcoded, not nice */
pp::MouseInputEvent em = pp::MouseInputEvent(e);
m_mouse->SetKey(3, em.GetType() == PP_INPUTEVENT_TYPE_MOUSEENTER);
break;
}
case PP_INPUTEVENT_TYPE_MOUSEMOVE:
{
pp::MouseInputEvent em = pp::MouseInputEvent(e);
mousepos = ivec2(em.GetPosition().x(), em.GetPosition().y());
break;
}
case PP_INPUTEVENT_TYPE_WHEEL:
{
/* TODO: MOUSE WHEEL NOT IMPLEMENTED IN LOL */
break;
}
// Use ?
//case PP_INPUTEVENT_TYPE_RAWKEYDOWN:
//case PP_INPUTEVENT_TYPE_CHAR:
case PP_INPUTEVENT_TYPE_KEYDOWN:
case PP_INPUTEVENT_TYPE_KEYUP:
{
pp::KeyboardInputEvent ek = pp::KeyboardInputEvent(e);
m_keyboard->SetKey(ek.GetKeyCode(), ek.GetType() == PP_INPUTEVENT_TYPE_KEYUP);
break;
}
case PP_INPUTEVENT_TYPE_UNDEFINED:
default:
{
break;
}
}
}
m_input_events.clear();

/* Handle mouse input */
if (IsViewportSizeValid())
{
if (mousepos.x >= 0 && mousepos.x < m_app.x && mousepos.y >= 0 && mousepos.y < m_app.y)
{
//We need the max if we want coherent mouse speed between axis
float max_screen_size = lol::max(m_screen.x, m_screen.y);
vec2 vmousepos = vec2(mousepos);
m_mouse->SetCursor(0, vmousepos / m_app, mousepos);
// Note: 100.0f is an arbitrary value that makes it feel about the same than an xbox controller joystick
m_mouse->SetAxis(0, (vmousepos.x - mousepos_prev.x) * 100.0f / max_screen_size);
// Unlike SDL, no need to negate Y axis.
m_mouse->SetAxis(1, (vmousepos.y - mousepos_prev.y) * 100.0f / max_screen_size);
}

if (m_mousecapture)
{
/*
mousepos = ivec2(m_app * .5f);
NaClInputData::SetMousePos(mousepos);
*/
}
}
}

//----
void NaClInputData::InitViewportSize()
{
if (Scene::GetCount())
{
m_app = vec2(Video::GetSize());
//Dunno if its the good idea.
m_screen = vec2(Video::GetSize());
}
else
{
m_app = vec2(-1.f);
m_screen = vec2(-1.f);
}
}

void NaClInputData::SetMousePos(ivec2 position)
{
UNUSED(position);
//? How to do that ?
//SDL_WarpMouse((uint16_t)position.x, (uint16_t)position.y);
}

} // namespace lol


+ 0
- 106
src/platform/nacl/nacl-instance.h Vedi File

@@ -1,106 +0,0 @@
// Copyright (c) 2011 The Native Client Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#pragma once

#include <ppapi/cpp/instance.h>
#include <ppapi/c/ppb_gamepad.h>
#include <ppapi/cpp/input_event.h>

#include "platform/nacl/opengl_context.h"
#include "platform/nacl/opengl_context_ptrs.h"

#include "input/input.h"
#include "input/input_internal.h"

namespace lol {

class NaClInputData
{
friend class NaClInstance;

private:
void Tick(float seconds);
bool IsViewportSizeValid() { return (m_app.x > 0.f && m_app.y > 0.f && m_screen.x > 0.f && m_screen.y > 0.f); }
void InitViewportSize();

static void SetMousePos(ivec2 position);

NaClInputData()
: m_mousecapture(false)
{
InitViewportSize();
}

array<class pp::InputEvent> m_input_events;
class InputDeviceInternal* m_mouse;
class InputDeviceInternal* m_keyboard;

vec2 m_app;
vec2 m_screen;
bool m_mousecapture;
};

class NaClInstance : public pp::Instance
{
public:
explicit NaClInstance(PP_Instance instance);

// The dtor makes the 3D context current before deleting the cube view, then
// destroys the 3D context both in the module and in the browser.
virtual ~NaClInstance();

// Called by the browser when the NaCl module is loaded and all ready to go.
virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]);

// Called whenever the in-browser window changes size.
virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip);

// Called by the browser to handle the postMessage() call in Javascript.
virtual void HandleMessage(const pp::Var& message);

// Bind and publish the module's methods to JavaScript.
//void InitializeMethods(ScriptingBridge* bridge);

// Called to draw the contents of the module's browser area.
virtual bool HandleInputEvent(const pp::InputEvent& event);

void DrawSelf();

/* Communication with the application object */
static void MainSignal();

private:
SharedOpenGLContext m_opengl_ctx;

ivec2 m_size;

static void TickCallback(void* data, int32_t result);
static void * MainRun(void *data);

/* Gamepad support */
PPB_Gamepad const *m_pad_interface;

//12/09/2013 : Should use new system.
NaClInputData *m_input_data;

/* Communication with the application object */
struct Args
{
Args(int argc, char **argv, char **env)
: m_argc(argc), m_argv(argv), m_env(env) {}
Args() {}

int m_argc;
char **m_argv;
char **m_env;
};
static mutex main_mutex;
static queue<Args *, 1> main_queue;

Thread *m_main_thread;
};

} // namespace lol


+ 0
- 57
src/platform/nacl/nacl-module.cpp Vedi File

@@ -1,57 +0,0 @@
// Copyright (c) 2011 The Native Client Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <lol/engine-internal.h>

#include <ppapi/cpp/instance.h>
#include <ppapi/cpp/module.h>
#include <ppapi/gles2/gl2ext_ppapi.h>

#include "lolgl.h" /* needed for GL_TRUE */

#include "platform/nacl/nacl-instance.h"

/// The Module class. The browser calls the CreateInstance() method to create
/// an instance of your NaCl module on the web page. The browser creates a new
/// instance for each <embed> tag with type="application/x-nacl".
class NaClModule : public pp::Module
{
public:
NaClModule() : pp::Module() {}
virtual ~NaClModule()
{
glTerminatePPAPI();
}

/// Called by the browser when the module is first loaded and ready to run.
/// This is called once per module, not once per instance of the module on
/// the page.
virtual bool Init()
{
return glInitializePPAPI(get_browser_interface()) == GL_TRUE;
}

/// Create and return a Lol instance object.
/// @param[in] instance The browser-side instance.
/// @return the plugin-side instance.
virtual pp::Instance* CreateInstance(PP_Instance instance)
{
return new lol::NaClInstance(instance);
}
};

namespace pp
{
/// Factory function called by the browser when the module is first loaded.
/// The browser keeps a singleton of this module. It calls the
/// CreateInstance() method on the object you return to make instances. There
/// is one instance per <embed> tag on the page. This is the main binding
/// point for your NaCl module with the browser.
Module* CreateModule()
{
return new NaClModule();
}

} // namespace pp


+ 0
- 87
src/platform/nacl/opengl_context.cpp Vedi File

@@ -1,87 +0,0 @@
// Copyright (c) 2011 The Native Client Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <lol/engine-internal.h>

#include <ppapi/cpp/completion_callback.h>
#include <ppapi/gles2/gl2ext_ppapi.h>

#include "platform/nacl/opengl_context.h"

namespace {
// This is called by the brower when the 3D context has been flushed to the
// browser window.
void FlushCallback(void* data, int32_t result) {
static_cast<lol::OpenGLContext*>(data)->set_flush_pending(false);
}
} // namespace

namespace lol {

OpenGLContext::OpenGLContext(pp::Instance* instance)
: pp::Graphics3DClient(instance),
flush_pending_(false) {
pp::Module* module = pp::Module::Get();
assert(module);
gles2_interface_ = static_cast<const struct PPB_OpenGLES2*>(
module->GetBrowserInterface(PPB_OPENGLES2_INTERFACE));
assert(gles2_interface_);
}

OpenGLContext::~OpenGLContext() {
glSetCurrentContextPPAPI(0);
}

bool OpenGLContext::MakeContextCurrent(pp::Instance* instance)
{
if (instance == nullptr)
{
glSetCurrentContextPPAPI(0);
return false;
}
// Lazily create the Pepper context.
if (context_.is_null()) {
int32_t attribs[] = {
PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8,
PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 24,
PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 8,
PP_GRAPHICS3DATTRIB_SAMPLES, 0,
PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, 0,
PP_GRAPHICS3DATTRIB_WIDTH, size_.width(),
PP_GRAPHICS3DATTRIB_HEIGHT, size_.height(),
PP_GRAPHICS3DATTRIB_NONE
};
context_ = pp::Graphics3D(instance, pp::Graphics3D(), attribs);
if (context_.is_null()) {
glSetCurrentContextPPAPI(0);
return false;
}
instance->BindGraphics(context_);
}
glSetCurrentContextPPAPI(context_.pp_resource());
return true;
}

void OpenGLContext::InvalidateContext(pp::Instance* instance) {
glSetCurrentContextPPAPI(0);
}

void OpenGLContext::ResizeContext(const pp::Size& size) {
size_ = size;
if (!context_.is_null()) {
context_.ResizeBuffers(size.width(), size.height());
}
}


void OpenGLContext::FlushContext() {
if (flush_pending()) {
// A flush is pending so do nothing; just drop this flush on the floor.
return;
}
set_flush_pending(true);
context_.SwapBuffers(pp::CompletionCallback(&FlushCallback, this));
}
} // namespace lol


+ 0
- 92
src/platform/nacl/opengl_context.h Vedi File

@@ -1,92 +0,0 @@
// Copyright (c) 2011 The Native Client Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#pragma once

///
/// @file
/// OpenGLContext manages the OpenGL context in the browser that is associated
/// with a @a pp::Instance instance.
///

#include <assert.h>

#include <algorithm>
#include <string>

#include <ppapi/c/ppb_opengles2.h>
#include <ppapi/cpp/graphics_3d_client.h>
#include <ppapi/cpp/graphics_3d.h>
#include <ppapi/cpp/instance.h>
#include <ppapi/cpp/size.h>

#include "platform/nacl/opengl_context_ptrs.h"

namespace lol {

/// OpenGLContext manages an OpenGL rendering context in the browser.
///
class OpenGLContext : public pp::Graphics3DClient {
public:
explicit OpenGLContext(pp::Instance* instance);

/// Release all the in-browser resources used by this context, and make this
/// context invalid.
virtual ~OpenGLContext();

/// The Graphics3DClient interfcace.
virtual void Graphics3DContextLost() {
assert(!"Unexpectedly lost graphics context");
}

/// Make @a this the current 3D context in @a instance.
/// @param instance The instance of the NaCl module that will receive the
/// the current 3D context.
/// @return success.
bool MakeContextCurrent(pp::Instance* instance);

/// Flush the contents of this context to the browser's 3D device.
void FlushContext();

/// Make the underlying 3D device invalid, so that any subsequent rendering
/// commands will have no effect. The next call to MakeContextCurrent() will
/// cause the underlying 3D device to get rebound and start receiving
/// receiving rendering commands again. Use InvalidateContext(), for
/// example, when resizing the context's viewing area.
void InvalidateContext(pp::Instance* instance);

/// Resize the context.
void ResizeContext(const pp::Size& size);

pp::Size const& GetSize() { return size_; }

/// The OpenGL ES 2.0 interface.
const struct PPB_OpenGLES2* gles2() const {
return gles2_interface_;
}

/// The PP_Resource needed to make GLES2 calls through the Pepper interface.
PP_Resource gl_context() const {
return context_.pp_resource();
}

/// Indicate whether a flush is pending. This can only be called from the
/// main thread; it is not thread safe.
bool flush_pending() const {
return flush_pending_;
}
void set_flush_pending(bool flag) {
flush_pending_ = flag;
}

private:
pp::Size size_;
pp::Graphics3D context_;
bool flush_pending_;

const struct PPB_OpenGLES2* gles2_interface_;
};

} // namespace lol


+ 0
- 19
src/platform/nacl/opengl_context_ptrs.h Vedi File

@@ -1,19 +0,0 @@
// Copyright (c) 2011 The Native Client Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#pragma once

// A convenience wrapper for a shared OpenGLContext pointer type. As other
// smart pointer types are needed, add them here.

#include <tr1/memory>

namespace lol {

class OpenGLContext;

typedef std::tr1::shared_ptr<OpenGLContext> SharedOpenGLContext;

} // namespace lol


Caricamento…
Annulla
Salva