*/}}

modelling_main.c 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Part of LaGUI demonstration programs
  3. * Copyright (C) 2022-2023 Wu Yiming
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include "la_5.h"
  19. extern LA MAIN;
  20. void la_DetachedScenePanel(laPanel* p){
  21. la_MakeDetachedProp(p, "tns.world.root_objects", "root");
  22. }
  23. void ScenePanel(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
  24. laColumn* c=laFirstColumn(uil);
  25. laUiItem* ui=laShowCanvas(uil,c,DetachedProps,"root",0,-2);
  26. laDefault3DViewOverlay(ui);
  27. laUiItem* b=laBeginRow(uil,c,0,0);
  28. laShowItem(uil,c,&ui->ExtraPP,"select_mode")->Flags|=LA_UI_FLAGS_EXPAND;
  29. laShowItem(uil,c,&ui->ExtraPP,"select_through");
  30. laEndRow(uil,b);
  31. }
  32. void DataPanel(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
  33. laColumn* c=laFirstColumn(uil);
  34. laShowItem(uil,c,0,"la.differences");
  35. laShowItem(uil,c,0,"tns.world");
  36. laShowItem(uil,c,0,"la");
  37. }
  38. int RegisterEverything(){
  39. laRegisterUiTemplate("panel_scene", "Scene", ScenePanel, la_DetachedScenePanel, 0,0, 0,25,25);
  40. laRegisterUiTemplate("panel_data", "Data", DataPanel, 0, 0,0, 0,0,20);
  41. tnsObject* s=tnsCreateRootObject("My Root");
  42. tnsObject* o=tnsCreateLight(s,"Sun",100,100,100,1,1);
  43. tnsVector3d target={0,0,0}, up={0,0,1};
  44. tnsLookAt(o,target,up);
  45. tnsObject* mo=tnsCreateMeshPlane(s,"Plane", 0,0,0, 10);
  46. //tnsMeshEnterEditMode(mo);
  47. //tnsMeshLeaveEditMode(mo);
  48. //tnsCreateMeshPlane(s,"Plane", 0,0,10, 10);
  49. }
  50. int main(int argc, char *argv[]){
  51. laGetReady();
  52. RegisterEverything();
  53. laRefreshUDFRegistries();
  54. // Use this to save and load preference when exit and during start up
  55. // laEnsureUserPreferences();
  56. laSaveProp("tns.world");
  57. laAddRootDBInst("tns");
  58. laWindow* w = laDesignWindow(-1,-1,800,600);
  59. laLayout* l = laDesignLayout(w, "Scene");
  60. laBlock* b = l->FirstBlock;
  61. laSplitBlockHorizon(b,0.7);
  62. laCreatePanel(b->B1, "panel_scene");
  63. laCreatePanel(b->B2, "panel_data");
  64. laStartWindow(w);
  65. laMainLoop();
  66. }