Skip to content

Instantly share code, notes, and snippets.

@beginnerJq
beginnerJq / Project.sol
Created April 30, 2020 09:00
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.17+commit.d19bba13.js&optimize=false&gist=
pragma solidity ^0.4.17;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
@beginnerJq
beginnerJq / three-mesh-bvh-precompute.js
Created August 27, 2022 05:01 — forked from bzztbomb/three-mesh-bvh-precompute.js
An example of precomputing a BVH for three.js meshes using three-mesh-bvh
//
// This is the Node.js script used to precompute the bvh and store it in a GLTF file.
//
import { Accessor, Extension, ExtensionProperty, NodeIO, PropertyType, ReaderContext, VertexLayout, WriterContext } from '@gltf-transform/core';
import { PropertyGraph } from '@gltf-transform/core/dist/properties';
import { KHRONOS_EXTENSIONS } from '@gltf-transform/extensions';
import { join, normalize, resolve } from 'path';
import { Box3, BufferGeometry, Float32BufferAttribute } from 'three';
import { MeshBVH } from 'three-mesh-bvh';
import yargs from 'yargs';
Shader "Pristine Grid"
{
Properties
{
[Toggle] _WorldUV ("Use World Space UV", Float) = 1.0
_GridScale ("Grid Scale", Float) = 1.0
_LineWidthX ("Line Width X", Range(0,1.0)) = 0.01
_LineWidthY ("Line Width Y", Range(0,1.0)) = 0.01