| 221 | } // end of anonymous namespace |
| 222 | |
| 223 | void xDecalEmitter::update(F32 dt) |
| 224 | { |
| 225 | // Unused from DWARF |
| 226 | // xVec4* _loc; // r2 |
| 227 | // F32 par_dist; // r1 |
| 228 | |
| 229 | debug_update(dt); |
| 230 | F32 dage = dt * this->ilife; |
| 231 | |
| 232 | ptank_pool__color_mat_uv2 pool; |
| 233 | pool.reset(); |
| 234 | |
| 235 | pool.rs.texture = this->texture.asset; |
| 236 | pool.rs.src_blend = this->cfg.blend_src; |
| 237 | pool.rs.dst_blend = this->cfg.blend_dst; |
| 238 | pool.rs.flags = this->cfg.flags & 0x1; |
| 239 | this->curve_index = 0; |
| 240 | |
| 241 | static_queue<unit_data>::iterator it = this->units.begin(); |
| 242 | while (it != this->units.end()) |
| 243 | { |
| 244 | unit_data& unit = *it; |
| 245 | unit.age += dage; |
| 246 | |
| 247 | if (unit.age >= 1.0f) |
| 248 | { |
| 249 | break; |
| 250 | } |
| 251 | |
| 252 | update_frac(unit); |
| 253 | curve_node& node0 = this->curve[unit.curve_index]; |
| 254 | curve_node& node1 = this->curve[unit.curve_index+1]; |
| 255 | |
| 256 | F32 scale; |
| 257 | lerp(scale, unit.frac, node0.scale, node1.scale); |
| 258 | |
| 259 | *((F32*)&unit.mat.pos.z + 1) = unit.cull_size * scale; |
| 260 | pool.next(); |
| 261 | if (!pool.valid()) |
| 262 | { |
| 263 | break; |
| 264 | } |
| 265 | |
| 266 | get_render_data(unit, scale, pool.color[0], pool.mat[0], pool.uv[0], pool.uv[1]); |
| 267 | |
| 268 | ++it; |
| 269 | } |
| 270 | |
| 271 | pool.flush(); |
| 272 | this->units.erase(it, this->units.end()); |
| 273 | } |
| 274 | |
| 275 | namespace |
| 276 | { |