Merge branch 'salmon' of github.com:mephi1984/ZeptoLabTest1 into salmon
This commit is contained in:
commit
5db648a99f
@ -225,6 +225,13 @@ namespace ZL
|
||||
vertices[i] = Vector3f{floatValues[0], floatValues[1], floatValues[2]};
|
||||
}
|
||||
|
||||
|
||||
//==== process uv and normals begin
|
||||
|
||||
std::cout << "Hello x1" << std::endl;
|
||||
|
||||
std::getline(f, tempLine); //===UV Coordinates:
|
||||
|
||||
std::getline(f, tempLine); //triangle count
|
||||
int numberTriangles;
|
||||
|
||||
@ -236,6 +243,97 @@ namespace ZL
|
||||
throw std::runtime_error("No number found in the input string.");
|
||||
}
|
||||
|
||||
|
||||
// Now process UVs
|
||||
std::vector<std::array<Vector2f, 3>> uvCoords;
|
||||
|
||||
uvCoords.resize(numberTriangles);
|
||||
|
||||
for (int i = 0; i < numberTriangles; i++)
|
||||
{
|
||||
std::getline(f, tempLine); //Face 0
|
||||
|
||||
int uvCount;
|
||||
std::getline(f, tempLine);
|
||||
if (std::regex_search(tempLine, match, pattern_count)) {
|
||||
std::string number_str = match.str();
|
||||
uvCount = std::stoi(number_str);
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("No number found in the input string.");
|
||||
}
|
||||
|
||||
if (uvCount != 3)
|
||||
{
|
||||
throw std::runtime_error("more than 3 uvs");
|
||||
}
|
||||
|
||||
std::vector<float> floatValues;
|
||||
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
std::getline(f, tempLine); //UV <Vector (-0.3661, -1.1665)>
|
||||
|
||||
auto b = tempLine.cbegin();
|
||||
auto e = tempLine.cend();
|
||||
floatValues.clear();
|
||||
while (std::regex_search(b, e, match, pattern_float)) {
|
||||
floatValues.push_back(std::stof(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
if (floatValues.size() != 2)
|
||||
{
|
||||
throw std::runtime_error("more than 2 uvs---");
|
||||
}
|
||||
|
||||
uvCoords[i][j] = Vector2f{ floatValues[0],floatValues[1] };
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
std::cout << "Hello eee" << std::endl;
|
||||
|
||||
std::getline(f, tempLine); //===Normals:
|
||||
|
||||
|
||||
std::vector<Vector3f> normals;
|
||||
|
||||
normals.resize(numberVertices);
|
||||
for (int i = 0; i < numberVertices; i++)
|
||||
{
|
||||
std::getline(f, tempLine);
|
||||
|
||||
std::vector<float> floatValues;
|
||||
|
||||
auto b = tempLine.cbegin();
|
||||
auto e = tempLine.cend();
|
||||
while (std::regex_search(b, e, match, pattern_float)) {
|
||||
floatValues.push_back(std::stof(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
normals[i] = Vector3f{ floatValues[0], floatValues[1], floatValues[2] };
|
||||
}
|
||||
|
||||
//==== process uv and normals end
|
||||
|
||||
std::getline(f, tempLine); //triangle count.
|
||||
//numberTriangles; //Need to check if new value is the same as was read before
|
||||
|
||||
if (std::regex_search(tempLine, match, pattern_count)) {
|
||||
std::string number_str = match.str();
|
||||
numberTriangles = std::stoi(number_str);
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("No number found in the input string.");
|
||||
}
|
||||
|
||||
std::vector<std::array<int, 3>> triangles;
|
||||
|
||||
triangles.resize(numberTriangles);
|
||||
@ -447,6 +545,10 @@ namespace ZL
|
||||
verticesBoneWeight.push_back(localVerticesBoneWeight[triangles[i][0]]);
|
||||
verticesBoneWeight.push_back(localVerticesBoneWeight[triangles[i][1]]);
|
||||
verticesBoneWeight.push_back(localVerticesBoneWeight[triangles[i][2]]);
|
||||
|
||||
mesh.TexCoordData.push_back(uvCoords[i][0]);
|
||||
mesh.TexCoordData.push_back(uvCoords[i][1]);
|
||||
mesh.TexCoordData.push_back(uvCoords[i][2]);
|
||||
}
|
||||
|
||||
startMesh = mesh;
|
||||
|
||||
@ -76,10 +76,8 @@ void GameObjectManager::initialize() {
|
||||
|
||||
|
||||
|
||||
//violaIdleModel.LoadFromFile("./idleviola001.txt");
|
||||
violaIdleModel.LoadFromFile("./idleviola008.txt");
|
||||
|
||||
violaWalkModel.LoadFromFile("./walkviola008.txt");
|
||||
violaIdleModel.LoadFromFile("./idleviola_uv009.txt");
|
||||
violaWalkModel.LoadFromFile("./walkviola_uv009.txt");
|
||||
sideThreadLoadingCompleted = true;
|
||||
});
|
||||
|
||||
@ -175,14 +173,14 @@ void GameObjectManager::initialize() {
|
||||
|
||||
|
||||
ActiveObject lock;
|
||||
lock.name = "lock";
|
||||
lock.name = "lockFriend";
|
||||
lock.activeObjectMesh = ZL::LoadFromTextFile("./lock.txt"); // Add ZL:: namespace
|
||||
lock.activeObjectMesh.Scale(2);
|
||||
lock.activeObjectMeshMutable.AssignFrom(lock.activeObjectMesh);
|
||||
lock.activeObjectMeshMutable.RefreshVBO();
|
||||
lock.objectPos = Vector3f{ 101, 100, 255 };
|
||||
lock.activeObjectTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./Material.001_Base_color_1001_5.bmp"));
|
||||
lock.activeObjectScreenTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./aoscreen01.bmp"));
|
||||
lock.activeObjectScreenTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp32("./hand.bmp32"));
|
||||
lock.activeObjectScreenMesh = CreateRect2D({ 0.f, 0.f }, { 64.f, 64.f }, 0.5);
|
||||
lock.activeObjectScreenMeshMutable.AssignFrom(lock.activeObjectScreenMesh);
|
||||
lock.activeObjectScreenMeshMutable.RefreshVBO();
|
||||
@ -191,7 +189,7 @@ void GameObjectManager::initialize() {
|
||||
|
||||
|
||||
ActiveObject door;
|
||||
door.name = "door";
|
||||
door.name = "doorGlory";
|
||||
door.activeObjectMesh = ZL::LoadFromTextFile("./door.txt"); // Add ZL:: namespace
|
||||
door.activeObjectMesh.Scale(60);
|
||||
// cubeForFirstRoomO.activeObjectMesh.RotateByMatrix(QuatToMatrix(QuatFromRotateAroundZ(M_PI * 0.5)));
|
||||
@ -201,7 +199,7 @@ void GameObjectManager::initialize() {
|
||||
door.activeObjectMeshMutable.RefreshVBO();
|
||||
door.objectPos = Vector3f{ -372, 10, 80 };
|
||||
door.activeObjectTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./Material.001_Base_color_1001_5.bmp"));
|
||||
door.activeObjectScreenTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./aoscreen01.bmp"));
|
||||
door.activeObjectScreenTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp32("./hand.bmp32"));
|
||||
door.activeObjectScreenMesh = CreateRect2D({ 0.f, 0.f }, { 64.f, 64.f }, 0.5);
|
||||
door.activeObjectScreenMeshMutable.AssignFrom(door.activeObjectScreenMesh);
|
||||
door.activeObjectScreenMeshMutable.RefreshVBO();
|
||||
@ -256,7 +254,7 @@ void GameObjectManager::initialize() {
|
||||
room_3.sound_name = "unseen-danger-fss-no-copyright-music-252588--online-audio-convert.com.ogg";
|
||||
room_3.objects.push_back(lock);
|
||||
room_3.objects.push_back(door);
|
||||
room_3.roomLogic = createRoom1Logic();
|
||||
room_3.roomLogic = createRoom3Logic();
|
||||
room_3.textMesh = preloadedRoomMeshArr[2];
|
||||
room_3.textMeshMutable.AssignFrom(room_3.textMesh);
|
||||
room_3.collisionMgr.setRoomBoundary(790, 790);
|
||||
@ -294,6 +292,9 @@ void GameObjectManager::initialize() {
|
||||
monsterScreenMeshMutable.RefreshVBO();
|
||||
|
||||
|
||||
violaTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./viola.bmp"));
|
||||
|
||||
|
||||
//SDL_ShowCursor(SDL_DISABLE);
|
||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||
|
||||
@ -377,13 +378,6 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
|
||||
objects_in_inventory--;
|
||||
}
|
||||
}
|
||||
else if (bearName.length() >= 3 && !(bearName.compare("TOM") == 0)) {
|
||||
bearName = "";
|
||||
for (const auto& cube : selectedCubes) {
|
||||
gInventoryMap[cube.name] = cube;
|
||||
}
|
||||
selectedCubes.clear();
|
||||
}
|
||||
}
|
||||
else if (current_room_index==1) {
|
||||
if (InventoryItem* item = GetItemSelected(true)){
|
||||
@ -424,7 +418,7 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
|
||||
}
|
||||
else if (current_room_index==2) {
|
||||
if (InventoryItem* item = GetItemSelected(true)){
|
||||
|
||||
if (item->name == "lockFriend"){}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -436,7 +430,7 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ao->name != "lampe") {
|
||||
if (ao->name != "lampe" && ao->name != "doorGlory" && ao->name != "lockFriend" ) {
|
||||
AddItemToInventory(ao->name, ao->inventoryIconTexturePtr, objects_in_inventory+1);
|
||||
|
||||
objects_in_inventory++;
|
||||
@ -444,6 +438,20 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
|
||||
rooms[current_room_index].removeByPtr(ao);
|
||||
activeObjects = rooms[current_room_index].objects;
|
||||
}
|
||||
else if (ao->name != "doorGlory"){
|
||||
hasMadeChoise = true;
|
||||
hasChoisedFriendship = false;
|
||||
|
||||
// debug switching
|
||||
switch_room(0);
|
||||
}
|
||||
else if (ao->name != "lockFriend"){
|
||||
hasMadeChoise = true;
|
||||
hasChoisedFriendship = true;
|
||||
|
||||
// debug switching
|
||||
switch_room(0);
|
||||
}
|
||||
|
||||
|
||||
//aoMgr.removeByName(ao->name);
|
||||
|
||||
@ -33,7 +33,7 @@ public:
|
||||
|
||||
std::shared_ptr<ZL::Texture> testObjTexturePtr;
|
||||
//std::shared_ptr<ZL::Texture> roomTexturePtr;
|
||||
std::shared_ptr<ZL::Texture> coneTexturePtr;
|
||||
//std::shared_ptr<ZL::Texture> coneTexturePtr;
|
||||
|
||||
//ZL::VertexDataStruct colorCubeMesh;
|
||||
//ZL::VertexRenderStruct colorCubeMeshMutable;
|
||||
@ -43,10 +43,12 @@ public:
|
||||
|
||||
ZL::BoneSystem violaIdleModel;
|
||||
ZL::VertexRenderStruct violaIdleModelMutable;
|
||||
|
||||
|
||||
ZL::BoneSystem violaWalkModel;
|
||||
ZL::VertexRenderStruct violaWalkModelMutable;
|
||||
|
||||
std::shared_ptr<ZL::Texture> violaTexturePtr;
|
||||
|
||||
std::vector<ZL::VertexDataStruct> preloadedRoomMeshArr;
|
||||
|
||||
|
||||
@ -103,6 +105,9 @@ public:
|
||||
std::shared_ptr<Texture> batteryDialogTexturePtr; // Активная текстура диалога
|
||||
bool isBatteryDialogActive = false; // Флаг активности диалога
|
||||
|
||||
bool hasChoisedFriendship = false;
|
||||
bool hasMadeChoise = false;
|
||||
|
||||
private:
|
||||
//int animationCounter = 0;
|
||||
int lastMouseX = 0; // Добавляем переменные для хранения позиции мыши
|
||||
|
||||
@ -44,4 +44,14 @@ namespace ZL
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
std::function<void(GameObjectManager&, size_t)> createRoom3Logic()
|
||||
{
|
||||
return [](GameObjectManager& gom, size_t ms)
|
||||
// Simple test logic
|
||||
{
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,5 +6,6 @@ namespace ZL {
|
||||
|
||||
std::function<void(GameObjectManager&, size_t)> createRoom1Logic();
|
||||
std::function<void(GameObjectManager&, size_t)> createRoom2Logic();
|
||||
std::function<void(GameObjectManager&, size_t)> createRoom3Logic();
|
||||
|
||||
}
|
||||
|
||||
@ -49,9 +49,12 @@ void RenderSystem::drawViola(GameObjectManager& gameObjects)
|
||||
static const std::string vColorName = "vColor";
|
||||
static const std::string textureUniformName = "Texture";
|
||||
|
||||
renderer.shaderManager.PushShader(colorShaderName);
|
||||
|
||||
renderer.shaderManager.PushShader(defaultShaderName);
|
||||
renderer.RenderUniform1i(textureUniformName, 0);
|
||||
|
||||
renderer.EnableVertexAttribArray(vPositionName);
|
||||
renderer.EnableVertexAttribArray(vTexCoordName);
|
||||
|
||||
renderer.PushPerspectiveProjectionMatrix(1.0 / 1.5,
|
||||
static_cast<float>(Environment::width) / static_cast<float>(Environment::height),
|
||||
50, 10000);
|
||||
@ -78,12 +81,14 @@ void RenderSystem::drawViola(GameObjectManager& gameObjects)
|
||||
{
|
||||
gameObjects.violaIdleModelMutable.AssignFrom(gameObjects.violaIdleModel.mesh);
|
||||
gameObjects.violaIdleModelMutable.RefreshVBO();
|
||||
glBindTexture(GL_TEXTURE_2D, gameObjects.violaTexturePtr->getTexID());
|
||||
renderer.DrawVertexRenderStruct(gameObjects.violaIdleModelMutable);
|
||||
}
|
||||
else
|
||||
{
|
||||
gameObjects.violaWalkModelMutable.AssignFrom(gameObjects.violaWalkModel.mesh);
|
||||
gameObjects.violaWalkModelMutable.RefreshVBO();
|
||||
glBindTexture(GL_TEXTURE_2D, gameObjects.violaTexturePtr->getTexID());
|
||||
renderer.DrawVertexRenderStruct(gameObjects.violaWalkModelMutable);
|
||||
}
|
||||
|
||||
@ -91,6 +96,7 @@ void RenderSystem::drawViola(GameObjectManager& gameObjects)
|
||||
renderer.PopMatrix();
|
||||
renderer.PopProjectionMatrix();
|
||||
renderer.DisableVertexAttribArray(vPositionName);
|
||||
renderer.DisableVertexAttribArray(vTexCoordName);
|
||||
|
||||
renderer.shaderManager.PopShader();
|
||||
}
|
||||
|
||||
@ -81,6 +81,7 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>Viola</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
|
||||
42311
idleviola_uv009.txt
Normal file
42311
idleviola_uv009.txt
Normal file
File diff suppressed because it is too large
Load Diff
43494
walkviola_uv009.txt
Normal file
43494
walkviola_uv009.txt
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user