Skip to content

Instantly share code, notes, and snippets.

View Ethan-Bierlein's full-sized avatar

Ethan Bierlein Ethan-Bierlein

  • Bloomington, MN
View GitHub Profile
@<counter> 1 [set]
^{loop-begin}^
"" [print]
@<counter> [get] (generate-batman-repeated) [call]
@<counter> @<counter> [get] 1 [+] [set]
^(loop-begin)^ @<counter> [get] 4 [<=] [call-if]
[exit]
@Ethan-Bierlein
Ethan-Bierlein / CLIGL Tutorial.cs
Last active June 28, 2017 19:39
Simple tutorial for the CLIGL library.
// INSTRUCTIONS FOR COMPILING AND USING CLIGL WITH THIS PROJECT
//
// 1. Download the CLIGL project from the repository here: https://github.com/Ethan-Bierlein/CLIGL
// 2. Open up the CLIGL project solution in Visual Studio.
// 3. Set the build mode to 'Release'.
// 4. Naviate to the 'Build' dropdown and hit 'Build Solution'.
// 5. Minimize Visual Studio and navigate to the 'Release' folder in your file explorer of choice.
// 6. Verify that a CLIGL.dll file has been produced.
// 7. Create a new Visual Studio project of the type 'Console Application' in the language 'C#'.
// 8. Copy-paste this code into the main file.
26.344
18.554
18.066
15.067
15.739
15.534
14.240
14.896
17.658
15.059
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace SkyVoxels.Engine.Utilities
{
/// <summary>
/// This class serves as an advanced "wrapper" of sorts to the default Unity
/// Mesh class to generate visual or physics meshes dynamically. This class
/// is specially tailored for this project.
/// <summary>
/// Generate the chunk mesh.
/// </summary>
public void GenerateMesh()
{
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
DynamicMesh chunkDynamicMesh = new DynamicMesh(65535);
for(int x = 0; x < CHUNK_WIDTH; x++)
glActiveShaderProgram
glActiveTexture
glAttachShader
glBeginConditionalRender
glBeginQuery
glBeginQueryIndexed
glBeginTransformFeedback
glBindAttribLocation
glBindBuffer
glBindBufferBase
@Ethan-Bierlein
Ethan-Bierlein / gist:0c42c2313bf3d747c642fc994b9fa8a6
Last active August 16, 2016 20:09
Voxel Lighting Algorithm
/// <summary>
/// Generate lighting for an individual voxel.
/// </summary>
/// <param name="x">The x coordinate of the voxel.</param>
/// <param name="y">The y coordinate of the voxel.</param>
/// <param name="z">The y coordinate of the voxel.</param>
public void GenerateIndividualVoxelLighting(int x, int y, int z)
{
Voxel currentVoxel = this.FetchVoxel(x, y, z);
Voxel currentVoxelUp = this.FetchVoxel(x, y + 1, z);
/// <summary>
/// Generate the appropriate lighting for each voxel based on the voxel
/// data itself as a whole.
/// </summary>
public void GenerateVoxelLighting()
{
// Fill the top layer of voxels with full lighting values to
// simulate sunlight hitting the top of the voxel data.
for(int x = 0; x < this.Width; x++)
{
/// <summary>
/// Generate the appropriate lighting for each voxel based on the voxel
/// data itself as a whole.
/// </summary>
public void GenerateVoxelLighting()
{
// Fill the top layer of voxels with full lighting values to
// simulate sunlight hitting the top of the voxel data.
for(int x = 0; x < this.Width; x++)
{
using System;
using System.Linq;
using System.Collections.Generic;
namespace HackTheAdmin
{
/// <summary>
/// Utilities that HackTheAdmin needs.
/// </summary>
class Util