float rand(float n){return fract(sin(n) * 43758.5453123);}
float noise(float p){
float fl = floor(p);
float fc = fract(p);
return mix(rand(fl), rand(fl + 1.0), fc);
}
This file contains hidden or 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
Vertex2 :: struct { | |
pos: Vec3, | |
color: Vec4, | |
uv: Vec2, | |
normal: Vec3, | |
} | |
data, result := cgltf.parse_file({}, "./assets/barrel.glb") | |
b := cgltf.load_buffers({}, data, "./assets/barrel.glb") | |
vertices: [dynamic]Vertex2 = make([dynamic]Vertex2) |
This file contains hidden or 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
module Main exposing (main) | |
import AnimationFrame | |
import Color exposing (Color) | |
import Html exposing (Html) | |
import Html.Attributes exposing (width, height, style) | |
import Math.Matrix4 as Mat4 exposing (Mat4) | |
import Math.Vector3 as Vec3 exposing (vec3, Vec3) | |
import Math.Vector4 as Vec4 exposing (vec4, Vec4) | |
import Time exposing (Time) |
This file contains hidden or 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
void main () { | |
float y = calculateSurface(position.x, position.y); | |
vec3 p1 = vec3(vert1.x, calculateSurface(vert1.x, vert1.y), vert1.y); | |
vec3 p2 = vec3(vert2.x, calculateSurface(vert2.x, vert2.y), vert2.y); | |
vec3 p3 = vec3(vert3.x, calculateSurface(vert3.x, vert3.y), vert3.y); | |
vec3 normal = normalize(cross(p2 - p3, p1 - p2)); | |
gl_Position = perspective * camera * vec4(vec3(position.x, y, position.y), 1.0); | |
vcolor = normal; |
Goal: a consistent style throughout all Elm projects that is easy to read and produces clean diffs to make debugging easier. This means valuing regularity and simplicity over cleverness.
Keep it under 80 characters. Going over is not the end of the world, but consider refactoring before you decide a line really must be longer.
This file contains hidden or 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
rayTriangleIntersect : Vec3 -> Vec3 -> ( Vec3, Vec3, Vec3 ) -> Maybe Vec3 | |
rayTriangleIntersect rayOrigin rayDirection ( triangle0, triangle1, triangle2 ) = | |
let | |
epsilon = | |
0.000001 | |
edge1 = | |
Vec3.sub triangle1 triangle0 | |
edge2 = |
This file contains hidden or 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
rayTriangleIntersect : Vec3 -> Vec3 -> ( Vec3, Vec3, Vec3 ) -> Maybe Vec3 | |
rayTriangleIntersect rayOrigin rayDirection ( triangle0, triangle1, triangle2 ) = | |
let | |
epsilon = | |
0.000001 | |
edge1 = | |
Vec3.sub triangle1 triangle0 | |
edge2 = |
This file contains hidden or 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
getClickPosition : Model -> Mouse.Position -> Vec3 | |
getClickPosition model pos = | |
let | |
x = | |
toFloat pos.x | |
y = | |
toFloat pos.y |
This file contains hidden or 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
module Modules.Auth.Login.Msg exposing (..) | |
import Http exposing (Error) | |
import Types exposing (User) | |
type LoginMsg | |
= LoginUpdateEmail String | |
| LoginUpdatePassword String |
This file contains hidden or 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
import { DeviceTypeService, AnalyticsService } from './device-type.service'; | |
import { Observable } from 'rxjs'; | |
import { fakeAsync, tick } from '@angular/core/testing'; | |
describe('DeviceTypeService', () => { | |
let stub: any = {}, service: DeviceTypeService; | |
beforeEach(() => { | |
// Create a stub for the analytics service | |
stub.AnalyticsService = jasmine.createSpyObj('AnalyticsService', [ 'trackDevices' ]); |
NewerOlder