#include "Windfield.hpp" template void WindField::load(f32 ttl, Vector2 origin) { this->ttl = ttl; this->origin = origin; this->end = this->origin + Vector2(Width * CellDimension, Height * CellDimension); } template bool WindField::addVector(i32 x, i32 y, Vector2& v) { field[x][y] = v; return false; } template Vector2 WindField::getWindFactor(Vector2& v) { if (v.x >= origin.x && v.x <= end.x && v.y >= origin.y && v.y <= end.y) { Vector2 positionInField = v - this->origin; i32 cellX = static_cast(Width / positionInField.x); i32 cellY = static_cast(Height / positionInField.y); return field[cellX, cellY]; } return Vector2(); }