This file contains 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
Microsoft (R) Windows Debugger Version 10.0.22473.1005 AMD64 | |
Copyright (c) Microsoft Corporation. All rights reserved. | |
Loading Dump File [C:\Users\verc\Downloads\sectorsedge.exe.13044.dmp] | |
User Mini Dump File: Only registers, stack and portions of memory are available | |
************* Path validation summary ************** |
This file contains 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
ModelHelper.InitialiseTrigonometry(); | |
Random rand = new Random(); | |
int count = 524288; | |
float[] randoms = new float[count]; | |
float[] result = new float[count]; | |
int[] mathTimes = new int[100]; | |
int[] arrayTimes = new int[100]; |
This file contains 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
/* Changes made: | |
* Using chunkXCounter and chunkZCounter to check when we have moved into a new chunk, | |
* rather than (x % Constants.ChunkSize) * Constants.ChunkSize each loop. This removes all %, / and * operators | |
* Comparisons against 0 in loops where possible | |
* Using .Reset() on the block, rather than getting a reference and modifying index and health on two different lines | |
* Previous benchmark: 100 runs in 5315ms. | |
* New benchmark: 100 runs in 4755ms | |
* */ | |
byte[] fileData = r.ReadBytes(bytesRemaining); |
This file contains 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
byte[] fileData = r.ReadBytes(bytesRemaining); | |
var b = 0; | |
for (int x = 0; x < Constants.MapSizeX; x++) | |
{ | |
int chunkX = x / Constants.ChunkSize; | |
for (int z = 0; z < Constants.MapSizeZ; z++) | |
{ | |
int chunkZ = z / Constants.ChunkSize; |
This file contains 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
// Code ported from https://0fps.net/2012/06/30/meshing-in-a-minecraft-game/ | |
// Note this implementation does not support different block types or block normals | |
// The original author describes how to do this here: https://0fps.net/2012/07/07/meshing-minecraft-part-2/ | |
const int CHUNK_SIZE = 32; | |
// These variables store the location of the chunk in the world, e.g. (0,0,0), (32,0,0), (64,0,0) |
This file contains 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
static Matrix4F identityF = Matrix4.Identity.ToFloat(); | |
// This is a combination of a scale, rotate and translate matrix. Rather than calculating three different matrices and multiplying | |
// them together, we can save float multiplications and additions by using this function | |
public static Matrix4F ParticleMatrix(float s, float rX, float rZ, Vector3 d) | |
{ | |
var sX = GetArrayedSinCheap(rX); | |
var sZ = GetArrayedSinCheap(rZ); | |
var cX = GetArrayedCosCheap(rX); | |
var cZ = GetArrayedCosCheap(rZ); |
This file contains 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
// Create multiple layers | |
for (int o = 0; o < layers; o++) | |
{ | |
// Create the arms | |
for (int i = 0; i < 100000; i++) | |
{ | |
Vector3 position = GetPoint(); | |
position.Y -= heightMagnitude * Math.Sin(position.Magnitude * heightFrequency); | |
// Colour and store each point |
This file contains 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
Vector3 position = GetPoint(); | |
position.Y -= heightMagnitude * Math.Sin(position.Magnitude * heightFrequency); | |
// Colour each point based on their global angle around the axis | |
Color blendedColour; | |
var angle = Math.Atan2(position.X, position.Z); | |
// c1, c2, c3 and c4 are random colours generated at the start of the program | |
// Blend the colours of adjacent quadrants together | |
if (angle < -Math.PI / 2) |
This file contains 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
Vector3 position = GetPoint(); | |
position.Y -= heightMagnitude * Math.Sin(position.Magnitude * heightFrequency); |
This file contains 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
Vector3 GetPoint() | |
{ | |
// Generate the point | |
... | |
// Calculate arm scaling | |
... | |
// Rotate the point around the galaxy proportional to its magnitude | |
v *= Matrix4.CreateRotationY(-v.Magnitude * rotationStrength); |
NewerOlder