Skip to content

Instantly share code, notes, and snippets.

View untodesu's full-sized avatar
💣
アイウエオ > アエイオウ

Kirill Dmitrievich untodesu

💣
アイウエオ > アエイオウ
View GitHub Profile
#include <stdint.h>
#define C_INF (double)(1e+300 * 1e+300)
#define C_NAN (double)(C_INF * 0.0)
// probably faster square root
// 0x1FF7A3BEA91D9B00 -- 0.5*4503599627370496*(1023-0.0450465)
double C_sqrt(double num)
{
// number should be positive
// interface.h implementation shit
#include <cstring> // strcmp, strncpy
#include "platform.h"
#include "interface.h"
#ifdef _WIN32
#include <Windows.h>
static constexpr char FS_CORRECT_SEP = '\\';
#include <cstdint> // uint32_t
#include <cstddef> // size_t
#include <cstring> // strcmp, strncpy
#include <cstdlib> // atoi, atof
#include <string> // std::to_string
#include "cvardef.h"
#include "cvar.h"
@untodesu
untodesu / stub.cc
Last active January 23, 2020 12:59
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <cmath>
#include "gfx/glsl.h"
#include "gfx/img.h"
#include "gfx/camera.h"
@untodesu
untodesu / glsl.cpp
Created January 23, 2020 09:43
GLSL
//-----------------------------------------------------------------------------
// /src/engine/gfx/glsl.cpp
// The GLSL Shader Helper functions & classes
//-----------------------------------------------------------------------------
#include <string> // std::string
#include <fstream> // std::ifstream
#include <sstream> // std::stringstream
#include <glm/gtc/type_ptr.hpp>
#include "gfx/glsl.h"
extends KinematicBody
# the user command structure
# this contains wish directions for player
var cmd = {
move_forward = 0.0,
move_right = 0.0,
move_up = 0.0, # is this actually needed here? Carmack, why?
};
// VoxelGame -- Unititled voxel game project
// (c) 2020, undbsd
// File: Player.cs
// Info: Player movement & input script
// Lastchange: Free-fly camera implemented
using Godot;
using System;
//------------------------------------------------------------------------------
// Player
@untodesu
untodesu / v16.c
Created March 4, 2020 15:59
Legacy V16 VM v0281 without interrupts. Use it however you want, embed it everywhere you want.
//==============================================================================
// Copyright (c) 2020, undbsd
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
#include "chunk.h"
namespace rg
{
TileChunk::TileChunk(sf::Texture &tileSet, const size_t tileSize) : m_tileSize(tileSize)
{
m_tileSet = &tileSet;
m_vbo = sf::VertexBuffer(sf::Quads, sf::VertexBuffer::Dynamic);
m_vbo.create(CHUNK_SIZE * CHUNK_SIZE * 4);
// ----------------------------------------------------------------------------
// CHROMATICABERRATION.CPP
//
// This file defines the C++ component of the chromatic aberration post processing shader.
// ----------------------------------------------------------------------------
#include "BaseVSShader.h"
#include "SDK_screenspaceeffect_vs20.inc"
#include "chromatic_aberration_ps20.inc"
#include "chromatic_aberration_ps20b.inc"