mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
add on_update, on_render to docs & change entities tps to 20
This commit is contained in:
parent
3f67944cc2
commit
f8907f7db1
10 changed files with 62 additions and 21 deletions
|
|
@ -59,7 +59,8 @@ void Entity::setRig(const rigging::SkeletonConfig* rigConfig) {
|
|||
);
|
||||
}
|
||||
|
||||
Entities::Entities(Level* level) : level(level), sensorsTickClock(20, 3) {
|
||||
Entities::Entities(Level* level)
|
||||
: level(level), sensorsTickClock(20, 3), updateTickClock(20, 3) {
|
||||
}
|
||||
|
||||
template<void(*callback)(const Entity&, size_t, entityid_t)>
|
||||
|
|
@ -440,8 +441,13 @@ void Entities::updatePhysics(float delta) {
|
|||
}
|
||||
}
|
||||
|
||||
void Entities::update() {
|
||||
scripting::on_entities_update();
|
||||
void Entities::update(float delta) {
|
||||
if (updateTickClock.update(delta)) {
|
||||
scripting::on_entities_update(
|
||||
updateTickClock.getTickRate(),
|
||||
updateTickClock.getParts(),
|
||||
updateTickClock.getPart());
|
||||
}
|
||||
}
|
||||
|
||||
static void debug_render_skeleton(
|
||||
|
|
@ -505,10 +511,10 @@ void Entities::renderDebug(
|
|||
}
|
||||
|
||||
void Entities::render(
|
||||
Assets* assets, ModelBatch& batch, const Frustum& frustum, bool pause
|
||||
Assets* assets, ModelBatch& batch, const Frustum& frustum, float delta, bool pause
|
||||
) {
|
||||
if (!pause) {
|
||||
scripting::on_entities_render();
|
||||
scripting::on_entities_render(delta);
|
||||
}
|
||||
|
||||
auto view = registry.view<Transform, rigging::Skeleton>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue