demo player movement
This commit is contained in:
@@ -18,9 +18,9 @@ Player::Player(Engine* engine)
|
||||
camera(&engine->pad) {
|
||||
staticPairs.push_back(new RendererStaticPair{weapon.mesh, weapon.options});
|
||||
pad = &engine->pad;
|
||||
position = Vec4(3.0F, 3.0F, 0.0F);
|
||||
position = Vec4(3.0F, 15.0F, 0.0F);
|
||||
camera.lookAt = Vec4(0.0F, 0.0F, -30.0F);
|
||||
speed = 0.5F;
|
||||
speed = 2.0F;
|
||||
}
|
||||
|
||||
Player::~Player() {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Demo {
|
||||
Terrain::Terrain(TextureRepository* repo) {
|
||||
TyrobjLoader loader;
|
||||
auto* data = loader.load(
|
||||
FileUtils::fromCwd("game/models/terrain/terrain.obj"), 1, 5.0F, true);
|
||||
FileUtils::fromCwd("game/models/terrain/terrain.obj"), 1, 25.0F, true);
|
||||
data->normalsEnabled = false;
|
||||
mesh = new StaticMesh(*data);
|
||||
mesh->getMaterial(0)->color.r = 96.0F;
|
||||
|
||||
Reference in New Issue
Block a user