Parcourir la source

MultiScene: Phase 4: Rendering is fixed.

Though it still is not possible to create a new window from a thread that did not init SDL
undefined
Benjamin ‘Touky’ Huet Sam Hocevar <sam@hocevar.net> il y a 9 ans
Parent
révision
7605caace4
6 fichiers modifiés avec 18 ajouts et 6 suppressions
  1. +10
    -3
      doc/samples/meshviewer/meshviewer.cpp
  2. +1
    -0
      doc/samples/meshviewer/meshviewer.h
  3. +0
    -2
      src/lolimgui.cpp
  4. +4
    -0
      src/platform/sdl/sdlapp.cpp
  5. +1
    -1
      src/scene.h
  6. +2
    -0
      src/ticker.cpp

+ 10
- 3
doc/samples/meshviewer/meshviewer.cpp Voir le fichier

@@ -172,11 +172,16 @@ void MeshViewer::Start()
//Camera setup
m_camera = new Camera();
m_camera->SetView(vec3(10.f, 10.f, 10.f), vec3::zero, vec3::axis_y);
m_camera->SetProjection(40.f, .0001f, 2000.f);
m_camera->SetProjection(40.f, .0001f, 200.f);
//m_camera->SetProjection(90.f, .0001f, 2000.f, WIDTH * SCREEN_W, RATIO_HW);
//m_camera->UseShift(true);
Scene& scene = Scene::GetScene();
scene.PushCamera(m_camera);
scene.SetTileCam(0);

//Text setup
m_entities << (m_text = new Text("", "data/font/ascii.png"));
m_text->SetPos(vec3(0, 0 /*(float)-m_text->GetFontSize().y*/, 0));

#if HAS_INPUT
InputProfile& ip = m_profile;
@@ -374,6 +379,8 @@ void MeshViewer::TickDraw(float seconds, Scene &scene)
if (m_menu_mesh_idx >= 0 && m_menu_mesh_idx < m_objs.count())
m_objs[m_menu_mesh_idx]->TickDraw(seconds, scene);

m_text->SetText(String("CECI EST UN TEST\n"));

//Draw gizmos & grid
Debug::DrawGizmo(vec3::zero, vec3::axis_x, vec3::axis_y, vec3::axis_z, 10.f);
Debug::DrawSetupColor(Color::white);
@@ -394,11 +401,11 @@ int main(int argc, char **argv)
new MeshViewer(argv[1]);
else
new MeshViewer();
/*

////DEBUG TEST
//SceneDisplay* display = new ApplicationDisplay("newDisplay", ivec2(800, 600));
//SceneDisplay::Add(display);
//Scene::GetScene(Scene::GetCount() - 1).SetDisplay(display);
*/

app.Run();



+ 1
- 0
doc/samples/meshviewer/meshviewer.h Voir le fichier

@@ -251,6 +251,7 @@ private:
bool m_first_tick = false;
InputProfile m_profile;
Camera* m_camera = nullptr;
Text* m_text = nullptr;

//ImGui stuff
bool m_menu_cam_useage = true;


+ 0
- 2
src/lolimgui.cpp Voir le fichier

@@ -263,8 +263,6 @@ void LolImGui::TickDraw(float seconds, Scene &scene)
}
void PrimitiveLolImGui::Render(Scene& scene, PrimitiveSource* primitive)
{
Renderer::Get()->Clear(ClearMask::Depth);

ImGuiIO& io = ImGui::GetIO();
if (io.Fonts->TexID)
ImGui::Render();


+ 4
- 0
src/platform/sdl/sdlapp.cpp Voir le fichier

@@ -75,6 +75,10 @@ SdlAppDisplay::SdlAppDisplay(char const *title, ivec2 res)
}

#if USE_SDL
/* This seems to fix the swap context bug.
* However, perfs warning have been may occur. */
SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);

data->m_window = SDL_CreateWindow(title, SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
window_size.x, window_size.y,


+ 1
- 1
src/scene.h Voir le fichier

@@ -78,7 +78,7 @@ public:
static ptrdiff_t GetPhysicalCount();
static const char* GetPhysicalName(ptrdiff_t index = 0);

protected:
//protected:
virtual void Enable();
virtual void Disable();



+ 2
- 0
src/ticker.cpp Voir le fichier

@@ -479,6 +479,8 @@ void TickerData::DrawThreadTick()

/* Disable display */
scene.DisableDisplay();

//break;
}

Profiler::Stop(Profiler::STAT_TICK_DRAW);


Chargement…
Annuler
Enregistrer