Skip to content

Instantly share code, notes, and snippets.

View Hexlord's full-sized avatar

Alexander Knorre Hexlord

View GitHub Profile
#pragma once
#include "Allocator/Allocator.h"
#include "Closure/Function.h"
#include "LambdaView.h"
#include "Meta/MetaFunction.h"
#include "Meta/MetaFunctor.h"
#include "Meta/MetaParameterPack.h"
namespace SE {
@Hexlord
Hexlord / wyhash.cpp
Created April 10, 2023 15:52
wyhash denoised
inline constexpr u64 _wyrot(u64 x) {
return (x >> 32) | (x << 32);
}
// 128bit multiply function.
inline constexpr void _wymum(u64 *A, u64 *B) {
#if defined(__SIZEOF_INT128__)
__uint128_t r = *A;
r *= *B;
*A = (u64)r;
*B = (u64)(r >> 64);
#pragma once
#include "Allocator/Allocator.h"
#include "Closure/Function.h"
#include "TypeMeta/TypeMeta.h"
namespace SE {
template<typename TAllocator>
class TTypeErasedArray;
#include "Collision.h"
#include "Modules/DebugPrimitives/DebugPrimitives.h"
#include "Modules/Environment/Environment.h"
#include "Modules/Health/Health.h"
#include "Modules/Movement/Movement.h"
#include "Modules/Primitives/PrimitivesTypes.h"
#include "Modules/Transform/Transform.h"
namespace SE {
@Hexlord
Hexlord / cref.h
Created October 14, 2022 17:56
cref implementation
// This class is at least 32 bytes long.
template<typename... Ts>
class cref {
public:
using TPrimaryType = Meta::TParameterPackFirstType<Ts...>;
cref() {
Clear();
}
cref(entity_view InEntity) {
static double accum = 0.0;
static ecs_time_t last_time;
static int counter = 0;
int ecs_term_finalize(
const ecs_world_t *world,
const char *name,
ecs_term_t *term)
{
static bool initialized = false;
// Main-threaded systems are always executed after the ECS tick, that's why such systems are listed in the end.
Impl::MultiThreadedSection([&]() {
/// Logic
Import<MLifespanSystemsMT>(ECS);
Import<MGeometryFluctuationSystemsMT>(ECS);
SetModuleEnabled<MGeometryFluctuationSystemsMT>(ECS, false);
// Update game state debug text.
Import<MGameStateSystemsMT>(ECS);
/// Physics
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
ofstream Out("Result.h");
Out << "template<typename... Ts>\n"
#include "flecs.h"
#include "inttypes.h"
#include <atomic>
#include <cstdio>
#include <ctime>
constexpr int ENTITIES = 1000;
constexpr int MILLION = 1000000;
constexpr int SAMPLE_COUNT = 10000;
constexpr bool MILTI_THREADED = true;
#include "flecs.h"
#include "inttypes.h"
#include <cstdio>
#include <ctime>
#include <atomic>
constexpr int ENTITIES = 1000;
constexpr int MILLION = 1000000;
constexpr int SAMPLE_COUNT = 10000;
constexpr bool MILTI_THREADED = true;