Skip to content

Instantly share code, notes, and snippets.

View rotoglup's full-sized avatar

Nicolas Lelong rotoglup

View GitHub Profile
@rotoglup
rotoglup / python_assert_debug_logging.py
Created July 19, 2011 18:34
python_assert_debug_logging - benchmark, using python assert to discard function calls and arguments evaluation
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)
@rotoglup
rotoglup / svn-import.py
Created February 14, 2012 16:52
svn-import python script meant as a replacement for svn_load_dirs.pl (from http://svn.haxx.se/users/archive-2006-10/0857.shtml) - changed to prevent window popups on windows + performance optimisation for 'add' phase
#!/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
@rotoglup
rotoglup / gist:2470162
Created April 23, 2012 10:43
svndumpfilter3
#!/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
@rotoglup
rotoglup / stb_image.c
Created May 23, 2012 11:04
Modified version of stb_image 1.33 to resolve a typedef conflict for 'uint' with Android NDK (r7b) (removed uint from stb_image)
/* 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
@rotoglup
rotoglup / graphics-companies.geojson
Last active December 6, 2019 11:01
A map of companies developping graphics software, in Europe
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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...

Based on my looking at ThreeJS r115dev source code, while trying to figure out how to customize the lighting by writing my own shader.

Materials

ThreeJS has the following Material classes :

  • MeshBasicMaterial, not affected by lights
  • MeshLambertMaterial: lighting is computed at each vertex, for diffuse lighting, and interpolated in gouraud like fashion

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...
@rotoglup
rotoglup / 202005 - threejs gotchas.md
Last active May 18, 2020 15:18
A personal list of traps if fell into using threejs

applyMatrix on Geometry does not flip faces when needed

applyMatrix, on Geometry or BufferGeometry, does not flip faces indices when applying a matrix that flips normals (determinant < 0).

see mrdoob/three.js#17361