Fixed weird fmod bug I guess
This commit is contained in:
@ -18,7 +18,6 @@ RenderPipeline::RenderPipeline(RenderManager *renderManager) {
|
||||
}
|
||||
|
||||
void RenderPipeline::init() {
|
||||
this->renderManager->getShaderManager()->lockShader<SimpleTexturedShader>();
|
||||
}
|
||||
|
||||
void RenderPipeline::render() {
|
||||
@ -160,7 +159,7 @@ void RenderPipeline::renderSceneCamera(Scene *scene, Camera *camera) {
|
||||
&lineMesh,
|
||||
&lineIndex,
|
||||
camera,
|
||||
this->renderManager->getShaderManager()->getShader<SimpleTexturedShader>(this->simpleTexturedShaderLock)
|
||||
this->renderManager->simpleTexturedShader
|
||||
);
|
||||
shaderPassItems.push_back(item);
|
||||
itDebugLine = scene->debugLines.erase(itDebugLine);
|
||||
@ -262,5 +261,4 @@ void RenderPipeline::renderSceneCamera(Scene *scene, Camera *camera) {
|
||||
}
|
||||
|
||||
RenderPipeline::~RenderPipeline() {
|
||||
this->renderManager->getShaderManager()->releaseShader<SimpleTexturedShader>(this->simpleTexturedShaderLock);
|
||||
}
|
@ -17,7 +17,6 @@ namespace Dawn {
|
||||
class RenderPipeline {
|
||||
private:
|
||||
int_fast16_t renderId = -1;
|
||||
shaderlock_t simpleTexturedShaderLock;
|
||||
|
||||
public:
|
||||
RenderManager *renderManager;
|
||||
|
@ -8,6 +8,7 @@
|
||||
using namespace Dawn;
|
||||
|
||||
ShaderManager::ShaderManager() {
|
||||
this->nextId = 0;
|
||||
this->nextLock = 0;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ namespace Dawn {
|
||||
shaderId = shader->shaderId;
|
||||
}
|
||||
|
||||
shaderlock_t lock = this->nextId++;
|
||||
shaderlock_t lock = this->nextLock++;
|
||||
this->shaderLocks[lock] = shaderId;
|
||||
this->shaderLocksByShader[shaderId].push_back(lock);
|
||||
return lock;
|
||||
|
@ -20,6 +20,11 @@ struct ShaderPassItem SceneDebugLine::createShaderItem(
|
||||
Camera *camera,
|
||||
SimpleTexturedShader *shader
|
||||
) {
|
||||
assertNotNull(mesh);
|
||||
assertNotNull(lineIndex);
|
||||
assertNotNull(camera);
|
||||
assertNotNull(shader);
|
||||
|
||||
struct ShaderPassItem item;
|
||||
item.priority = this->priority;
|
||||
|
||||
|
@ -44,8 +44,7 @@ namespace Dawn {
|
||||
}
|
||||
|
||||
static inline float_t randRange(float_t min, float_t max) {
|
||||
float_t n = randomGenerate<float_t>();
|
||||
return mathMod(n, (max - min)) + min;
|
||||
return mathMod(randomGenerate<float_t>(), (max - min)) + min;
|
||||
}
|
||||
|
||||
static inline glm::vec2 randRange(glm::vec2 min, glm::vec2 max) {
|
||||
|
@ -19,8 +19,9 @@ RenderManager::RenderManager(DawnGame *game) :
|
||||
void RenderManager::init() {
|
||||
// Lock the common shaders
|
||||
this->lockSimpleTextured = this->shaderManager.lockShader<SimpleTexturedShader>();
|
||||
this->lockUIShaderProgram = this->shaderManager.lockShader<SimpleTexturedShader>();
|
||||
this->simpleTexturedShader = this->shaderManager.getShader<SimpleTexturedShader>(this->lockSimpleTextured);
|
||||
|
||||
this->lockUIShaderProgram = this->shaderManager.lockShader<SimpleTexturedShader>();
|
||||
this->uiShader = this->shaderManager.getShader<SimpleTexturedShader>(this->lockUIShaderProgram);
|
||||
|
||||
this->renderPipeline.init();
|
||||
|
@ -50,8 +50,8 @@ void EntityAIWalk::updateWander(float_t delta) {
|
||||
wanderTimeToNextDecision = randRange(wanderTimeRandomRange.x, wanderTimeRandomRange.y);
|
||||
|
||||
// Do we want to move?
|
||||
float_t rr = randRange(0.0f, 3.0f);
|
||||
if(rr < wanderDoNotMoveChance) {
|
||||
float_t n = randRange(0.0f, 1.0f);
|
||||
if(n < wanderDoNotMoveChance) {
|
||||
wanderDestination = physics3Dto2D(transform->getLocalPosition());
|
||||
return;
|
||||
}
|
||||
@ -81,9 +81,10 @@ void EntityAIWalk::updateWander(float_t delta) {
|
||||
|
||||
// Stop moving if we're close enough
|
||||
if(glm::length(diff) < 0.1f) {
|
||||
wanderTimeToNextDecision = 0;
|
||||
entityMove->direction = glm::vec2(0, 0);
|
||||
} else {
|
||||
entityMove->direction = diff;
|
||||
}
|
||||
entityMove->direction = diff;
|
||||
}
|
||||
|
||||
void EntityAIWalk::updateFollowTarget(float_t delta) {
|
||||
|
Reference in New Issue
Block a user