Giter Site home page Giter Site logo

techcentaur / flocking-simulation Goto Github PK

View Code? Open in Web Editor NEW
123.0 5.0 34.0 873 KB

Flocking simulation of starling murmuration using web graphics library (webGL) and openGL shader language in javascript.

Home Page: https://ankit-solanki.com/Flocking-Simulation/index.html#64

License: MIT License

TeX 0.63% JavaScript 97.73% CSS 0.01% HTML 1.63%
boids-simulation flocking-simulation javascript threejs

flocking-simulation's Issues

Syntax and Logic Issues

Good afternoon!

I utilized ESLint on this project to see if I can determine any potential bugs by focusing on the js-funcs directory and the js-libs directory. I decided to exclude the three.js and three.min.js files as these are external libraries.

These are the 4 bugs that I have found in the project:

Bug 1:
Location: bird-geometry.js at 39:11
Type: error 'v' is already defined no-redeclare
Solution: To simply remove redeclaration of variable v inside the for loop

Bug 2:
Location: FirstPersonControls.js at 274:3
Type: Unnecessary semicolon no-extra-semi
Solution: Simply remove the extra semi-colon found in that line of code to ensure javascript syntax

Bug 3:
Location: KeyboardState.js at 114:3
Type: Unnecessary semicolon no-extra-semi
Solution: Simply remove the extra semi-colon found in that line of code to ensure javascript syntax

Bug 4:
Location: OrbitControls.js at 333:2
Type: Mixed spaces and tabs no-mixed-spaces-and-tabs
Solution: Simply go in and fix the error manually be making sure line breaks are proper, or you can just right click and format document for automatic fix

Also for testing purposes, I found it difficult to execute ESLint on the buffer and shader directories. The reason was because while these are .js files, they contain GLSL code inside them and make the file not legible for testing with ESLint. A suggestion is to simply extract the GLSL code inside these javascript files and place them in a .glsl file, while placing a link to these files in the original .js file.

For example for vertexshader-birds.js:

  1. Create a new file called vertexshader-birds.glsl
  2. Copy all the code inside vertexshader-birds.js and place it inside vertexshader-birds.glsl
  3. Place the following code inside vertexshaer-birds.js (it has to be the only code in that file)

const fs = require('fs');
const pathway = require('path');
const shaderPath = pathway.join(__dirname, 'vertexshader-birds.glsl');
const shaderSource = fs.readFileSync(shaderPath, 'utf8');

This seemed to solve the issue for me for testing purposes and made it much more efficient to use with ESLint. Please let me know if I can help out with any other issues. Also, I really appreciate the effort that went into this project!

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.