gi-pj1's Introduction
Team Members: Alexander Jackson 587332 David Toulmin 638541 Terrain Implementation: The terrain is generated using the DiamondSquare algorithm acting on a 2D array of points. The algorithm generates a value at each point that is used to represent the height of the terrain at that point. Once this step is completed, the coordinate array is passed to another function which iterates over the coordinates twice to construct a list of VertexPositionNormalColor objects, with the position data for each being represented by it's indices in the array and the value stored at those indices. Using the coordinate system, the map is laid out as a grid. The first iteration through the coordinates constructs the 'upperleft' triangle of each square on the grid and the second iteration constructs the 'bottomright' triangle. These are then passed into a SharpDX vertex buffer and used to construct the terrain model. The lighting is done by using the sun model to generate a vector representing the direction the sunlight is coming from relative to the XZ plane. Other objects can then access this data using a function to read it from the sun, and this is used in their draw calls to calculate how they're lit. Custom controls Implementation: Escape key: Exits application Spacebar: Toggles cursor controls in-game. (Useful for maximising/minimising the window or doing other things whilst alt+tabbed) References for code used from other sources: Thanks to Jimmy at http://gamedev.stackexchange.com/questions/37389/diamond-square-terrain-generation-problem for the implementation of DiamondSquare that the code in this program is based on. Thanks to Erik Rufelt on http://www.gamedev.net/topic/597393-getting-the-height-of-a-point-on-a-triangle/ for use of his algorithm for calculating what hight a given point in a 3d triange is, given the x and z coordinates Thanks to Glenn Slayden on http://stackoverflow.com/questions/2049582/how-to-determine-a-point-in-a-triangle for use of his algorithm for calculating whether a given point is in a triangle
gi-pj1's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.