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
Removed all domain mapping code: | |
* There isn't a single mapping function that will uniformly map voxels to the sphere. The best mapping is perfect on the centre of each cube face, but as they get closer to each other, they skew significantly. They also change size! This is an unacceptable compromise simply to allow Minecraft-style editing of the world. | |
* All complexity is off-loaded the clients in that they have to continuously map between domains. This makes stuff like the SVO, sculpting, normal calculations and any voxel reasoning of the world (e.g. voxel based AO or lighting), much much harder (and slower). | |
* I would still need to build a system that can host 6 octrees with 1 per face and seamlessly tessellate between them. | |
* The entire thing is completely non-intuitive and just an extra thing to remember that will trip me up constantly when working with this system. | |
There needs to be another solution... |
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
rend::Voxel svo::GetVoxel(Database& db, NodeData& node_data, const math::vec3i& voxel_index) | |
{ | |
013017A0 55 push ebp | |
013017A1 8B EC mov ebp,esp | |
return LookupVoxel(db, node_data, voxel_index); | |
013017A3 8B 45 14 mov eax,dword ptr [voxel_index] | |
013017A6 50 push eax | |
013017A7 8B 4D 10 mov ecx,dword ptr [node_data] | |
013017AA 51 push ecx | |
013017AB 8B 55 0C mov edx,dword ptr [db] |
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
struct Type | |
{ | |
Type(float value) : value(value); | |
operator float() const { return value; } | |
float value; | |
}; | |
Type t(1.5f); | |
float new_value = true ? t : 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
// | |
// Oh dear! | |
// | |
struct Container | |
{ | |
Container(); | |
~Container(); | |
struct DependentTypeA& a; |
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
// ----- math.h -------------------------------------- | |
namespace math | |
{ | |
// Simple types with exposed data members, no constructors and multiple addressing modes | |
// No templates in the public API | |
struct quatf | |
{ | |
union |
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
// ===================================================================================================================== | |
// Assembler.h | |
// ===================================================================================================================== | |
// COMPILE-TIME SHADER ASSEMBLER | |
#ifndef _INCLUDED_ASSEMBLER_H |
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
I already have this separation: | |
*CmpActionSelect*: C++ native component that controls which action is active for the entity. | |
*ActionSelectWindow*: Javascript browser class that displays an action select HUD. | |
Whenever *CmpActionSelect* does something, it needs to tell *ActionSelectWindow* to update. I have these options: | |
1. Finish complete object replication feature that allows Javascript code to inspect native objects. *ActionSelectWindow* then periodically polls state of *CmpActionSelect* or reacts to specific object/property changes remotely. | |
2. Send RPC messages from *CmpActionSelect* to *ActionSelectWindow* whenever new actions are selected. | |
3. Create an intermediate native component that reacts to event changes in *CmpActionSelect* and sends RPC messages to *ActionSelectWindow*. |
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
// Assume a header file with a container of items | |
// Container.h | |
// ------------------------------------------------- | |
#include <vector> | |
// Forward-declared to avoid included header file | |
struct Item; | |
struct Container | |
{ |
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
# | |
# Correcting Art of Assembly's flawed acos implementation in Chapter 14 | |
# http://flint.cs.yale.edu/cs422/doc/art-of-asm/pdf/CH14.PDF | |
# | |
import math | |
# Alias commonly used math functions |
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
const char* cudaGetErrorEnum(cudaError_t error) | |
{ | |
const clcpp::Enum* enum_type = clcpp::GetType<cudaError_t>()->AsEnum(); | |
for (u32 i = 0; i < enum_type->constants.size; i++) | |
{ | |
const clcpp::EnumConstant* constant = enum_type->constants[i]; | |
if (constant->value == error) | |
return constant->name.text; | |
} |