demo player movement

This commit is contained in:
h4570
2022-07-31 17:37:48 +02:00
parent 12dd72f15e
commit b94ef8c416
12 changed files with 134 additions and 15 deletions
+65 -10
View File
@@ -20,27 +20,79 @@ namespace Demo {
Weapon::Weapon(TextureRepository* repo) {
TyrobjLoader loader;
auto* data = loader.load(FileUtils::fromCwd("game/models/ak47/ak47.obj"), 1,
1.0F, true);
.5F, true);
data->normalsEnabled = false;
mesh = new StaticMesh(*data);
delete data;
mesh->translation.translateZ(-50.0F);
mesh->translation.translateX(2.85F);
mesh->translation.translateY(-3.40F);
mesh->translation.translateZ(-10.50F);
mesh->rotation.rotateY(1.60F);
mesh->rotation.rotateZ(-6.30F);
mesh->scale.scale(0.5F);
repo->addByMesh(mesh, FileUtils::fromCwd("game/models/ak47/"), "png");
allocateOptions();
}
// float testRotation = 0.0F;
void Weapon::update() {}
void Weapon::update() {
// testRotation += 0.001F;
mesh->rotation.identity();
mesh->rotation.rotateZ(0.1F);
mesh->rotation.rotateY(-4.3F);
// TYRA_LOG(testRotation);
}
// float tX = 0.0F;
// float tY = -3.0F;
// float tZ = -10.0F;
// float rY = 0.1F;
// float rZ = -4.3F;
// void Weapon::debugPosition(Pad* pad) {
// const auto& leftJoy = pad->getLeftJoyPad();
// const auto& rightJoy = pad->getRightJoyPad();
// const float offset = 0.05F;
// if (leftJoy.v <= 100) {
// rY -= offset;
// } else if (leftJoy.v >= 200) {
// rY += offset;
// }
// if (leftJoy.h <= 100) {
// rZ -= offset;
// } else if (leftJoy.h >= 200) {
// rZ += offset;
// }
// if (rightJoy.h <= 100) {
// tY -= offset;
// } else if (rightJoy.h >= 200) {
// tY += offset;
// }
// if (rightJoy.v <= 100) {
// tZ -= offset;
// } else if (rightJoy.v >= 200) {
// tZ += offset;
// }
// if (pad->getPressed().Circle) {
// tX -= offset;
// } else if (pad->getPressed().Cross) {
// tX += offset;
// }
// mesh->rotation.identity();
// mesh->rotation.rotateY(rY);
// mesh->rotation.rotateZ(rZ);
// mesh->translation.identity();
// mesh->translation.translateX(tX);
// mesh->translation.translateY(tY);
// mesh->translation.translateZ(tZ);
// TYRA_LOG("tX: ", tX, " tY: ", tY, " tZ: ", tZ, " rY: ", rY, " rZ: ", rZ);
// }
Weapon::~Weapon() {
delete mesh;
@@ -51,6 +103,9 @@ void Weapon::allocateOptions() {
options = new StaPipOptions();
options->shadingType = Tyra::TyraShadingGouraud;
options->blendingEnabled = false;
options->fullClipChecks = false;
options->frustumCulling = Tyra::PipelineFrustumCulling_None;
options->transformationType = Tyra::TyraMP;
options->antiAliasingEnabled = false;
}