Giter Club home page Giter Club logo

lumpy's Introduction

Lumpy

This is Lumpy, a landmass editor and my final project for CSCI 4239 Advanced Computer Graphics.

Demo of the app in action

There are 2 modes: God Mode and 1st-Person Mode. In God Mode, click anywhere on the sandy plane to create a lump. As the height increases, the texture will change to grass/plants, then to rock, and then to snow and snow will begin to fall. Drag to rotate the camera.

Then, switch to 1st-Person Mode by clicking the "First Person" button. Use the WASD keys or arrow buttons to navigate around the land you designed in God Mode and drag to rotate the camera.

Building

This requires Qt. I used Qt 5.9.5.

qmake && make

Instructions

Key/Action Result
Move mouse Move the cursor on the plane
Click/Space/Draw button Draw a lump
Drag mouse Change the camera angle
WASD/Arrow buttons 1st-Person Mode: Move the camera
God Mode: Move the cursor (relative to camera)
Scroll wheel Zoom the view
Cursor Size Change the radius of the cursor

Technical Details

  • Placing the cursor at the mouse position is achieved by rendering the land plane to a buffer with a shader where the r and g values at each frag reflect the texture coordinates. Then, determining the cursor location is as simple as grabbing the buffer's color at the mouse position.
  • Normals are calculated based on the height of surrounding pixels on the texture when a lump is created, and stored in the GBA components of the texture.
  • The normals for the water are based on the derivetive of the sinusoidal function used to calculate their y value.
  • The camera angle is rotated by [a fraction of] the angle between the normal at its position and vertical, which means you'll look up slightly as you climb up and look down slightly as you climb down.
  • First-person velocity calculations and damping are handled in a timer that runs 60 times a second because we can't trust vsync.
  • Plants are rendered using a Display List (borrowed from last year's final project). The height under each plant is determined using an image export of the lump map buffer generated when a lump is added.

Credits

This uses code adapted from examples 3, 8, and 12 in my class. Original code here.

The easing function used for lumps is adapted from here.

Textures

I'm hoping this qualifies as fair use as a school project because I didn't take care to find royalty-free textures. If I get any cease and desist letters I will comply.

lumpy's People

Contributors

mrjacobbloom avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.