Merge branch 'salmon' into pavel
This commit is contained in:
commit
6ea9276495
@ -527,12 +527,12 @@ namespace ZL
|
||||
|
||||
if (abs(finalPos.v[0] - originalPos.v[0]) > 1 || abs(finalPos.v[1] - originalPos.v[1]) > 1 || abs(finalPos.v[2] - originalPos.v[2]) > 1)
|
||||
{
|
||||
// std::cout << "Hello!" << std::endl;
|
||||
|
||||
}
|
||||
|
||||
if (!vMoved)
|
||||
{
|
||||
// std::cout << "Hello!" << std::endl;
|
||||
finalPos = originalPos;
|
||||
}
|
||||
|
||||
mesh.PositionData[i].v[0] = finalPos.v[0];
|
||||
|
||||
@ -17,5 +17,11 @@ Vector3f Environment::characterPos = {0, 0, 0};
|
||||
|
||||
|
||||
float Environment::violaCurrentIdleFrame = 0.f;
|
||||
int Environment::violaLastIdleFrame = -1;
|
||||
float Environment::violaCurrentWalkFrame = 0.f;
|
||||
int Environment::violaLastWalkFrame = 0;
|
||||
|
||||
int Environment::violaCurrentAnimation = 0;
|
||||
float Environment::violaAngleAroundY = 0.f;
|
||||
|
||||
} // namespace ZL
|
||||
|
||||
@ -18,7 +18,18 @@ public:
|
||||
static Vector3f cameraShift;
|
||||
static Vector3f characterPos;
|
||||
|
||||
//Viola
|
||||
static float violaCurrentIdleFrame;
|
||||
static float violaCurrentWalkFrame;
|
||||
|
||||
static int violaLastIdleFrame;
|
||||
static int violaLastWalkFrame;
|
||||
|
||||
static int violaCurrentAnimation;
|
||||
|
||||
static float violaAngleAroundY;
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace ZL
|
||||
|
||||
@ -38,9 +38,10 @@ void GameObjectManager::initialize() {
|
||||
|
||||
// Load bone animations
|
||||
//bx.LoadFromFile("./violetta001.txt");
|
||||
bx.LoadFromFile("./idleviola001.txt");
|
||||
|
||||
violaIdleModel.LoadFromFile("./idleviola001.txt");
|
||||
violaWalkModel.LoadFromFile("./walkviolla001.txt");
|
||||
// Create active object
|
||||
|
||||
ActiveObject ao1;
|
||||
ao1.name = "book";
|
||||
ao1.activeObjectMesh = ZL::LoadFromTextFile("./book001.txt"); // Add ZL:: namespace
|
||||
@ -54,6 +55,25 @@ void GameObjectManager::initialize() {
|
||||
ao1.activeObjectScreenMeshMutable.AssignFrom(ao1.activeObjectScreenMesh);
|
||||
ao1.activeObjectScreenMeshMutable.RefreshVBO();
|
||||
|
||||
/*
|
||||
ActiveObject ao2;
|
||||
ao2.name = "superchair001";
|
||||
ao2.activeObjectMesh = ZL::LoadFromTextFile("./superchair001.txt"); // Add ZL:: namespace
|
||||
ao2.activeObjectMesh.Scale(400);
|
||||
ao2.activeObjectMesh.SwapZandY();
|
||||
ao2.activeObjectMeshMutable.AssignFrom(ao2.activeObjectMesh);
|
||||
ao2.activeObjectMeshMutable.RefreshVBO();
|
||||
ao2.objectPos = Vector3f{ 0, 0, 0 };
|
||||
ao2.activeObjectTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./chair_01_Base_Color.bmp"));
|
||||
|
||||
ao2.activeObjectScreenTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./aoscreen01.bmp"));
|
||||
ao2.activeObjectScreenMesh = CreateRect2D({ 0.f, 0.f }, { 64.f, 64.f }, 0.5);
|
||||
ao2.activeObjectScreenMeshMutable.AssignFrom(ao2.activeObjectScreenMesh);
|
||||
ao2.activeObjectScreenMeshMutable.RefreshVBO();
|
||||
*/
|
||||
|
||||
|
||||
|
||||
Room room_1;
|
||||
room_1.roomTexture = std::make_shared<Texture>(CreateTextureDataFromBmp24("./Kitchen_ceramics.bmp"));
|
||||
room_1.objects.push_back(ao1);
|
||||
@ -149,6 +169,11 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
|
||||
if (audioPlayer) {
|
||||
audioPlayer->playSound("Звук-Идут-по-земле.ogg");
|
||||
}
|
||||
if (Environment::violaCurrentAnimation == 0)
|
||||
{
|
||||
Environment::violaCurrentAnimation = 1;
|
||||
Environment::violaLastWalkFrame = -1;
|
||||
}
|
||||
break;
|
||||
case SDLK_RIGHT:
|
||||
case SDLK_d:
|
||||
@ -156,6 +181,11 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
|
||||
if (audioPlayer) {
|
||||
audioPlayer->playSound("Звук-Идут-по-земле.ogg");
|
||||
}
|
||||
if (Environment::violaCurrentAnimation == 0)
|
||||
{
|
||||
Environment::violaCurrentAnimation = 1;
|
||||
Environment::violaLastWalkFrame = -1;
|
||||
}
|
||||
break;
|
||||
case SDLK_UP:
|
||||
case SDLK_w:
|
||||
@ -163,6 +193,11 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
|
||||
if (audioPlayer) {
|
||||
audioPlayer->playSound("Звук-Идут-по-земле.ogg");
|
||||
}
|
||||
if (Environment::violaCurrentAnimation == 0)
|
||||
{
|
||||
Environment::violaCurrentAnimation = 1;
|
||||
Environment::violaLastWalkFrame = -1;
|
||||
}
|
||||
break;
|
||||
case SDLK_DOWN:
|
||||
case SDLK_s:
|
||||
@ -170,6 +205,11 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
|
||||
if (audioPlayer) {
|
||||
audioPlayer->playSound("Звук-Идут-по-земле.ogg");
|
||||
}
|
||||
if (Environment::violaCurrentAnimation == 0)
|
||||
{
|
||||
Environment::violaCurrentAnimation = 1;
|
||||
Environment::violaLastWalkFrame = -1;
|
||||
}
|
||||
break;
|
||||
// ...handle other keys...
|
||||
}
|
||||
@ -179,18 +219,50 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
|
||||
case SDLK_LEFT:
|
||||
case SDLK_a:
|
||||
Environment::leftPressed = false;
|
||||
if (Environment::leftPressed == false && Environment::rightPressed == false && Environment::upPressed == false && Environment::downPressed == false)
|
||||
{
|
||||
if (Environment::violaCurrentAnimation == 1)
|
||||
{
|
||||
Environment::violaCurrentAnimation = 0;
|
||||
Environment::violaCurrentIdleFrame = -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SDLK_RIGHT:
|
||||
case SDLK_d:
|
||||
Environment::rightPressed = false;
|
||||
if (Environment::leftPressed == false && Environment::rightPressed == false && Environment::upPressed == false && Environment::downPressed == false)
|
||||
{
|
||||
if (Environment::violaCurrentAnimation == 1)
|
||||
{
|
||||
Environment::violaCurrentAnimation = 0;
|
||||
Environment::violaCurrentIdleFrame = -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SDLK_UP:
|
||||
case SDLK_w:
|
||||
Environment::upPressed = false;
|
||||
if (Environment::leftPressed == false && Environment::rightPressed == false && Environment::upPressed == false && Environment::downPressed == false)
|
||||
{
|
||||
if (Environment::violaCurrentAnimation == 1)
|
||||
{
|
||||
Environment::violaCurrentAnimation = 0;
|
||||
Environment::violaCurrentIdleFrame = -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SDLK_DOWN:
|
||||
case SDLK_s:
|
||||
Environment::downPressed = false;
|
||||
if (Environment::leftPressed == false && Environment::rightPressed == false && Environment::upPressed == false && Environment::downPressed == false)
|
||||
{
|
||||
if (Environment::violaCurrentAnimation == 1)
|
||||
{
|
||||
Environment::violaCurrentAnimation = 0;
|
||||
Environment::violaCurrentIdleFrame = -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -235,14 +307,37 @@ void GameObjectManager::updateScene(size_t ms) {
|
||||
rooms[current_room_index].roomLogic(*this, ms);
|
||||
}
|
||||
|
||||
Environment::violaCurrentIdleFrame += ms / 24.f;
|
||||
|
||||
while (Environment::violaCurrentIdleFrame > 40)
|
||||
if (Environment::violaCurrentAnimation == 0)
|
||||
{
|
||||
Environment::violaCurrentIdleFrame -= 40;
|
||||
}
|
||||
|
||||
bx.Interpolate(int(Environment::violaCurrentIdleFrame));
|
||||
Environment::violaCurrentIdleFrame += ms / 24.f;
|
||||
|
||||
while (Environment::violaCurrentIdleFrame >= 40)
|
||||
{
|
||||
Environment::violaCurrentIdleFrame -= 40;
|
||||
}
|
||||
|
||||
if (int(Environment::violaCurrentIdleFrame) != Environment::violaLastIdleFrame)
|
||||
{
|
||||
violaIdleModel.Interpolate(int(Environment::violaCurrentIdleFrame));
|
||||
Environment::violaLastIdleFrame = int(Environment::violaCurrentIdleFrame);
|
||||
}
|
||||
}
|
||||
else if (Environment::violaCurrentAnimation == 1)
|
||||
{
|
||||
Environment::violaCurrentWalkFrame += ms / 24.f;
|
||||
|
||||
while (Environment::violaCurrentWalkFrame >= 30)
|
||||
{
|
||||
Environment::violaCurrentWalkFrame -= 30;
|
||||
}
|
||||
|
||||
if (int(Environment::violaCurrentWalkFrame) != Environment::violaLastWalkFrame)
|
||||
{
|
||||
violaWalkModel.Interpolate(int(Environment::violaCurrentWalkFrame));
|
||||
Environment::violaLastWalkFrame = int(Environment::violaCurrentWalkFrame);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -33,8 +33,11 @@ public:
|
||||
ZL::VertexDataStruct testObjMesh;
|
||||
ZL::VertexRenderStruct testObjMeshMutable;
|
||||
|
||||
ZL::BoneSystem bx;
|
||||
ZL::VertexRenderStruct bxMutable;
|
||||
ZL::BoneSystem violaIdleModel;
|
||||
ZL::VertexRenderStruct violaIdleModelMutable;
|
||||
|
||||
ZL::BoneSystem violaWalkModel;
|
||||
ZL::VertexRenderStruct violaWalkModelMutable;
|
||||
|
||||
ZL::VertexDataStruct textMesh;
|
||||
ZL::VertexRenderStruct textMeshMutable;
|
||||
|
||||
@ -67,14 +67,20 @@ void RenderSystem::drawViola(GameObjectManager& gameObjects)
|
||||
renderer.ScaleMatrix(10);
|
||||
|
||||
renderer.RotateMatrix(QuatFromRotateAroundX(-M_PI / 2.0));
|
||||
//float t = 0.3;
|
||||
|
||||
//renderer.RotateMatrix(QuatFromRotateAroundX(t * M_PI / 2.0));
|
||||
|
||||
|
||||
gameObjects.bxMutable.AssignFrom(gameObjects.bx.mesh);
|
||||
gameObjects.bxMutable.RefreshVBO();
|
||||
renderer.DrawVertexRenderStruct(gameObjects.bxMutable);
|
||||
if (Environment::violaCurrentAnimation == 0)
|
||||
{
|
||||
gameObjects.violaIdleModelMutable.AssignFrom(gameObjects.violaIdleModel.mesh);
|
||||
gameObjects.violaIdleModelMutable.RefreshVBO();
|
||||
renderer.DrawVertexRenderStruct(gameObjects.violaIdleModelMutable);
|
||||
}
|
||||
else
|
||||
{
|
||||
gameObjects.violaWalkModelMutable.AssignFrom(gameObjects.violaWalkModel.mesh);
|
||||
gameObjects.violaWalkModelMutable.RefreshVBO();
|
||||
renderer.DrawVertexRenderStruct(gameObjects.violaWalkModelMutable);
|
||||
}
|
||||
|
||||
|
||||
renderer.PopMatrix();
|
||||
|
||||
18795
walkviolla001.txt
Normal file
18795
walkviolla001.txt
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user