This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This code is in the public domain -- Ignacio Castaño <[email protected]> | |
#include "Sphere.h" | |
#include "Vector.inl" | |
#include "Box.inl" | |
#include <float.h> // FLT_MAX | |
using namespace nv; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I didn't think there was much to gain from optimizing quantization intervals for vertex compression, but I thought it would give it a try and see it for myself. | |
I have a set of vertices X that I want to quantize. The trivial way to do that is to transform them to the [0,1] range and store them using an integer UNORM format. | |
At runtime the vertices are reconstructed as follows: | |
X = Q * m + a | |
Where: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "hemicube.h" | |
#define PACK_HEMICUBES 1 | |
static void get_hemicube_face_normal(int index, Vector3 *forward, Vector3 *left, Vector3 *up) { | |
// Unwrapped hemicube with positive-Z in the middle. | |
switch (index) { | |
case 0: *forward = Vector3(+1, 0, 0); *left = Vector3( 0, 1, 0); break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For C++11 support compile with: | |
// clang++ -std=c++11 -stdlib=libc++ scope.cpp | |
#include <stdio.h> | |
#include <stdlib.h> | |
template <typename F> | |
struct ScopeExit { | |
ScopeExit(F f) : f(f) {} | |
~ScopeExit() { f(); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*=========================================================================== | |
Title: BSpline.cpp | |
Module: Pi/MathLib | |
Author: Ignacio Castaño | |
Date: 29/05/2000 | |
License: Public Domain | |
===========================================================================*/ | |
/*---------------------------------------------------------------------------- | |
Doc: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <intrin.h> // __rdtsc | |
#include <stdio.h> | |
typedef unsigned int uint; | |
typedef unsigned short uint16; | |
typedef unsigned long long uint64; | |
// ISPC functions: | |
extern "C" void half_to_float_test(const uint16 * vin, float * vout, int count); | |
extern "C" void half_to_float_test_fast(const uint16 * vin, float * vout, int count); |
NewerOlder