Difference between revisions of "Tips for Verge3D devs"
From Verge3D Wiki
Jump to navigationJump to search(71 intermediate revisions by the same user not shown) | |||
Line 64: | Line 64: | ||
These short links can be very helpful for debugging mobile devices. | These short links can be very helpful for debugging mobile devices. | ||
* [https://v3d.net/ar v3d.net/ar] — launch '''A'''ugmented '''R'''eality demo. | |||
* [https://v3d.net/c v3d.net/c] — launch basic '''C'''ube demo. | |||
* [https://v3d.net/g v3d.net/g] — launch '''G'''lobal Illumination demo. | |||
* [https://v3d.net/j v3d.net/j] — launch '''J'''ewelry Configurator. | |||
* [https://v3d.net/l v3d.net/l] — redirect to '''l'''ocal App Manager (http://localhost:8668/). | |||
* [https://v3d.net/m v3d.net/m] — open Verge3D User '''M'''anual. | |||
* [https://v3d.net/r v3d.net/r] — launch Industrial '''R'''obot Demo. | |||
* [https://v3d.net/s v3d.net/s] — '''S'''cooter Demo. | |||
* [https://v3d.net/t v3d.net/t] — '''T'''eapot Heater. | |||
* [https://v3d.net/v v3d.net/v] — W3C Markup '''V'''alidation Service. | |||
* [https://v3d.net/vr v3d.net/vr] — launch '''V'''irtual '''R'''eality demo. | |||
* [https://v3d.net/w v3d.net/w] — '''W'''ebGL System Report. | * [https://v3d.net/w v3d.net/w] — '''W'''ebGL System Report. | ||
== | == App Manager undocumented features == | ||
* [http://localhost:8668/get_preview_dir localhost:8668/get_preview_dir] — get path to preview directory. | |||
* [http://localhost:8668/update_all_apps localhost:8668/update_all_apps] — update all applications automatically (use with caution!). | |||
* [http://localhost:8668/restart localhost:8668/restart] — restart server. | |||
* [http://localhost:8668/stop localhost:8668/stop] — stop server. | |||
* [http://localhost:8668/reset localhost:8668/reset] — reset server settings. | |||
* [http://localhost:8668/log localhost:8668/log] — App Manager log. | |||
== Restoring console functions == | |||
<syntaxhighlight lang="javascript"> | |||
const i = document.createElement('iframe'); | |||
i.style.display = 'none'; | |||
document.body.appendChild(i); | |||
window.console = i.contentWindow.console; | |||
</syntaxhighlight> | |||
== Downloading Electron builds == | |||
gh release download v19.0.4 -D v19.0.4 -p 'electron-*64.zip' -p 'electron-*32.zip' -p 'SHASUMS256.txt' -R electron/electron | |||
== Install Python packages to local directory == | |||
pip install --target=dir_name package_name | |||
Latest revision as of 09:41, 15 March 2024
This page contains random tips and code snippets that Verge3D devs or Verge3D DevKit users may find useful for their work.
Getting v3d namespace from iframe
document.getElementsByTagName("iframe")[0].contentWindow.v3d
e.g. to print performance profile from the iframe:
document.getElementsByTagName("iframe")[0].contentWindow.v3d.apps[0].printPerformanceInfo()
or to enable FPS counter:
document.getElementsByTagName("iframe")[0].contentWindow.v3d.apps[0].showFPS()
Debugging Verge3D render target
Use the following code to create a plane with the output of the given render target:
// DONT FORGET TO REMOVE IT!
var texture = renderTarget.texture
var geometry = new v3d.PlaneBufferGeometry(3, 3);
var material = new v3d.MeshBasicMaterial();
material.map = texture;
var planeMesh = new v3d.Mesh(geometry, material);
planeMesh.position.x = 6;
v3d.apps[0].scene.add(planeMesh);
Code Indentation Style
The K&R style, 4 spaces:
function someFun() {
const someConst = 10;
const alwaysTrue = true;
for (let i = 0; i < someConst; i++) {
if (alwaysTrue) {
console.log(`Hello ${i}!`);
}
}
}
Key Triplets
There are several key triplets supported by Verge3D which are useful for debugging. To execute a triplet, wait until a Verge3D app finishes its loading, then press the same key thrice very quickly.
- PPP — print performance profile. See here for more info.
- FFF — show/hide FPS counter in the upper left corner of the rendered canvas.
- HHH — halt/continue application rendering.
Short Links
These short links can be very helpful for debugging mobile devices.
- v3d.net/ar — launch Augmented Reality demo.
- v3d.net/c — launch basic Cube demo.
- v3d.net/g — launch Global Illumination demo.
- v3d.net/j — launch Jewelry Configurator.
- v3d.net/l — redirect to local App Manager (http://localhost:8668/).
- v3d.net/m — open Verge3D User Manual.
- v3d.net/r — launch Industrial Robot Demo.
- v3d.net/s — Scooter Demo.
- v3d.net/t — Teapot Heater.
- v3d.net/v — W3C Markup Validation Service.
- v3d.net/vr — launch Virtual Reality demo.
- v3d.net/w — WebGL System Report.
App Manager undocumented features
- localhost:8668/get_preview_dir — get path to preview directory.
- localhost:8668/update_all_apps — update all applications automatically (use with caution!).
- localhost:8668/restart — restart server.
- localhost:8668/stop — stop server.
- localhost:8668/reset — reset server settings.
- localhost:8668/log — App Manager log.
Restoring console functions
const i = document.createElement('iframe');
i.style.display = 'none';
document.body.appendChild(i);
window.console = i.contentWindow.console;
Downloading Electron builds
gh release download v19.0.4 -D v19.0.4 -p 'electron-*64.zip' -p 'electron-*32.zip' -p 'SHASUMS256.txt' -R electron/electron
Install Python packages to local directory
pip install --target=dir_name package_name