include ':android' // Will pull in android/ folder as a subproject. I think you need this file even if you only have one project.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
// Principled PBR Path tracer. Except where otherwise noted: | |
// Copyright © 2019 Markus Moenig Distributed under The MIT License. | |
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF |
/* | |
The MIT License (MIT) | |
Copyright (c) 2018 Eric Arnebäck | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
The Gilbert–Johnson–Keerthi (GJK) distance algorithm is a method of determining the minimum distance between two convex sets. The algorithm's stability, speed which operates in near-constant time, and small storage footprint make it popular for realtime collision detection.
Unlike many other distance algorithms, it has no requirments on geometry data to be stored in any specific format, but instead relies solely on a support function to iteratively generate closer simplices to the correct answer using the Minkowski sum (CSO) of two convex shapes.
// Uniform array of 4 vec3 for SH environment lighting | |
// Computed from "Ditch River" (http://www.hdrlabs.com/sibl/archive.html) | |
static const vec3 sphericalHarmonics[4] = { | |
{ 0.754554516862612, 0.748542953903366, 0.790921515418539 }, | |
{ -0.083856548007422, 0.092533500963210, 0.322764661032516 }, | |
{ 0.308152705331738, 0.366796330467391, 0.466698181299906 }, | |
{ -0.188884931542396, -0.277402551592231, -0.377844212327557 } | |
}; | |
// Fragment shader, "n" is the normal at the shading point |
/* | |
* edtaa3() | |
* | |
* Sweep-and-update Euclidean distance transform of an | |
* image. Positive pixels are treated as object pixels, | |
* zero or negative pixels are treated as background. | |
* An attempt is made to treat antialiased edges correctly. | |
* The input image must have pixels in the range [0,1], | |
* and the antialiased image should be a box-filter | |
* sampling of the ideal, crisp edge. |
// The following code is licensed under the MIT license: https://gist.github.com/TheRealMJP/bc503b0b87b643d3505d41eab8b332ae | |
// Samples a texture with Catmull-Rom filtering, using 9 texture fetches instead of 16. | |
// See http://vec3.ca/bicubic-filtering-in-fewer-taps/ for more details | |
float4 SampleTextureCatmullRom(in Texture2D<float4> tex, in SamplerState linearSampler, in float2 uv, in float2 texSize) | |
{ | |
// We're going to sample a a 4x4 grid of texels surrounding the target UV coordinate. We'll do this by rounding | |
// down the sample location to get the exact center of our "starting" texel. The starting texel will be at | |
// location [1, 1] in the grid, where [0, 0] is the top left corner. | |
float2 samplePos = uv * texSize; |
static void | |
Quat_FromEulerXYZ(float *euler_quat, float x, float y, float z) | |
{ | |
float sx = (float)sin((double)(x * 0.5f)); | |
float sy = (float)sin((double)(y * 0.5f)); | |
float sz = (float)sin((double)(z * 0.5f)); | |
float cx = (float)cos((double)(x * 0.5f)); | |
float cy = (float)cos((double)(y * 0.5f)); | |
float cz = (float)cos((double)(z * 0.5f)); |
#version 330 | |
in VertexData{ | |
vec4 mColor; | |
} VertexIn; | |
void main(void) | |
{ | |
gl_FragColor = VertexIn.mColor; | |
} |