Skip to content

Instantly share code, notes, and snippets.

View krupitskas's full-sized avatar
⛈️

Krupitskas Nikita krupitskas

⛈️
View GitHub Profile
@krupitskas
krupitskas / bit_pack.cpp
Created August 18, 2022 16:50
Bit packing
/*
00000001 10000000 | 00000001 10000001
0000001 0000000 | 0000001 0000001
0000001 0000000 | 00000010000001
128 | 129
*/
#include <cstdint>
#include <cstring>
float4 PSMain(float4 position : SV_POSITION, float2 uv : TEXCOORD0 ) : SV_Target
{
const float cExtinctionFactor = Params.Config.x;
const float cDensity = Params.Config.y;
const int cNumSamples = Params.Config.z;
const float cCutoffDist = Params.Config.w;
const float depth = Depth.Sample(PointSampler, uv).r;
const float4 vsPos = float4(screen_to_view(Params.Projection, uv, depth), 1.0f);
const float distToPos = length(vsPos);
@krupitskas
krupitskas / diffuse_with_shadow.glsl
Created August 7, 2018 21:29
Shadertoy diffuse with shadow
const float EPSILON = 0.0001;
// ----- Primitives
float sdSphere(vec3 o, float r)
{
return length(o) - r;
}
float sdBox( vec3 p, vec3 b )
@krupitskas
krupitskas / gist:034c196eb1eca48e741a
Created January 13, 2015 21:11
Havok Hello world
/*
*
* Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's
* prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok.
* Product and Trade Secret source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2014 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
*
*/
// Math and base include
#include <Common/Base/hkBase.h>
#include <irrlicht.h>
#include <cstdlib>
#include <list>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
//Havok init
while (cin.fail()) {
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(),'\n');
cerr << "Введено некорректное значение."<<"\nВведите угол a: ";
cin >> a;
}
#pragma comment (lib, "dinput8.lib")
#pragma comment (lib, "dxguid.lib")
#include <dinput.h>
#include <windows.h>
#include <d3d11.h>
#include <d3dx11.h>
#include <d3dcompiler.h>
#include <xnamath.h>
#include "resource.h"
#include <D3dx9shape.h>
//--------------------------------------------------------------------------------------
// Урок 4. Нормали и простейший свет. Основан на примере из DX SDK (c) Microsoft Corp.
//--------------------------------------------------------------------------------------
#include <windows.h>
#include <d3d11.h>
#include <d3dx11.h>
#include <d3dcompiler.h>
#include <xnamath.h>
#include "resource.h"
#include <stdio.h>
#include <stdint.h>
#include <cstring>
#include <cstdlib>
#include <sys/stat.h>
typedef uint32_t DWORD;
typedef uint16_t WORD;