http://lightofdawn.org/wiki/wiki.cgi/-wiki/NewAppsOnOldGlibc
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
pushedT = (aTimeLft < aTimeRgh) ? aTimeRgh : aTimeLft; | |
... | |
int aStackOffset = theHit.Time < pushedT ? 2 : 1; | |
if (aHead - aStackOffset + 1 <= theSentinel) | |
return aTriIndex; | |
aNode = Stack[aHead - aStackOffset + 1]; |
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; |
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-"; |
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`. |
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(); | |
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; | |
} |
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; | |
} |
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]; |
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() << " " |
OlderNewer