My notes while reading the source code from threejs Editor app, as I've been curious about :
- the editor architecture
- the undo/redo system
- the camera control behaviour & code
- the object transform gizmos behaviours & code
import contextlib | |
import time | |
@contextlib.contextmanager | |
def time_print(prefix): | |
t0 = time.time() | |
yield | |
t1 = time.time() | |
print "'%s' time: %fmsec" % (prefix, (t1-t0)*1000) |
#!/usr/bin/env python | |
# -*-mode: python; coding: utf-8 -*- | |
# | |
# svn-import - Import a new release, such as a vendor drop. | |
# | |
# The "Vendor branches" chapter of "Version Control with Subversion" | |
# describes how to do a new vendor drop with: | |
# | |
# >The goal here is to make our current directory contain only the | |
# >libcomplex 1.1 code, and to ensure that all that code is under version |
#!/usr/bin/env python | |
# | |
# https://gist.github.com/2470162 | |
# | |
# Copyright (C) 2006 Martin Blais <blais at furius dot ca> | |
# 2008-02: Improvements by "Giovanni Bajo" <rasky at develer dot com> | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 2 of the License, or |
/* stbi-1.33 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c | |
when you control the images you're loading | |
no warranty implied; use at your own risk | |
NOTE this is a modified version : removed 'uint' typedef as it conflicted with <sys/types.h> on Android NDK r7b | |
and was not of much use anyway | |
https://gist.github.com/2774576 | |
QUICK NOTES: | |
Primarily of interest to game developers and other people who can |
/* | |
* rtgu_ktx.h - Version -1 WIP untested | |
* No endianness swap support | |
int ktx_load(ktx_image* i, ktx__context* k); | |
*/ | |
// TODO(nico) public typedefs |
I've been looking at the current master
source code, not a specific version : github commit b3ce68b4 on sept. 2019.
The source code is located in src/core/Raycaster.js
, and the doc is online.
A Raycaster
instance is constructed given a ray (origin point + direction vector) and a range on this ray (near, far distances), and offers the following API :
intersectObject( object, recursive, optionalTarget ) : Array
Once more, I'm struggling to wrap my head around the threejs API, here are my notes. | |
> **IMPORTANT** base on threejs `r114` (march 2020) | |
API topics covered : | |
* Scene and Object3D, hierarchy, transforms | |
* Maths, linear algebra | |
* DirectionalLight, as I'm currently trying to understand how to attach one of them to a Camera... |