Updates
This commit is contained in:
@@ -15,14 +15,13 @@ WaterModule::WaterModule(flecs::world &ecs)
|
||||
ecs.module<WaterModule>();
|
||||
ecs.component<WaterSurface>().add(flecs::Singleton);
|
||||
ecs.component<WaterBody>().add(flecs::Singleton);
|
||||
ecs.set<WaterSurface>({ nullptr, nullptr, nullptr });
|
||||
ecs.set<WaterBody>({ nullptr });
|
||||
ecs.system<const EngineData, const Camera, WaterSurface>("UpdateWater")
|
||||
.kind(flecs::OnUpdate)
|
||||
.each([](const EngineData &eng, const Camera &camera,
|
||||
WaterSurface &water) {
|
||||
float delta = eng.delta;
|
||||
if (!water.mWaterEnt || !water.mWaterNode) {
|
||||
std::cout << "Water setup\n";
|
||||
water.mAbove = false;
|
||||
water.mInRefTexUpdate = false;
|
||||
water.mRenderTargetListener.mSurface = &water;
|
||||
@@ -273,6 +272,7 @@ WaterModule::WaterModule(flecs::world &ecs)
|
||||
refractionViewport->setSkiesEnabled(false);
|
||||
refractionViewport->setAutoUpdated(false);
|
||||
water.mViewports[1] = refractionViewport;
|
||||
std::cout << "Water setup done\n";
|
||||
}
|
||||
Ogre::Vector3 mCameraPos =
|
||||
camera.mCameraNode->_getDerivedPosition();
|
||||
@@ -347,24 +347,10 @@ WaterModule::WaterModule(flecs::world &ecs)
|
||||
waterBodyPos.y = 0;
|
||||
Ogre::Vector3 d = waterPos - waterBodyPos;
|
||||
d.y = 0;
|
||||
std::cout << "aabb: "
|
||||
<< Ogre::Bullet::convert(body.mShapeAabbMin)
|
||||
<< " "
|
||||
<< Ogre::Bullet::convert(body.mShapeAabbMax)
|
||||
<< "\n";
|
||||
// Ogre::Vector3 waterPosition = mCameraPos;
|
||||
// mWaterNode->setPosition(waterPosition);
|
||||
if (d.squaredLength() > 10.0f * 10.0f)
|
||||
body.mWaterBody->getWorldTransform().setOrigin(
|
||||
Ogre::Bullet::convert(waterBodyPos +
|
||||
d));
|
||||
std::cout
|
||||
<< "node: " << water.mWaterNode->getPosition()
|
||||
<< " body: "
|
||||
<< Ogre::Bullet::convert(
|
||||
body.mWaterBody->getWorldTransform()
|
||||
.getOrigin())
|
||||
<< "\n";
|
||||
btCompoundShape *mshape =
|
||||
static_cast<btCompoundShape *>(
|
||||
body.mWaterBody->getCollisionShape());
|
||||
@@ -376,12 +362,6 @@ WaterModule::WaterModule(flecs::world &ecs)
|
||||
body.mWaterBody->getWorldTransform()
|
||||
.getOrigin() +
|
||||
btVector3(1000, -0.2, 1000);
|
||||
#if 0
|
||||
mshape->getChildShape(0)->getAabb(
|
||||
body.mWaterBody->getWorldTransform() *
|
||||
mshape->getChildTransform(0),
|
||||
body.mShapeAabbMin, body.mShapeAabbMax);
|
||||
#endif
|
||||
btDispatcher *dispatch =
|
||||
eng.mWorld->getBtWorld()->getDispatcher();
|
||||
eng.mWorld->getBtWorld()->getBroadphase()->setAabb(
|
||||
@@ -435,21 +415,6 @@ WaterModule::WaterModule(flecs::world &ecs)
|
||||
float dist = pt.getDistance();
|
||||
if (dist < minDist) {
|
||||
minDist = dist;
|
||||
std::cout
|
||||
<< " distance: "
|
||||
<< dist << "\n";
|
||||
contactPosA = Ogre::Bullet::convert(
|
||||
pt.getPositionWorldOnA());
|
||||
contactPosB = Ogre::Bullet::convert(
|
||||
pt.getPositionWorldOnB());
|
||||
std::cout
|
||||
<< "positionA: "
|
||||
<< contactPosA
|
||||
<< "\n";
|
||||
std::cout
|
||||
<< "positionB: "
|
||||
<< contactPosA
|
||||
<< "\n";
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user