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
context.specular_color = GetSpecularColor(); | |
CONTEXT_IFNOT(context.specular_color) { | |
context.specular_color = specularColor; | |
} |
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
class Test {}; | |
int main() | |
{ | |
// create manually | |
Test *t = static_cast<Test*>(operator new(sizeof(Test))); | |
new(t) Test; | |
// destroy manually | |
t->~Test(); | |
operator delete(t); |
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
#include <iostream> | |
#import <Foundation/Foundation.h> | |
@interface TestObj : NSObject | |
@end | |
@implementation TestObj | |
-(id)init { | |
self = [super init]; |
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
window.onload = function() { | |
var c = document.getElementById("myCanvas"); | |
c.onEngineImageDataUpdated = function (name, image) { | |
var c = document.getElementById("myCanvas"); | |
var ctx = c.getContext("2d"); | |
ctx.clearRect(0, 0, c.width, c.height); | |
ctx.putImageData(image, 0, 0); | |
ctx.fillStyle = "white"; | |
ctx.font = "16pt Consolas"; |
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
#include <stdlib.h> | |
#include <cassert> | |
#include <memory> | |
#include <thread> | |
#include <vector> | |
#include <string> | |
#include <chrono> | |
#include <iostream> |
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
#include "stdafx.h" | |
#include <unordered_set> | |
#include <memory> | |
#include <chrono> | |
#include <vector> | |
#include <algorithm> | |
#include <cmath> | |
#include <iostream> | |
#include <sparsehash/dense_hash_set> |
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
// Data-oriented variant for drawing moving shapes | |
struct Positions | |
{ | |
unsigned Count; | |
float* Xs; // Simplify SIMD-ification | |
float* Ys; | |
}; | |
struct ShapePositions |
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
template | |
void Unite2D(const Rectangle& other, bool allowEmpty = false) | |
{ | |
static_assert(sizeof...(Components) >= sizeof...(RhsComponents), "Cannot assign to type with less components than operand!"); | |
static_assert(meta_contains_types<meta_packer, meta_packer>::value, "Operand has components that are not part of this object!"); | |
m_Value.Unite2D(other.m_Value, allowEmpty); | |
} |
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
inline BlendingState BlendingMode2State(BlendModes mode) | |
{ | |
static BlendingState states[] = { | |
{ /* Clear */ | |
true, | |
BC_Zero, | |
BC_Zero, | |
BLOP_Add, | |
BC_Zero, | |
BC_Zero, |
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
static const BlendingState s_BlendingModes2State[] = { | |
{ /* Clear */ | |
true, | |
BC_Zero, | |
BC_Zero, | |
BLOP_Add, | |
BC_Zero, | |
BC_Zero, | |
BLOP_Add, | |
}, |