Working on camera positioning
This commit is contained in:
1 parent
020f31e1e4
commit
9f4d60036d
3 files changed
+17
-17
No files matched your search
+9
-14
@@ -22,17 +22,8 @@
|
||||
|
||||
namespace ZL
|
||||
{
|
||||
/*
|
||||
void set_Texture(Character& npc, const TextureDataStruct& texture)
|
||||
{
|
||||
auto tt = std::make_shared<Texture>(texture);
|
||||
npc.setTexture(tt);
|
||||
}
|
||||
void set_Texture(Character& npc, const std::string& meshName, const TextureDataStruct& texture)
|
||||
{
|
||||
auto tt = std::make_shared<Texture>(texture);
|
||||
npc.setTexture(meshName, tt);
|
||||
}*/
|
||||
static const float zoomMin = 6.0f;
|
||||
static const float zoomMax = 20.0f;
|
||||
|
||||
#ifdef EMSCRIPTEN
|
||||
const char* CONST_ZIP_FILE = "resources.zip";
|
||||
@@ -945,8 +936,11 @@ namespace ZL
|
||||
else if (event.wheel.y < 0) {
|
||||
Environment::zoom += zoomstep;
|
||||
}
|
||||
if (Environment::zoom < zoomstep) {
|
||||
Environment::zoom = zoomstep;
|
||||
if (Environment::zoom < zoomMin) {
|
||||
Environment::zoom = zoomMin;
|
||||
}
|
||||
if (Environment::zoom > zoomMax) {
|
||||
Environment::zoom = zoomMax;
|
||||
}
|
||||
std::cout << "Current zoom: " << Environment::zoom << std::endl;
|
||||
// Tutorial step3 → step4: any mouse-wheel scroll counts as "zoom gesture".
|
||||
@@ -1225,8 +1219,9 @@ namespace ZL
|
||||
|
||||
float newZoom = pinchStartZoom * (pinchStartDistance / dist);
|
||||
// Match the wheel-zoom lower bound so both gestures clamp the same way.
|
||||
static const float zoomMin = 2.0f;
|
||||
|
||||
if (newZoom < zoomMin) newZoom = zoomMin;
|
||||
if (newZoom > zoomMax) newZoom = zoomMax;
|
||||
Environment::zoom = newZoom;
|
||||
|
||||
// Tutorial step3 → step4: detect a significant pinch-zoom (≥ 2 zoom units).
|
||||
|
||||
Reference in new issue
Block a user