http://lightofdawn.org/wiki/wiki.cgi/-wiki/NewAppsOnOldGlibc
View obj_export.cpp
This file contains 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
std::ofstream aFile ( "Mesh.obj" ); | |
for (int i = 0; i < aMesh->numVertices(); ++i) { | |
aFile << "v " << aMesh->vertices()[i].x() << " " | |
<< aMesh->vertices()[i].y() << " " | |
<< aMesh->vertices()[i].z() << std::endl; | |
} | |
for (int i = 0; i < aMesh->numVertices(); ++i) { | |
aFile << "vn " << aMesh->normals()[i].x() << " " |
View WriteMesh.cpp
This file contains 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
void BRepMesh_RestoreOrientationTool::WriteMesh (const std::string& theFileName) | |
{ | |
// write obj file | |
std::ofstream myfile; | |
myfile.open (theFileName); | |
const Handle(BRepMesh_TriangulatedPatch)& aPatch = myPatches.back(); | |
for (int i = 0; i < aPatch->Vertices.size(); ++i) { | |
BVH_Vec3d aVert = aPatch->Vertices[i]; |
View ColoredTable.cpp
This file contains 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
HANDLE hConsole = GetStdHandle (STD_OUTPUT_HANDLE); | |
const int aDefaultColor = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED; | |
auto printTable = [&](const std::set<Standard_Integer>& theRemSet) { | |
return; // disabled | |
std::cout << setw (3) << " "; | |
for (int j = 0; j < aTableSize; ++j) { | |
std::cout << setw (6) << j; | |
} |
View RandomGenerators.md
uint, LCG
http://www.reedbeta.com/blog/2013/01/12/quick-and-easy-gpu-random-numbers-in-d3d11/
int
https://github.com/openglsuperbible/sb6code/blob/master/bin/media/shaders/ssao/ssao.fs.glsl http://math.stackexchange.com/questions/337782/pseudo-random-number-generation-on-the-gpu
XOR
http://www.trentreed.net/blog/screen-space-ambient-occlusion/
View ocl_framework.cpp
This file contains 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
typedef double real; | |
typedef Eigen::Vector2d vec2; | |
typedef Eigen::Vector2i int2; | |
typedef Eigen::Vector4i int4; | |
vec2 mix (vec2 a, vec2 b, real c) { | |
return (a + b) * c; | |
} |
View Slerp
This file contains 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
// Spherical linear interpolation between unit quaternions q1 and q2 with interpolation parameter t. | |
Quaternion slerp(Quaternion q1, Quaternion q2, float t) | |
{ | |
float w1, x1, y1, z1, w2, x2, y2, z2, w3, x3, y3, z3; | |
Quaternion q2New; | |
float theta, mult1, mult2; | |
w1 = q1.getW(); x1 = q1.getX(); y1 = q1.getY(); z1 = q1.getZ(); | |
w2 = q2.getW(); x2 = q2.getX(); y2 = q2.getY(); z2 = q2.getZ(); | |
View OCCT codestyle (AStyle)
This file contains 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
{ | |
// NOTE: You should always edit options in user file, not this file. | |
// Print debug message | |
"debug": false, | |
// Auto format on file save | |
"autoformat_on_save": false, | |
// The mapping key is `syntax name`, and the value is `formatting mode`. |
View PrintPretty
This file contains 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
// ======================================================================= | |
// function : PrintPretty | |
// purpose : | |
// ======================================================================= | |
void RayTraceGPU_Node::PrintPretty (std::string thePrefix, bool isLeft, int theLevel) const | |
{ | |
if (IsLeaf()) | |
{ | |
thePrefix.erase(thePrefix.size() - 2, 2); | |
thePrefix += isLeft ? "|-" : "\xC0-"; |
View traverse opt
This file contains 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
ivec4 ObjectNearestHit (in int theBVHOffset, in int theVrtOffset, in int theTrgOffset, | |
in SRay theRay, in vec3 theInverse, inout SIntersect theHit, in int theSentinel) | |
{ | |
int aHead = theSentinel; // stack pointer | |
int aNode = 0; // node to visit | |
ivec4 aTriIndex = INALID_HIT; | |
float aTimeOut; | |
float aTimeLft; |