converter fromFloat() shows our monkey

This commit is contained in:
wgroeneveld 2020-07-11 09:03:18 +02:00
parent aaa580852e
commit 6b89b73fcc
4 changed files with 514 additions and 509 deletions

View File

@ -9,7 +9,7 @@ var result =
var meshes = 0;
function addMesh(x, y, z) {
result += `\t obj->add(VectorFx::fromInt(${x}, ${y}, ${z}));\n`;
result += `\t obj->add(VectorFx::fromFloat(${x}, ${y}, ${z}));\n`;
meshes++;
}
var faces = 0;

File diff suppressed because it is too large Load Diff

View File

@ -31,8 +31,9 @@ void MonkeyScene::tick(u16 keys) {
int curmsecs = engine->getTimer()->getMsecs();
int elapsed = curmsecs - msecs;
msecs = curmsecs;
int fps = 1000 / elapsed;
TextStream::instance().setText(std::to_string(1000 / elapsed) + std::string(" FPS"), 1, 1);
TextStream::instance().setText(std::to_string(fps < 0 ? 0 : fps) + std::string(" FPS"), 1, 1);
monkey->rotate(2, 2);
}

View File

@ -33,6 +33,10 @@ public:
return VectorFx(int2fx(x), int2fx(y), int2fx(z));
}
static VectorFx fromFloat(float x, float y, float z) {
return VectorFx(float2fx(x), float2fx(y), float2fx(z));
}
inline VectorFx toInt() const {
return VectorFx(fx2int(v.x), fx2int(v.y), fx2int(v.z));
}