nngn
Loading...
Searching...
No Matches
particles.lua File Reference

Functions

function grid init (prog, pos)
 
function grid update ()
 
local function collision (prog, dt, grid, pos, vel, forces, wait)
 
local function integrate (prog, dt, forces, vel, pos, wait)
 
local function update (prog, grid, forces, vel, pos_v, pos, entities)
 

Variables

local camera = require "nngn.lib.camera"
 
local entity = require "nngn.lib.entity"
 
local input = require "nngn.lib.input"
 
local texture = require "nngn.lib.texture"
 
local N< const > = math.tointeger(2 ^ 12)
 
local PARTICLE_SIZE< const > = 4
 
local SIZE< const > = 512
 
local BUFFER_SIZE< const > = 4 * N
 
local TILE_SIZE< const > = 32
 
local GRID_SIZE< const > = SIZE / 2
 
local GRID_CELLS< const > = 16
 
local G< const > = 9.8 * TILE_SIZE
 
local KERNEL< const > = "collision_by_particle"
 
Compute opencl_params {version = {3, 0}})
 
local LIMITS< const > = nngn:compute():get_limits()
 
local LOCAL_SIZE< const > = LIMITS[Compute.WORK_GROUP_SIZE + 1]
 
local grid< const > = {kernel = 0}
 

Function Documentation

◆ collision()

local function collision ( prog ,
dt ,
grid ,
pos ,
vel ,
forces ,
wait  )

◆ init()

function grid init ( prog ,
pos  )

◆ integrate()

local function integrate ( prog ,
dt ,
forces ,
vel ,
pos ,
wait  )

◆ update() [1/2]

function grid update ( )

◆ update() [2/2]

local function update ( prog ,
grid ,
forces ,
vel ,
pos_v ,
pos ,
entities  )

Variable Documentation

◆ BUFFER_SIZE< const >

local BUFFER_SIZE< const > = 4 * N

◆ camera

local camera = require "nngn.lib.camera"

◆ entity

local entity = require "nngn.lib.entity"

◆ G< const >

local G< const > = 9.8 * TILE_SIZE

◆ grid< const >

local grid< const > = {kernel = 0}

◆ GRID_CELLS< const >

local GRID_CELLS< const > = 16

◆ GRID_SIZE< const >

local GRID_SIZE< const > = SIZE / 2

◆ input

local input = require "nngn.lib.input"

◆ KERNEL< const >

local KERNEL< const > = "collision_by_particle"

◆ LIMITS< const >

local LIMITS< const > = nngn:compute():get_limits()

◆ LOCAL_SIZE< const >

local LOCAL_SIZE< const > = LIMITS[Compute.WORK_GROUP_SIZE + 1]

◆ N< const >

local N< const > = math.tointeger(2 ^ 12)

◆ opencl_params

Compute opencl_params {version = {3, 0}})

◆ PARTICLE_SIZE< const >

local PARTICLE_SIZE< const > = 4

◆ SIZE< const >

local SIZE< const > = 512

◆ texture

local texture = require "nngn.lib.texture"

◆ TILE_SIZE< const >

local TILE_SIZE< const > = 32