/* * Part of LaGUI demonstration programs * Copyright (C) 2022-2023 Wu Yiming * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "la_5.h" extern LA MAIN; void la_DetachedScenePanel(laPanel* p){ la_MakeDetachedProp(p, "tns.world.root_objects", "root"); } void ScenePanel(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){ laColumn* c=laFirstColumn(uil); laUiItem* ui=laShowCanvas(uil,c,DetachedProps,"root",0,-1); laDefault3DViewOverlay(ui); } void DataPanel(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){ laColumn* c=laFirstColumn(uil); laShowItem(uil,c,0,"la.differences"); laShowItem(uil,c,0,"tns.world"); laShowItem(uil,c,0,"la"); } int RegisterEverything(){ laRegisterUiTemplate("panel_scene", "Scene", ScenePanel, la_DetachedScenePanel, 0,0, 0,25,25); laRegisterUiTemplate("panel_data", "Data", DataPanel, 0, 0,0, 0,0,20); tnsObject* s=tnsCreateRootObject("My Root"); tnsObject* o=tnsCreateLight(s,"Sun",100,100,100,1,1); tnsVector3d target={0,0,0}, up={0,0,1}; tnsLookAt(o,target,up); tnsObject* mo=tnsCreateMeshPlane(s,"Plane", 0,0,0, 10); //tnsMeshEnterEditMode(mo); //tnsMeshLeaveEditMode(mo); //tnsCreateMeshPlane(s,"Plane", 0,0,10, 10); } int main(int argc, char *argv[]){ laGetReady(); RegisterEverything(); laRefreshUDFRegistries(); // Use this to save and load preference when exit and during start up // laEnsureUserPreferences(); laSaveProp("tns.world"); laAddRootDBInst("tns"); laWindow* w = laDesignWindow(-1,-1,800,600); laLayout* l = laDesignLayout(w, "Scene"); laBlock* b = l->FirstBlock; laSplitBlockHorizon(b,0.7); laCreatePanel(b->B1, "panel_scene"); laCreatePanel(b->B2, "panel_data"); laStartWindow(w); laMainLoop(); }