Dreikblack Posted May 20, 2023 Posted May 20, 2023 Brush changes only a color after setting a material. Maybe i missing something or doing it wrong. Putting brush->Build(); after brush->SetMaterial(mtl); don't change anything. Made a model box just to show how i do expect brush to look so it's not light or something. #include "UltraEngine.h" using namespace UltraEngine; const WString remotepath = "https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets"; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.8); camera->Turn(35, 0, 0); camera->Move(0, 0, -2); //Create light auto light = CreateBoxLight(world); light->SetRange(-20, 20); light->SetArea(20, 20); light->SetRotation(35, 35, 0); //Create brush auto brush = CreateBrush(world); // brush->SetColor(0, 0, 1); //Add brush vertices float w = 1; float h = 1; float d = 1; brush->AddVertex(w * 0.5, h * 0.5, d * 0.5); brush->AddVertex(-w * 0.5, h * 0.5, d * 0.5); brush->AddVertex(-w * 0.5, h * 0.5, -d * 0.5); brush->AddVertex(w * 0.5, h * 0.5, -d * 0.5); brush->AddVertex(w * 0.5, -h * 0.5, d * 0.5); brush->AddVertex(-w * 0.5, -h * 0.5, d * 0.5); brush->AddVertex(-w * 0.5, -h * 0.5, -d * 0.5); brush->AddVertex(w * 0.5, -h * 0.5, -d * 0.5); //Add faces auto face = brush->AddFace(); face->AddIndice(0); face->AddIndice(1); face->AddIndice(2); face->AddIndice(3); auto mtl2 = CreateMaterial(); mtl2->SetTexture(LoadTexture(remotepath + "/Materials/tiles.dds")); face->SetMaterial(mtl2); face = brush->AddFace(); face->AddIndice(4); face->AddIndice(5); face->AddIndice(6); face->AddIndice(7); face = brush->AddFace(); face->AddIndice(0); face->AddIndice(1); face->AddIndice(5); face->AddIndice(4); face = brush->AddFace(); face->AddIndice(2); face->AddIndice(3); face->AddIndice(7); face->AddIndice(6); face = brush->AddFace(); face->AddIndice(1); face->AddIndice(2); face->AddIndice(6); face->AddIndice(5); face = brush->AddFace(); face->AddIndice(0); face->AddIndice(3); face->AddIndice(7); face->AddIndice(4); //Finalize the brush brush->Build(); auto mtl = CreateMaterial(); mtl->SetTexture(LoadTexture(remotepath + "/Materials/tiles.dds")); brush->SetMaterial(mtl); auto model = CreateBox(world); model->SetPosition(2, 0, 0); model->SetMaterial(mtl); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; } Quote
Solution Dreikblack Posted July 1, 2023 Author Solution Posted July 1, 2023 Now in 1.03 it works for brush and face 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.