architwin 1.0.47 → 1.0.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +847 -309
  2. package/lib/architwin.js +1 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -13,7 +13,6 @@ ArchiTwin Library
13
13
  - [Import the library](#import-the-library)
14
14
  - [Setup your proxy](#setup-your-proxy)
15
15
  - [Connect to a Space](#connect-to-a-space)
16
- - [Setup for other frameworks](#setup-for-other-frameworks)
17
16
  - [Connection Parameters](#connection-parameters)
18
17
  - [Config Options](#config-options)
19
18
  - [Space Navigation and Camera Control](#space-navigation-and-camera-control)
@@ -30,26 +29,18 @@ ArchiTwin Library
30
29
  - [Programmatically transforming objects](#programmatically-transforming-objects)
31
30
  - [Undoing and Redoing Transformation Changes](#undoing-and-redoing-transformation-changes)
32
31
  - [Adding Objects To Your Space](#adding-objects-to-your-space)
33
- - [Programmatically Add Objects](#programmatically-add-objects)
34
32
  - [Creating a Customizable Media Screen](#creating-a-customizable-media-screen)
35
33
  - [Adding a Media Screen](#adding-a-media-screen)
36
34
  - [Media Screen Parameter Reference](#media-screen-parameter-reference)
37
35
  - [Attaching an image or video to a Media Screen](#attaching-an-image-or-video-to-a-media-screen)
38
36
  - [Setting Video Playback in the Space](#setting-video-playback-in-the-space)
39
37
  - [Setting Animation Control in the Space](#setting-animation-control-in-the-space)
40
- - [Meeting Guide](#meeting-guide)
41
- - [Create Meeting](#create-meeting)
42
- - [Start Meeting](#start-meeting)
43
- - [Stop Meeting](#stop-meeting)
44
- - [Utility Methods](#utility-methods)
45
- - [Update Meeting Details](#update-meeting-details)
46
- - [Meeting Info](#meeting-info)
47
- - [Meeting Config Options](#meeting-config-options)
48
- - [Meeting Custom Colors](#meeting-custom-colors)
49
- - [Meeting Custom Avatar](#meeting-custom-avatar)
50
- - [Meeting Device Control](#meeting-device-control)
51
- - [Meeting Bar Position](#meeting-bar-position)
52
- - [Meeting Status](#meeting-status)
38
+ - [Copying object To Your Space](#copying-object-to-your-space)
39
+ - [Adding Object, Getting Object, Updating Object, Deleting Object in the Database](#adding-object-getting-object-updating-object-deleting-object-in-the-database)
40
+ - [Deleting Object To Your Space](#deleting-object-to-your-space)
41
+ - [Replacing Object To Your Space](#replacing-object-to-your-space)
42
+ - [Creating Text Markup Screen in the space](#creating-text-markup-screen-in-the-space)
43
+ - [Setting Content to Text Markup Screen](#setting-content-to-text-markup-screen)
53
44
  - [Function Reference](#function-reference)
54
45
  - [Tags](#tags)
55
46
  - [Sweeps](#sweeps)
@@ -57,8 +48,6 @@ ArchiTwin Library
57
48
  - [Navigation](#navigation)
58
49
  - [Camera](#camera)
59
50
  - [Objects](#objects)
60
- - [Meeting](#meeting)
61
-
62
51
 
63
52
  ## Installation
64
53
  ---------------------
@@ -67,6 +56,7 @@ To install the latest ArchiTwin package:
67
56
  ````bash
68
57
  npm i architwin
69
58
  ````
59
+
70
60
  ## Getting Started
71
61
  ------------------------
72
62
 
@@ -85,15 +75,13 @@ This example uses Vue's ref attribute to reference the target iFrame. Please con
85
75
 
86
76
  ````html
87
77
  <template>
88
- <!-- ref is an attribute used in Vue-->
89
- <div class="showcase_container" id="showcase-container" style="position: relative;">
90
- <iframe id="mp-showcase" class="showcase" scrolling="no" width="100%" height="700" frameborder="0"
91
- allow="xr-spatial-tracking" allowfullscreen></iframe>
92
- <div class="map_container">
93
- <div id="map">
94
- </div>
78
+ <div class="showcase_container" id="showcase-container" style="position: relative;">
79
+ <iframe id="mp-showcase" class="showcase" scrolling="no" width="100%" height="700" frameborder="0" allow="xr-spatial-tracking" allowfullscreen></iframe>
80
+ <div class="map_container">
81
+ <div id="map">
95
82
  </div>
96
83
  </div>
84
+ </div>
97
85
  </template>
98
86
  ````
99
87
 
@@ -235,7 +223,7 @@ You should be able to move around the Space using keyboard and mouse.
235
223
 
236
224
  Or programmatically using methods defined in this library.
237
225
 
238
- #### Setup for other frameworks
226
+ <!-- #### Setup for other frameworks
239
227
 
240
228
  Vue is the framework we use in the code snippets provided above. If your team intends to use other frameworks like Svelte or React.
241
229
 
@@ -352,15 +340,28 @@ console.log('Hello console')
352
340
 
353
341
  - [React Architwin Project](https://playcode.io/1500222)
354
342
 
355
- Please take note that you **must** setup the appropriate proxy configuration as stated in [this section](#setup-your-proxy) otherwise it will not work.
343
+ Please take note that you **must** setup the appropriate proxy configuration as stated in [this section](#setup-your-proxy) otherwise it will not work. -->
356
344
 
357
345
  ## Connection Parameters
358
346
  connectSpace has three important parameters:
359
- ````javascript
360
- connectSpace(spaceUrl, auth, config)
361
- ````
362
347
 
363
- **spaceUrl** - the URL of the space you wish to connect to.
348
+ | parameter | type | required | default | values |
349
+ | :----: | :----: | :---: | :---: | :---: |
350
+ | url | string | yes | | valid space URL |
351
+ | auth | { string; string; IUser } | yes | | |
352
+ | config | IMPConfig | yes | | |
353
+
354
+ ```javascript
355
+ import * as atwin from 'architwin';
356
+
357
+ ...
358
+
359
+ await atwin.connectSpace(url, auth, config)
360
+
361
+ ...
362
+ ```
363
+
364
+ **url** - the URL of the space you wish to connect to.
364
365
 
365
366
  **auth** - an authentication object with the apiKey and user credentials. Default user credentials will be provided by ArchiTwin for testing which you can change anytime to your own user credentials. The auth object passed to the `connectSpace` method may consist of the following keys:
366
367
 
@@ -449,142 +450,200 @@ await atwin.connectSpace(url, auth, config)
449
450
 
450
451
  You can navigate around the space using keyboard arrow keys or using a mouse.
451
452
 
452
- Progmmatically, you also can navigate the space:
453
-
454
- Use **moveInDirection(direction: string)** to move around inside the space.
455
- **direction:** "FORWARD", "BACKWARD", "LEFT", "RIGHT", "UP", "DOWN".
456
-
453
+ Progmmatically, you also can navigate the space. You may use `moveInDirection()` method to move around inside the space.
457
454
  This will move the user to the nearest Sweep marker in the indicated direction.
458
455
 
456
+ | parameter | type | required | default | values |
457
+ | :----: | :----: | :---: | :---: | :---: |
458
+ | direction | string | yes | | "FORWARD" or "BACKWARD" or "LEFT" or "RIGHT" or "UP" or "DOWN" |
459
+
459
460
  ````typescript
460
- <script lang="ts">
461
- import * as atwin from 'architwin';
462
- ...
463
- await atwin.moveInDirection("FORWARD")
461
+ import * as atwin from 'architwin';
462
+
463
+ ...
464
+
465
+ // this function moves you to the nearest sweep in front you
466
+ async function moveForward() {
464
467
  await atwin.moveInDirection("FORWARD")
468
+ }
465
469
 
470
+ // this function moves you to the nearest sweep behind you
471
+ async function moveBackward() {
472
+ await atwin.moveInDirection("BACKWARD")
473
+ }
474
+
475
+ // this function moves you to the nearest right sweep
476
+ async function moveRight() {
466
477
  await atwin.moveInDirection("RIGHT")
467
- await atwin.moveInDirection("RIGHT")
468
- await atwin.moveInDirection("FORWARD")
478
+ }
479
+
480
+ // this function moves you to the nearest left sweep
481
+ async function moveLeft() {
469
482
  await atwin.moveInDirection("LEFT")
470
- ...
483
+ }
471
484
 
472
- </script>
485
+ // this function moves you to the nearest sweep above you
486
+ async function moveUp() {
487
+ await atwin.moveInDirection("UP")
488
+ }
489
+
490
+ // this function moves you to the nearest sweep below you
491
+ async function moveDown() {
492
+ await atwin.moveInDirection("DOWN")
493
+ }
494
+
495
+ ...
473
496
  ````
474
497
 
475
498
  ### Rotate, Pan and Tilt Camera
476
499
 
477
500
  While inside the space, you can control the camera rotation and panning to have a better view around you.
478
501
 
479
- Use **cameraRotate(x: number, y: number, speed: number)** to rotate the camera view.
502
+ You may use the `cameraRotate()` to rotate the camera view.
480
503
 
481
- Use **cameraPan(x: number, z: number)** to tilt and pan the Camera.
504
+ | parameter | type | required | default | values |
505
+ | :----: | :----: | :---: | :---: | :---: |
506
+ | x | number | yes | | rotations in degrees |
507
+ | y | number | yes | | rotations in degrees |
508
+ | speed | number | yes | | speed of rotation |
482
509
 
483
- Parameters x, y and z are rotations in degrees.
510
+ ```typescript
511
+ import * as atwin from 'architwin';
484
512
 
485
- Note, cameraPan will work only in *Dollhouse* mode.
513
+ ...
486
514
 
487
- ````typescript
488
- <script lang="ts">
489
- import * as atwin from 'architwin';
515
+ // rotate around X axis, last parameter is the Speed of rotation in seconds
516
+ await atwin.cameraRotate(20,0,2)
490
517
 
491
- ...
492
- // rotate around X axis, last parameter is the Speed of rotation in seconds
493
- await atwin.cameraRotate(20,0,2)
518
+ // rotate around Y axis
519
+ await atwin.cameraRotate(0,45,5)
494
520
 
521
+ ...
522
+ ```
495
523
 
496
- // rotate around Y axis
497
- await atwin.cameraRotate(0,45,5)
524
+ You may use `cameraPan()` method to tilt and pan the Camera.
498
525
 
526
+ | parameter | type | required | default | values |
527
+ | :----: | :----: | :---: | :---: | :---: |
528
+ | x | number | yes | | rotation in degrees |
529
+ | z | number | yes | | rotation in degrees |
499
530
 
531
+ ````typescript
532
+ import * as atwin from 'architwin';
500
533
 
501
- // pan around z axis (pan and tilt only works in Dollhouse mode)
502
- await atwin.cameraPan(0,20)
534
+ ...
503
535
 
504
- // tilt abpout x axis
505
- await atwin.cameraPan(30,0)
536
+ // pan around z axis
537
+ await atwin.cameraPan(0,20)
506
538
 
507
- ...
539
+ // tilt about x axis
540
+ await atwin.cameraPan(30,0)
508
541
 
509
- </script>
542
+ ...
510
543
  ````
511
-
544
+ **Note:** cameraPan will work only in *Dollhouse* mode.
512
545
 
513
546
  ## Space Overview
514
547
  (Note that we use the word Space and Showcase interchangeably)
515
548
 
516
- **Space**
517
- Space is an immersive and realistic Digital Twin model of a physical space, with virtual custom objects like animated 3D objects, Video Screens, Slideshow Screens and Tags, co-existing and enhancing the real objects.
549
+ **Space** - Space is an immersive and realistic Digital Twin model of a physical space, with virtual custom objects like animated 3D objects, Video Screens, Slideshow Screens and Tags, co-existing and enhancing the real objects.
518
550
 
519
551
  A user should be able to navigate around using PC or devices (keyboard and mouse), measure real object dimensions and interact with the virtual objects as if you are actually visiting the physical space.
520
552
 
521
- **Sweeps**
522
- Space have static sweep markers (white circles on floor) which serves as primary navigation points. Users can go to sweeps (or click), stand and look around.
553
+ **Sweeps** - Space have static sweep markers (white circles on floor) which serves as primary navigation points. Users can go to sweeps (or click), stand and look around.
523
554
 
524
- **Tags**
525
- Space also have tags which are virtual markers attached to Objects or Locations in space. Tags can be clicked which will render and display relevant contents like
555
+ **Tags** - Space also have tags which are virtual markers attached to Objects or Locations in space. Tags can be clicked which will render and display relevant contents like
526
556
  web pages, videos, images or text descriptions. It is possible to go directly to any specifig tag (gotoTag) from anywhere in Space.
527
557
 
528
558
  It can be used as quick way to navigate around the space.
529
559
 
530
- **3D Objects**
531
- Space usually contains 3D objects or three-dimentional models. Some 3D objects may have some simple animations.
560
+ **3D Objects** - Space usually contains 3D objects or three-dimentional models. Some 3D objects may have some simple animations.
532
561
 
533
- **Video Screens**
534
- Another interesting objects that can be found inside the space are Video Screens. They practially look like TV
562
+ **Video Screens** - Another interesting objects that can be found inside the space are Video Screens. They practially look like TV
535
563
  screens placed at selected locations. The Video screens will automatically play when a User is nearby (2 meters). And automatically turns off when the User leaves.
536
564
 
537
565
 
538
- **Slideshow Screens**
539
- Space can also contain Image Slideshow Screens. This is similar to the Video Screen, but uses static images.
566
+ **Slideshow Screens** - Space can also contain Image Slideshow Screens. This is similar to the Video Screen, but uses static images.
540
567
  Clicking on the right section of the current slide image will display the next slide.
541
568
  Clicking on the the left section will display the previous slide.
542
569
 
543
570
  The slideshow can be auto played in whole by clicking the lower-right corner.
544
571
 
545
- **Meeting**
546
- Space meeting feature introduces immersive way to conduct virtual gatherings and collaborative sessions. This innovative feature allows users to convene inside a Space, where participants represented by an avatar and can interact, communicate, and share ideas in a more lifelike and engaging manner.
572
+ <!-- **Meeting** - Space meeting feature introduces immersive way to conduct virtual gatherings and collaborative sessions. This innovative feature allows users to convene inside a Space, where participants represented by an avatar and can interact, communicate, and share ideas in a more lifelike and engaging manner.
547
573
 
548
- Please check [Meeting Guide](#meeting-guide) to know how to use Meeting feature.
574
+ Please check [Meeting Guide](#meeting-guide) to know how to use Meeting feature. -->
549
575
 
550
576
  ## Points of Interest
551
577
  Tags are primarily use to mark locations or objects in space for quick and direct navigation.
552
578
  Tags usually contain additional content that will be rendered when hovered. Contents can be web pages,
553
579
  text descriptions, videos, or images.
554
580
 
555
- ````typescript
556
- getTags() - // returns a list of Tags found in the Space
581
+ You may use the `getTags()` method in order to get a list of Tags found in the space.
557
582
 
558
- goToTag(tagId) - // to navigate to specific Tag and accepts a Tag's ID
583
+ | parameter | type | required | default | values |
584
+ | :----: | :----: | :---: | :---: | :---: |
585
+ | space | ISpace | yes | | |
559
586
 
560
- getSweeps() - // returns a list of Sweeps found in the Space
587
+ You may use the `goToTag()` method in order to navigate to specific Tag
561
588
 
562
- moveToSweep(sweepId) - // to move to a specific Sweep
563
- ````
589
+ | parameter | type | required | default | values |
590
+ | :----: | :----: | :---: | :---: | :---: |
591
+ | tag_id | string | yes | | Id of the tag |
592
+
593
+ You may use the `getSweeps()` method in order get a list of Sweeps found in the Space. This method doesn't have a parameter.
594
+
595
+ You may use the `moveToSweep()` method in order to move to a specific Sweep
596
+
597
+ | parameter | type | required | default | values |
598
+ | :----: | :----: | :---: | :---: | :---: |
599
+ | sweepId | string | yes | | Id of the sweep |
564
600
 
565
- **Example:**
566
601
  ````typescript
567
- <script lang="ts">
568
- import * as atwin from 'architwin';
602
+ import * as atwin from 'architwin';
569
603
 
570
- ...
571
- // get current sweep data
572
- await atwin.getCurrentSweep()
604
+ ...
573
605
 
606
+ const spaceUrl = "https://basic-dev.rev-kitten.com/showcase/model3d_public/1?token=e707880f-0fc5-48a6-b3f6-643a19f81464"
574
607
 
575
- // get current sweep position
576
- await atwin.getSweepPosition()
608
+ const ispace = {
609
+ id: 1;
610
+ name: "mySpace";
611
+ space_url: spaceUrl;
612
+ tagpin_image: null;
613
+ } as ISpace
577
614
 
615
+ const tagId = "5"
616
+ const sweepId = "10"
578
617
 
579
- // moving to a Sweep
580
- await atwin.moveToSweep('msdfkj353h')
618
+ // returns a list of Tags found in the Space
619
+ await atwin.getTags(ispace)
581
620
 
582
- // move to a Tag
583
- await atwin.gotoTag(5)
621
+ // to navigate to specific Tag and accepts a Tag's ID
622
+ await atwin.goToTag(tagId)
584
623
 
585
- ...
624
+ // returns a list of Sweeps found in the Space
625
+ await atwin.getSweeps()
586
626
 
587
- </script>
627
+ // to move to a specific Sweep
628
+ await atwin.moveToSweep(sweepId)
629
+
630
+ ...
631
+ ````
632
+
633
+ **More Examples:**
634
+ ````typescript
635
+ import * as atwin from 'architwin';
636
+
637
+ ...
638
+
639
+ // get current sweep data
640
+ await atwin.getCurrentSweep()
641
+
642
+
643
+ // get current sweep position
644
+ await atwin.getSweepPosition()
645
+
646
+ ...
588
647
  ````
589
648
 
590
649
  ## Loading and Interacting with 3D/2D Objects
@@ -616,49 +675,77 @@ Objects come in many shapes and sizes. Loading objects may sometimes take a lot
616
675
 
617
676
  To achieve this, instead of loading all of your objects at the same time at the start which causes long initial load times, Architwin eagerly renders objects in the space when the user is at a certain distance from the objects intended position. We call this feature **Render On Demand**.
618
677
 
619
- By default, objects are rendered in the space when objects are within a **2 meters** diameter from the Camera (User view). You can increase or decrease this distance by setting the render distance using the `setRenderDistance` method.
678
+ By default, objects are rendered in the space when objects are within a **2 meters** diameter from the Camera (User view). You can increase or decrease this distance by setting the render distance using the `setRenderDistance()` method.
620
679
 
621
- Example:
680
+ | parameter | type | required | default | values |
681
+ | :----: | :----: | :---: | :---: | :---: |
682
+ | distance | number | yes | | number in meters |
622
683
 
623
684
  ```typescript
624
685
  import * as atwin from 'architwin'
625
686
 
626
- atwin.setRenderDistance(10) //Render all objects within 10 meters from the User
687
+ ...
688
+
689
+ // renders all objects within 10 meters from the User
690
+ atwin.setRenderDistance(10)
691
+
627
692
  atwin.connectSpace(url, auth, config)
693
+
694
+ ...
628
695
  ```
629
696
 
630
- You only need to set the render distance once. Make sure to invoke the function before running `connectSpace`
697
+ You only need to set the render distance once. Make sure to invoke the function before running `connectSpace()`
631
698
 
632
- Architwin also allows you to get **rendered** objects near the user by calling the `getNearbyObjects` method which will return an array of nodes of the rendered objects within the target range.
699
+ Architwin also allows you to get **rendered** objects near the user by calling the `getNearbyObjects()` method which will return an array of nodes of the rendered objects within the target range.
633
700
 
634
- Example:
701
+ | parameter | type | required | default | values |
702
+ | :----: | :----: | :---: | :---: | :---: |
703
+ | payload | NearbyPayload | yes | | |
635
704
 
636
705
  ```typescript
637
706
  import * as atwin from 'architwin'
638
707
 
639
- atwin.getNearbyObjects('ALL',10) // Will get ALL object types within a 10 meter range
708
+ ...
709
+ const payload = {
710
+ type: "ALL",
711
+ distance: 10
712
+ } as NearbyPayload
713
+
714
+ // gets ALL object types within a 10 meter range
715
+ atwin.getNearbyObjects(payload)
716
+
717
+ ...
640
718
  ```
641
719
 
642
- You can learn more about the different paramaters of this function under the [function reference](#function-reference) section. If you need to get all the nearby objects everytime the user moves, then you can simple add the following key-value pair in your config.
720
+ You can learn more about the different paramaters of this function under the [function reference](#function-reference) section. If you need to get all the nearby objects everytime the user moves, then you can simply add the following key-value pair in your config.
643
721
 
644
722
  ```typescript
645
723
  import * as atwin from 'architwin'
646
724
 
725
+ ...
726
+
647
727
  const config: IMPConfig = {
648
728
  //other configs...
649
729
  autoDetectNearbyObjs: true,
650
730
  }
651
731
 
652
732
  atwin.connectSpace(url, auth, config)
733
+
734
+ ...
653
735
  ```
654
736
 
655
- You can the get the data by importing the `nearbyObjects` variable
737
+ <!-- You can get the data by importing the `nearbyObjects` variable
656
738
 
657
739
  ```typescript
658
740
  import * as atwin from 'architwin'
659
741
 
660
- atwin.nearbyObjects //Gets updated everytime the User camera moves
661
- ```
742
+ ...
743
+
744
+ //Gets updated everytime the User camera moves
745
+ atwin.nearbyObjects
746
+
747
+ ...
748
+ ``` -->
662
749
 
663
750
  ### Accessing List of Rendered Objects and Object Structure
664
751
 
@@ -683,9 +770,9 @@ interface IObjectData {
683
770
 
684
771
  Each object element inside `atwin._3DXObjects` contains the value keys:
685
772
 
686
- **collider:** Collider components define the shape of an 3D/2D object for the purposes of physical collisions. A collider, which is invisible, does not need to be the exact same shape as the GameObject’s mesh.
773
+ **collider** - Collider components define the shape of an 3D/2D object for the purposes of physical collisions. A collider, which is invisible, does not need to be the exact same shape as the GameObject’s mesh.
687
774
 
688
- **object:** The object key is an object that implements the `IShowcaseObject` interface. This is one of the most important values as the object contains all the information about an object such as its id,name,position,rotation,scale,amazon_uri link, and etc. You can look at the interface below to view the full makeup of the object key.
775
+ **object** - The object key is an object that implements the `IShowcaseObject` interface. This is one of the most important values as the object contains all the information about an object such as its id,name,position,rotation,scale,amazon_uri link, and etc. You can look at the interface below to view the full makeup of the object key.
689
776
 
690
777
  *interface used* (TS)
691
778
  ```typescript
@@ -738,6 +825,7 @@ export interface IShowcaseObject {
738
825
  | ZIP | slideshow | A zip file rendered as a image slideshow |
739
826
 
740
827
  The `atwin.selectedObject` variable is an example of a variable that implements this interfacea and contains this data.
828
+
741
829
  ### Transforming Objects
742
830
 
743
831
  Transformation such as translate, scale, and rotate are actions used to manipulate objects in a 3D space. These transformations allow you to change an object's position, size, and orientation respectively.
@@ -760,13 +848,44 @@ Clicking on any object in the space will attach the axis controls to it. By defa
760
848
 
761
849
  You can switch the transform mode on the currently selected object by using the `setTransformMode()` method.
762
850
 
763
- Please take note that transform controls can only be attached to one object at a time. Clicking on another object will remove the transform controls in the previous object and add it the currently selected object. It is impractical to attach multiple transform controls on more than one object. If you wish to programmatically transform multiple methods, then the next method offers a solution
851
+ Please take note that transform controls can only be attached to one object at a time. Clicking on another object will remove the transform controls in the previous object and add it the currently selected object. It is impractical to attach multiple transform controls on more than one object. If you wish to programmatically transform multiple methods, then the next method offers a solution.
764
852
 
765
853
  If you wish the to access the object data of the object that has been clicked on. You can do so by calling the `atwin.selectedObject` variable which returns an object implementing the `IObjectData` interface containing all the necessary data you need. Know more about the structure of an object by going to this section
766
854
 
767
- *Example*
768
855
  ```typescript
769
- console.log("Selected object data",atwin.selectedObject)
856
+ import * as atwin from 'architwin';
857
+
858
+ ...
859
+
860
+ console.log("Selected object data", atwin.selectedObject)
861
+
862
+ ...
863
+ ```
864
+
865
+ **Switching Transform Modes**
866
+
867
+ If you wish switch transformation mode, you can pass either 'translate' or 'scale' or 'rotate' as parameters to the `setTransformMode()` method. This will switch the transform controls on the currently selected object
868
+
869
+ | parameter | type | required | default | values |
870
+ | :----: | :----: | :---: | :---: | :---: |
871
+ | mode | string | yes | | 'translate' or 'scale' or 'rotate' |
872
+
873
+
874
+ ```typescript
875
+ import * as atwin from 'architwin';
876
+
877
+ ...
878
+
879
+ // set the transform mode into translate
880
+ atwin.setTransformMode('translate')
881
+
882
+ // set the transform mode into scale
883
+ atwin.setTransformMode('scale')
884
+
885
+ // set the transform mode into rotate
886
+ atwin.setTransformMode('rotate')
887
+
888
+ ...
770
889
  ```
771
890
 
772
891
  #### Programmatically transforming objects
@@ -790,6 +909,10 @@ The **transform** object contains the following key-value pairs. These values wh
790
909
  In this example, we will get a random 3D model from the array of rendered objects stored in `atwin._3DXObjects` and manipulate it using the method. The object we will be manipulating in this example is a 3D model with a file type of GLB (You can also transform other object types such as a media screen). This will return a javascript object that contains the rendered object's data which implement the `IObjectData` interface. You can know more about that by going to this section
791
910
 
792
911
  ```typescript
912
+ import * as atwin from 'architwin';
913
+
914
+ ...
915
+
793
916
  const targetObject = atwin._3DXObjects.find(obj => obj.object.object_data.object_type == 'GLB')
794
917
 
795
918
  const transform = {
@@ -803,19 +926,44 @@ const transform = {
803
926
  }
804
927
 
805
928
  atwin.setObjectTransformation(targetObject.node,transform)
929
+
930
+ ...
806
931
  ```
807
932
 
808
- If done correctly, you should see your target object(s) display or reposition to your intended position,rotation,and scale. Please take note that the transform controls UI will not be attached to the object if you use this method
933
+ **NOTE**: You can also mirror an object by knowing the center position first then add and subtract (depending whether you want to mirror it to the left or to the right) values on either x, y, or z in the object_position.
809
934
 
810
- **Switching Transform Modes**
935
+ ```typescript
936
+ import * as atwin from 'architwin';
811
937
 
812
- If you wish switch transformation mode, you can pass either 'scale' or 'rotate' as parameters to the the `setTransformMode()` method. This will switch the transform controls on the currently selected object
938
+ ...
813
939
 
814
- ```typescript
815
- atwin.setTransformMode('scale')
816
- atwin.setTransformMode('rotate')
940
+ const centerPosition:Vector3 = {x:6, y:6,z:6}
941
+
942
+ // add 5 values in either x, y, or z in the object_position to the mediaScreen to be positioned in the left
943
+ const mediaScreen = ArrayOfMediaScreen.value[0]
944
+ const newObjectPosition = {
945
+ object_position: {x:centerPosition.x+5, y:centerPosition.y, z:centerPosition.z},
946
+ object_rotation: {x:0, y:0, z:0},
947
+ object_scale: {x:4, y:4, z:1}
948
+ } as Object3DPosition;
949
+
950
+ atwin.setObjectTransformation(mediaScreen.node, newObjectPosition)
951
+
952
+ // subtract 5 values in either x, y, or z in the object_position to the mediaScreen to be positioned in the right
953
+ const mirrorMediaScreen = ArrayOfMediaScreen.value[1]
954
+ const mirrorObjectPosition = {
955
+ object_position: {x:centerPosition.x-5, y:centerPosition.y, z:centerPosition.z},
956
+ object_rotation: {x:0, y:0, z:0},
957
+ object_scale: {x:4, y:4, z:1}
958
+ } as Object3DPosition;
959
+
960
+ atwin.setObjectTransformation(mirrorMediaScreen.node, mirrorObjectPosition)
961
+
962
+ ...
817
963
  ```
818
964
 
965
+ If done correctly, you should see your target object(s) display or reposition to your intended position, rotation, and scale. Please take note that the transform controls UI will not be attached to the object if you use this method
966
+
819
967
  ### Undoing and Redoing Transformation Changes
820
968
 
821
969
  Redo and undo are actions that allow you to revert or replay previous transformations performed on an object. They provide a way to navigate through the history of transformations and make adjustments or restore previous states.
@@ -825,33 +973,103 @@ Assuming that you have already selected an object and already performed differen
825
973
  In order to do this, you may use the `revertTransform()` method to revert changes. By default, the action is set to 'undo'.
826
974
 
827
975
  ```typescript
976
+ import * as atwin from 'architwin';
977
+
978
+ ...
979
+
828
980
  atwin.revertTransform()
981
+
982
+ ...
829
983
  ```
830
984
 
831
985
  If you want to redo a tranformation, change the parameter to 'redo'.
832
986
 
833
987
  ```typescript
988
+ import * as atwin from 'architwin';
989
+
990
+ ...
991
+
834
992
  atwin.revertTransform('redo')
993
+
994
+ ...
835
995
  ```
996
+
836
997
  ### Adding Objects To Your Space
837
998
 
838
999
  Adding an object to your space refers to the process of incorporating a pre-existing 2D or 3D object from the database into the 3D space. It allows for the creation of visualizations, simulations, and interactive experiences in your space.
839
1000
 
840
- In order to add an object, you may use the `addObjectToScene()` method.
1001
+ In order to add an object, you may use the `addObjectToSpace()` method.
841
1002
 
842
- | parameter | type | required | values |
843
- | :----: | :----: | :---: | :---: |
844
- | object | I3DObject | yes | object payload |
845
- | option | ObjectConfig | no | valid config object |
1003
+ | parameter | type | required | default |values |
1004
+ | :----: | :----: | :---: | :---: | :---: |
1005
+ | object | I3DObject | yes | | object payload |
1006
+ | config | ObjectConfig | yes | | valid config object |
846
1007
 
847
- There are two ways you can use the `addObjectToScene()` method. We will go through each one
1008
+ There are two ways you can use the `addObjectToSpace()` method. We will go through each one
848
1009
 
849
- #### Programmatically Add Objects
1010
+ **Method 1: Adding Programmatically**
850
1011
 
851
- If you wish to add new object to your space to a pre-defined position, you can use the `addObjectToScene()` method an pass the object data along
1012
+ If you wish to add new object to your space to a pre-defined position, you can use the `addObjectToSpace()` method and pass the `objectConfig` along.
852
1013
 
853
1014
  ```typescript
854
- atwin.addObjectToScene(object:I3DObject, option:object)
1015
+ import * as atwin from 'architwin';
1016
+
1017
+ ...
1018
+
1019
+ const objectID = 1;
1020
+ let objectPayload:I3DObject;
1021
+ objectPayload = await atwin.getObject(objectID);
1022
+
1023
+ const yourTargetPosition = {
1024
+ x: 12.345435,
1025
+ y: 0,
1026
+ z: 4.54754732
1027
+ }
1028
+ const objScale = {x:1,y:1,z:1}
1029
+ const objRotation = {x:0,y:0,z:0}
1030
+
1031
+ let objectConfig = {
1032
+ position: yourTargetPosition,
1033
+ scale: objScale,
1034
+ rotation: objRotation,
1035
+ } as ObjectConfig;
1036
+
1037
+ atwin.addObjectToSpace(objectPayload, objectConfig)
1038
+
1039
+ ...
1040
+ ```
1041
+
1042
+ **Method 2: Adding with click method using getTargetPosition**
1043
+
1044
+ The library has several helper methods that provide a range of commmon functionalities to help you achieve certain actions easier. If for example, you do not have your intended position coordinates stored in the database or in a local area and wish to click a specific area of the 3D space and get that the coordinates of the area you clicked, you may do some by using the `getTargetPosition()` helper method in tangent with the `addObjectToSpace()` method to do so. You can [click here](#getting-the-coordinates-of-a-clicked-area-in-the-3d-space) to know more about the `getTargetPosition()` method
1045
+
1046
+ Here is an example of how you can use the two methods together. This is just one example, it is up to you on how you wish to combine different methods provided by the library
1047
+
1048
+ ```typescript
1049
+ import * as atwin from 'architwin';
1050
+
1051
+ ...
1052
+
1053
+ function myCallbackFunction(clickedPosition){
1054
+ const objectID = 1;
1055
+ let objectPayload:I3DObject;
1056
+ objectPayload = await atwin.getObject(objectID);
1057
+
1058
+ const objRotation = {x:0,y:0,z:0}
1059
+ const objScale = {x:1,y:1,z:1}
1060
+
1061
+ let objectConfig = {
1062
+ position: clickedPosition,
1063
+ scale: objScale,
1064
+ rotation: objRotation,
1065
+ } as ObjectConfig;
1066
+
1067
+ await atwin.addObjectToSpace(objectPayload, objectConfig)
1068
+ }
1069
+
1070
+ atwin.getTargetPosition(myCallbackFunction)
1071
+
1072
+ ...
855
1073
  ```
856
1074
 
857
1075
  ### Creating a Customizable Media Screen
@@ -867,7 +1085,7 @@ In order to add a media screen, you may use the `addMediaScreen()` method. The `
867
1085
  | parameter | type | required | default | values |
868
1086
  | :----: | :----: | :---: | :---: | :---: |
869
1087
  | mediaUrl | string | no | empty string | valid public url to an image|
870
- | transform | {Vector3,Vector3,Vector3} || | Refer to information below**|
1088
+ | transform | {Vector3,Vector3,Vector3} | yes | | Refer to information below**|
871
1089
  | readonly | boolean | no |false | true or false|
872
1090
  | autoplay | boolean | no |false | true or false|
873
1091
 
@@ -892,6 +1110,10 @@ There are many ways you can use this method to add a media screen to your 3D spa
892
1110
  To create a media screen on a pre-defined position, you can create an object that contains the position,rotation,and scale.
893
1111
 
894
1112
  ```typescript
1113
+ import * as atwin from 'architwin';
1114
+
1115
+ ...
1116
+
895
1117
  const yourTargetPosition = {
896
1118
  x: 12.345435,
897
1119
  y: 0,
@@ -907,9 +1129,11 @@ const transform = {
907
1129
  }
908
1130
 
909
1131
  await atwin.addMediaScreen('',transform)
1132
+
1133
+ ...
910
1134
  ```
911
1135
 
912
- If done correctly, you should be able to see your media screen in your intended position. This method is useful if you already the have position,rotation, and scale values stored in a database or possibly in a local array
1136
+ If done correctly, you should be able to see your media screen in your intended position. This method is useful if you already have the position, rotation, and scale values stored in a database or possibly in a local array
913
1137
 
914
1138
  **Method 2: Adding with click method using getTargetPosition**
915
1139
 
@@ -918,6 +1142,10 @@ The library has several helper methods that provide a range of commmon functiona
918
1142
  Here is an example of how you can use the two methods together. This is just one example, it is up to you on how you wish to combine different methods provided by the library
919
1143
 
920
1144
  ```typescript
1145
+ import * as atwin from 'architwin';
1146
+
1147
+ ...
1148
+
921
1149
  function myCallbackFunction(clickedPosition){
922
1150
  const objRotation = {x:0,y:0,z:0}
923
1151
  const objScale = {x:1,y:1,z:1}
@@ -933,6 +1161,8 @@ function myCallbackFunction(clickedPosition){
933
1161
  }
934
1162
 
935
1163
  await atwin.getTargetPosition(myCallbackFunction)
1164
+
1165
+ ...
936
1166
  ```
937
1167
 
938
1168
  #### Attaching an image or video to a Media Screen
@@ -951,23 +1181,36 @@ In this example, we are using a link pointing to the media stored in an s3 bucke
951
1181
 
952
1182
  Example with image:
953
1183
  ```typescript
1184
+ import * as atwin from 'architwin';
1185
+
1186
+ ...
1187
+
954
1188
  const targetMediaScreenId = 12
955
1189
  const validUrl = 'https://stg-feelpet.s3.ap-northeast-1.amazonaws.com/0CB45E51-EC48-4727-906A-4CD8A13C0770.jpg'
956
1190
 
957
- atwin.attachMediaScreenContent(targetMediaScreenId,validUrl,'image')
1191
+ atwin.attachMediaScreenContent(targetMediaScreenId, validUrl, 'image')
1192
+
1193
+ ...
958
1194
  ```
959
1195
 
960
1196
  Example with video:
961
1197
  ```typescript
1198
+ import * as atwin from 'architwin';
1199
+
1200
+ ...
1201
+
1202
+
962
1203
  const targetMediaScreenId = 12
963
1204
  const validUrl = 'https://stg-feelpet.s3.ap-northeast-1.amazonaws.com/VID_20230203_165202.mp4'
964
1205
 
965
- await atwin.attachMediaScreenContent(targetMediaScreenId,validUrl,'video')
1206
+ await atwin.attachMediaScreenContent(targetMediaScreenId, validUrl, 'video')
1207
+
1208
+ ...
966
1209
  ```
967
1210
 
968
1211
  When setting a video as the media screen content. You can use the `setVideoPlayback()` method to programmatically play,pause,mute,and unmute a video. You can navigate to the [playback controls section](#setting-video-playback-in-the-space) to learn more about the method. Here is an example on how to use it.
969
1212
 
970
- In this example, we are getting a random media screen from the `atwin._3DXObject` array which contains all the objects rendered in the space. Media screens whose media type is a video will have a variable called `planeElement` inside the object's `component` which contains an HTML video element that we can manipulate using the `setVideoPlayback()` method. Please take note that this variable is not acessible if the media type of the media screen content is an image.
1213
+ In this example, we are getting a random media screen from the `atwin._3DXObject` array which contains all the objects rendered in the space. Media screens whose media type is a video will have a variable called `planeElement` inside the object's `component` which contains an HTML video element that we can manipulate using the [setVideoPlayback()`](#setting-video-playback-in-the-space) method. Please take note that this variable is not acessible if the media type of the media screen content is an image.
971
1214
 
972
1215
  *Interface used*
973
1216
  ```typescript
@@ -982,9 +1225,16 @@ export interface IObjectData {
982
1225
 
983
1226
  *Example*
984
1227
  ```typescript
1228
+ import * as atwin from 'architwin';
1229
+
1230
+ ...
1231
+
985
1232
  const randomMediaScreen:IObjectData = atwin._3DXObject.find(obj => obj.object.object_data.object_type == 'FRAME')
986
1233
 
987
- setVideoPlayback('play',randomMediaScreen.component.planeElement)
1234
+ // plays the video
1235
+ atwin.setVideoPlayback('play', randomMediaScreen.component.planeElement)
1236
+
1237
+ ...
988
1238
  ```
989
1239
 
990
1240
  You can use the [transform controls](#transforming-objects) to change the position, scale, and rotation of the media screen using the mouse cursor.
@@ -1003,24 +1253,41 @@ Setting video playback refers to the act of adjusting various controls associate
1003
1253
 
1004
1254
  Assuming that you have already selected a video, you can now set the playback of the video.
1005
1255
 
1006
- Inorder to set the playback of a video, you may use the `setVideoPlayback()` method. By default the action is set to 'play'.
1256
+ Inorder to set the playback of a video, you may use the `setVideoPlayback()` method.
1007
1257
 
1008
1258
  | parameter | type | required | default | values |
1009
1259
  | :----: | :----: | :---: | :---: | :---: |
1010
- | action | string | no | play | 'play' or 'pause' or 'mute' or 'unmute' |
1260
+ | action | string | yes | none | 'play' or 'pause' or 'mute' or 'unmute' |
1011
1261
  | element | HTMLVideoElement | yes | none | supported html video element |
1012
1262
 
1013
1263
 
1014
- If you wish to change the action of the playback, add a parameter such as 'pause', 'mute', 'unmute' depending on your preference.
1264
+ If you wish to change the action of the playback, add a parameter such as 'play','pause', 'mute', 'unmute' depending on your preference.
1015
1265
 
1016
1266
  Example:
1017
1267
  ```typescript
1018
- const targetVideoElement:HTMLVideoElmenent = document.getElementById('target-video')
1268
+ import * as atwin from 'architwin';
1019
1269
 
1020
- atwin.setVideoPlayback('pause',targetVideoElement)
1021
- atwin.setVideoPlayback('mute',targetVideoElement)
1022
- atwin.setVideoPlayback('unmute',targetVideoElement)
1270
+ ...
1271
+
1272
+ const randomMediaScreen:IObjectData = atwin._3DXObject.find(obj => obj.object.object_data.object_type == 'FRAME')
1273
+
1274
+ // plays the video
1275
+ atwin.setVideoPlayback('play', targetVideoElement)
1276
+
1277
+ // pauses the video
1278
+ atwin.setVideoPlayback('pause', targetVideoElement)
1279
+
1280
+ // mutes the video
1281
+ atwin.setVideoPlayback('mute', targetVideoElement)
1282
+
1283
+ // unmutes the video
1284
+ atwin.setVideoPlayback('unmute', targetVideoElement)
1285
+
1286
+ ...
1023
1287
  ```
1288
+
1289
+ **NOTE:** Please take note that this variable is not acessible if the media type of the media screen content is an image.
1290
+
1024
1291
  ### Setting Animation Control in the Space
1025
1292
 
1026
1293
  Setting animation control refers to the process of manipulating the playback of animations applied to 3D objects in the space. It involves utilizing controls such as play and pause to control the the animation.
@@ -1037,15 +1304,365 @@ In order to set the animation control of a 3D object, you may use the `setAnimat
1037
1304
  | modelId | number | yes | none | showcase id of the 3D model |
1038
1305
 
1039
1306
  ```typescript
1040
- atwin.setAnimationState('play', 17)
1307
+ import * as atwin from 'architwin';
1308
+
1309
+ ...
1310
+
1311
+ const modelID = 17
1312
+ atwin.setAnimationState('play', modelID)
1313
+
1314
+ ...
1041
1315
  ```
1042
1316
  If you wish to pause the Animation of the 3D object, change the parameter to 'pause'.
1043
1317
 
1044
1318
  ```typescript
1045
- atwin.setAnimationState('pause',17)
1319
+ import * as atwin from 'architwin';
1320
+
1321
+ ...
1322
+
1323
+ const modelID = 17
1324
+ atwin.setAnimationState('pause', modelID)
1325
+
1326
+ ...
1327
+ ```
1328
+
1329
+ ### Copying object To Your Space
1330
+ Copying an object refers to creating a duplicate or clone of an object. When an object is copied in the space, it means that the object's data is duplicated.
1331
+
1332
+ Assuming that you have already selected an object to be copied, you may now copy the object by calling `copyObject()` method. You may also specify a custom offset position and rotation of the object to be cloned.
1333
+
1334
+ | parameter | type | required | default | values |
1335
+ | :----: | :----: | :---: | :---: | :---: |
1336
+ | payload | IShowcaseObject | yes | | object payload |
1337
+ | position_offset | Vector3 | no | +0.5 | |
1338
+ | rotation_offset | Vector3 | no | +0.5 | |
1339
+
1340
+ ```typescript
1341
+ import * as atwin from 'architwin';
1342
+
1343
+ ...
1344
+
1345
+ let offsetPos:Vector3 = {x:0,y:0,z:0}
1346
+ let offsetRot:Vector3 = {x:0,y:0,z:0}
1347
+
1348
+ if (atwin.selectedObject.object) {
1349
+ await atwin.copyObject(atwin.selectedObject.object, offsetPos, offsetRot)
1350
+ }
1351
+
1352
+ ...
1353
+ ```
1354
+ **NOTE:** rotation_offset can be manipulated in order to mirror the object
1355
+
1356
+ ### Adding Object, Getting Object, Updating Object, Deleting Object in the Database
1357
+
1358
+ **Adding Object**: Adding an object in the database refers to the process of creating and inserting a new record into a data table. This involves providing the necessary data and attributes that define the object, and then store the object in the database. The newly added object becomes a part of the dataset and can be retrieved and manipulated as needed.
1359
+
1360
+ In order to add an object in the database, you may use the `addObject()` method. Assuming that you have already setup to have an event listener for file upload.
1361
+
1362
+ | parameter | type | required | default | values |
1363
+ | :----: | :----: | :---: | :---: | :---: |
1364
+ | payload | FileUpload | yes | | |
1365
+
1366
+ ```typescript
1367
+ import * as atwin from 'architwin';
1368
+
1369
+ ...
1370
+
1371
+ let upload = {
1372
+ file: null,
1373
+ filename: '',
1374
+ upload_filename: '',
1375
+ user_id: 1,
1376
+ object_key: '',
1377
+ description: '',
1378
+ name: '',
1379
+ object_type: ''
1380
+ }
1381
+
1382
+ // this function handles the file upload of the user
1383
+ function handleFileUpload(e: Event) {
1384
+ if (!e.target) {
1385
+ return
1386
+ }
1387
+ if (!upload) {
1388
+ console.error("Upload object is undefined")
1389
+ return
1390
+ }
1391
+ upload.file = e.target.files[0];
1392
+ if (!upload.file) {
1393
+ console.error("File is undefined")
1394
+ return
1395
+ }
1396
+
1397
+ // the name of the file - ex. image
1398
+ upload.name = upload.file.name
1399
+ // the filename of the file - ex. image.jpg
1400
+ upload.filename = upload.file.name
1401
+ // the file type of the file - ex. JPG
1402
+ upload.object_type = upload.filename.slice((upload.filename.lastIndexOf(".") - 1 >>> 0) + 2).toUpperCase()
1403
+ // id to user_id
1404
+ upload.user_id = 1
1405
+ // this will become the unique id or filename of the file when stored to amazon
1406
+ upload.object_key = "asdhj-231d-2asd-2jks9-8d8s2"
1407
+
1408
+ //@ts-ignore
1409
+ e.target.value = ''
1410
+ }
1411
+
1412
+ // this function handles the object to be added in the database
1413
+ async function handleAddObject() {
1414
+ if (!upload) {
1415
+ alert("Object payload is empty")
1416
+ return
1417
+ }
1418
+ if (!upload.name) {
1419
+ alert("Enter a valid file name")
1420
+ return
1421
+ }
1422
+ await atwin.addObject(upload)
1423
+ }
1424
+
1425
+ ...
1426
+ ```
1427
+
1428
+ **Getting Object**: Getting an object in the database refers to the action of retrieving a specific record from a data table. Once retrieved, the object's information and attributes can be utilized for various purposes, such as displaying data to the user or displaying the object into the space.
1429
+
1430
+ In order to get an object in the database, you may use the `getObject()` method.
1431
+
1432
+ | parameter | type | required | default | values |
1433
+ | :----: | :----: | :---: | :---: | :---: |
1434
+ | id | number | yes | | |
1435
+
1436
+ ```typescript
1437
+ import * as atwin from 'architwin';
1438
+
1439
+ ...
1440
+
1441
+ const objectId:number = 5
1442
+ let objectPayload:I3DObject;
1443
+
1444
+ // this function handles the object to be retrieved in the database
1445
+ async function handleGetObject() {
1446
+ if (!objectId) {
1447
+ return
1448
+ }
1449
+ const objectData = await atwin.getObject(objectId)
1450
+ if (objectData) {
1451
+ objectPayload = objectData
1452
+ }
1453
+ }
1454
+
1455
+ ...
1456
+ ```
1457
+
1458
+ Now that you already get the object and store it in the variable objectPayload, you may now place the object in the space by using `addObjectToSpace()` method and pass the objectPayload in the parameter.
1459
+
1460
+ ```typescript
1461
+ import * as atwin from 'architwin';
1462
+
1463
+ ...
1464
+
1465
+ if (objectPayload) {
1466
+ await atwin.addObjectToSpace(objectPayload)
1467
+ }
1468
+
1469
+ ...
1470
+ ```
1471
+ **Updating Object**: Updating an object in the database involves modifying the attributes or properties of an existing record from a data table.
1472
+
1473
+ In order to update an object in the database, you may use the `updateObject()` method.
1474
+
1475
+ | parameter | type | required | default | values |
1476
+ | :----: | :----: | :---: | :---: | :---: |
1477
+ | id | number | yes | | |
1478
+ | payload | FileUpload | yes | | |
1479
+
1480
+ ```typescript
1481
+ import * as atwin from 'architwin';
1482
+
1483
+ ...
1484
+
1485
+ const objectId:number = 5
1486
+ let objectPayload:I3DObject
1487
+
1488
+ // this function handles the object to be retrieved in the database
1489
+ async function handleGetObject() {
1490
+ if (!objectId) {
1491
+ return
1492
+ }
1493
+ const objectData = await atwin.getObject(objectId)
1494
+ if (objectData) {
1495
+ objectPayload = objectData
1496
+ }
1497
+ }
1498
+
1499
+ // this function handles the object to be updated in the database
1500
+ async function handleUpdateObject() {
1501
+ if (!objectId) {
1502
+ return
1503
+ }
1504
+ if (!objectPayload) {
1505
+ return
1506
+ }
1507
+ await atwin.updateObject(objectID, objectPayload)
1508
+ }
1509
+
1510
+ ...
1511
+ ```
1512
+ **Deleting Object**: Deleting an object in the database refers to the process of removing a specific record from a data table. This operation permanently erases the object from the database, making its data and attributes no longer accessible.
1513
+
1514
+ In order to delete an object in the databse, you may use the `deleteObject()` method.
1515
+
1516
+ | parameter | type | required | default | values |
1517
+ | :----: | :----: | :---: | :---: | :---: |
1518
+ | id | number | yes | | |
1519
+
1520
+ ```typescript
1521
+ import * as atwin from 'architwin';
1522
+
1523
+ ...
1524
+
1525
+ const objectId:number = 5
1526
+
1527
+ // this function handles the object to be deleted in the database
1528
+ async function handleDeleteObject() {
1529
+ if (!objectId) {
1530
+ return
1531
+ }
1532
+
1533
+ atwin.deleteObject(objectId)
1534
+ }
1535
+
1536
+ ...
1537
+ ```
1538
+
1539
+ ### Deleting Object To Your Space
1540
+
1541
+ Deleting an object in space refers to the process of removing a pre-existing 2D or 3D object from the 3D environment or space. This action results in the elimination of the visual representation and physical presence of the object within the virtual space. By removing the object, users can maintain control over the composition and contents of their space, allowing for more dynamic and tailored virtual experiences.
1542
+
1543
+ Assuming that you have already selected an object to be deleted, you may now delete the object by using `deleteObjectFromSpace()` method.
1544
+
1545
+ | parameter | type | required | default | values |
1546
+ | :----: | :----: | :---: | :---: | :---: |
1547
+ | selected | IObjectData | yes | | |
1548
+
1549
+ ```typescript
1550
+ import * as atwin from 'architwin';
1551
+
1552
+ ...
1553
+
1554
+ // this function handles the object to be deleted from space
1555
+ async function handleDeleteObjectFromSpace() {
1556
+ await atwin.deleteObjectFromSpace(atwin.selectedObject)
1557
+ }
1558
+
1559
+ ...
1046
1560
  ```
1047
1561
 
1048
- ## Meeting Guide
1562
+ **NOTE:** This is only deleting the object from the space and not from the database.
1563
+
1564
+ ### Replacing Object To Your Space
1565
+
1566
+ Replacing an object in space refers to the process of substituting a pre-existing 2D or 3D object within a 3D environment or space with another object. This action involves removing the original object and introducing a new one in its place, while maintaining the object's location and any associated properties or attributes.
1567
+
1568
+ Assuming that you have already selected an object to be replaced, you may now delete the object by using `replaceObject()` method.
1569
+
1570
+ | parameter | type | required | default | values |
1571
+ | :----: | :----: | :---: | :---: | :---: |
1572
+ | payload | I3DObject | yes | | |
1573
+ | target | IObjectData | yes | | |
1574
+ | options | Object | no | null | |
1575
+
1576
+ ```typescript
1577
+ import * as atwin from 'architwin';
1578
+
1579
+ ...
1580
+
1581
+ // id of the object
1582
+ const objectId:number = 5
1583
+ // object that will replace
1584
+ const objectData = await atwin.getObject(objectId)
1585
+ // object to be replaced
1586
+ const objectDataToBeReplaced = atwin.selectedObject
1587
+
1588
+ // this function handles the replaceObject() method
1589
+ async function handleReplaceObject() {
1590
+ await atwin.replaceObject(objectData, objectDataToBeReplaced)
1591
+ }
1592
+
1593
+ ...
1594
+ ```
1595
+
1596
+ ### Creating Text Markup Screen in the space
1597
+
1598
+ A text markup screen is a graphical user interface objecet that allows users to input and display formatted text in the 3D space. The method internally generates elements and programmatically applies CSS styling. You can use this method to display text messages to the 3D screen.
1599
+
1600
+ In order to add a text markup screen in your space, you may use the `addTextMarkupScreen()` method.
1601
+
1602
+ | parameter | type | required | default | values |
1603
+ | :----: | :----: | :---: | :---: | :---: |
1604
+ | title | string | no | empty string | title of message |
1605
+ | message | string | yes | none | message content |
1606
+ | textScreenName | string | yes | none | name of text frame |
1607
+ | transform | {Vector3, Vector3, Vector3} | yes | none | numeric value for x, y, z |
1608
+ | textColor | string | no | black | valid color value |
1609
+ | backgroundColor | string | no | '#fffff' | valid color value |
1610
+
1611
+ ```typescript
1612
+ import * as atwin from 'architwin';
1613
+
1614
+ ...
1615
+
1616
+ const title:string = 'My Text Markup Screen'
1617
+ const message:string = 'This is my message'
1618
+ const position = {
1619
+ x: 12.345435,
1620
+ y: 0,
1621
+ z: 4.54754732
1622
+ }
1623
+ const scale = {x:0, y:0, z:0}
1624
+ const rotation = {x:0, y:0, z:0}
1625
+
1626
+ const transform = {
1627
+ position: position,
1628
+ scale: scale,
1629
+ rotation: rotation
1630
+ }
1631
+
1632
+ atwin.addTextMarkupScreen(title, message, transform)
1633
+
1634
+ ...
1635
+ ```
1636
+
1637
+ #### Setting Content to Text Markup Screen
1638
+
1639
+ If you wish to update the style and content for the text frame, you may use the `setTextMarkupScreenContent()` method. You can customize the text content as well as the foreground and background color of the target text markup screen.
1640
+
1641
+ | parameter | type | required | default | values |
1642
+ | :----: | :----: | :---: | :---: | :---: |
1643
+ | showcase_id | number | yes | none | id of target object |
1644
+ | title | string | no | empty string | title of the content |
1645
+ | text | string | no | empty string | body of the content |
1646
+ | textColor | string | no | black | valid color value |
1647
+ | backgroundColor | string | no | '#fffff' | valid color value |
1648
+
1649
+ ```typescript
1650
+ import * as atwin from 'architwin';
1651
+
1652
+ ...
1653
+
1654
+ const id = 10
1655
+ const title = 'My title'
1656
+ const text = 'This is the content of the body'
1657
+ const textColor = 'white'
1658
+ const backgroundColor = '#00000'
1659
+
1660
+ atwin.setTextMarkupScreenContent(id, title, text, textColor, backgroundColor)
1661
+
1662
+ ...
1663
+ ```
1664
+
1665
+ <!-- ## Meeting Guide
1049
1666
 
1050
1667
  Hosting Live Virtual Meetings in 3D Space
1051
1668
 
@@ -1472,7 +2089,7 @@ export const enum MeetingStatus {
1472
2089
  STOPPED = 2,
1473
2090
  CANCELLED = 3,
1474
2091
  }
1475
- ````
2092
+ ```` -->
1476
2093
 
1477
2094
  ## Function Reference
1478
2095
 
@@ -1526,7 +2143,7 @@ getCurrentSweep()
1526
2143
  // returns the current sweep detail
1527
2144
  // this is a function
1528
2145
 
1529
- getSweepPosition(): {x: number, y: number, z: number} -
2146
+ getSweepPosition(): {x: number, y: number, z: number}
1530
2147
  // returns the position of the current sweep:
1531
2148
  // this is a function
1532
2149
 
@@ -1707,12 +2324,12 @@ getNearbyObjects(type?: '3DX' | 'SLIDESHOW' | 'VIDEO', distance?: number = 2)
1707
2324
  // distance - is optional but with a default of 2 meters
1708
2325
  // this is a function
1709
2326
 
1710
- addObjectToScene(object:I3DObject | undefined, option:Object)
2327
+ addObjectToSpace(object:I3DObject | undefined, option:Object)
1711
2328
  // object - accepts I3DObject or undefined
1712
2329
  // option - accepts an Object. Default is null
1713
2330
  // this is an async function that returns a Promise
1714
2331
 
1715
- addMediaScreen(mediaUrl?: string, transform?:Object3DPosition, readonly?:boolean, autoplay?:boolean)
2332
+ addMediaScreen(mediaUrl?: string, transform:Object3DPosition, readonly?:boolean, autoplay?:boolean)
1716
2333
  // creates a 2D object that can be used to display a wide variety images or videos dynamically
1717
2334
  // mediaUrl - optional but default is empty string
1718
2335
  // transform - optional but default is null
@@ -1741,13 +2358,73 @@ showObjectDimensions(selected:IObjectData)
1741
2358
  // shows the width, height, depth of a 3D model
1742
2359
  // this is a function
1743
2360
 
2361
+ copyObject(payload:IShowcaseObject, position_offset:Vector3 | undefined, rotation_offset:Vector3 | undefined)
2362
+ // copies the the selected objecte
2363
+ // payload - the payload of the selected object
2364
+ // position_offset - optional; the offset of the position on where to add the object in the space
2365
+ // rotation_offset - optional; the offset of the rotation of the object
2366
+ // this is an async function
2367
+
2368
+ addObject(payload:FileUpload)
2369
+ // adds object from the database
2370
+ // payload - payload for the file to be uploaded
2371
+ // this is an async function that returns a Promise<I3DObject>
2372
+
2373
+ getObject(id:number)
2374
+ // retrieves object from the database
2375
+ // id - the unique id of the object
2376
+ // this is an async function that returns a Promise<I3DObject>
2377
+
2378
+ updateObject(id:number,payload:FileUpload)
2379
+ // updates object from the database
2380
+ // id - the unique id of the object
2381
+ // payload - payload for the file to be uploaded
2382
+ // this is an async function that returns a Promise<I3DObject>
2383
+
2384
+ deleteObject(id:number)
2385
+ // deletes object from the database
2386
+ // id - the unique id of the object
2387
+ // this is an async function
2388
+
2389
+ deleteObjectFromSpace(selected:IObjectData)
2390
+ // deleted object from space
2391
+ // selected - the selected or target object to be removed
2392
+ // this is an async functon
2393
+
2394
+ replaceObject(payload:I3DObject, target:IObjectData, options:Object = null)
2395
+ // replaces the object in the space with another object
2396
+ // payload - the new object to replace the target object
2397
+ // target - the object to be replaced
2398
+ // options - optional; options to pass into the loader
2399
+ // this is an async function
2400
+
2401
+ addTextMarkupScreen(title:string, message:string, textScreenName:string, transform:Object3DPosition, textColor:string, backgroundColor:string
2402
+ )
2403
+ // adds a text frame in the pace
2404
+ // title - title of the message
2405
+ // message - message content
2406
+ // textScreenName - name of the text frame.
2407
+ // transform - x,y,x values for position, rotation, and scale
2408
+ // textColor - optional; valid color value
2409
+ // backgroundColor - optional; valid background color value
2410
+ // this is an async function
2411
+
2412
+ setTextMarkupScreenContent(showcase_id:string, title:string, text:string, textColor:string, backgroundColor:string)
2413
+ // updates the style and content of the text frame
2414
+ // showcase_id - showcase id of the target object
2415
+ // title - title of your content
2416
+ // text - body of the text content
2417
+ // textColor - optional; set the color of the text
2418
+ // backgroundColor - optional; set the color of the background
2419
+ // this is a function
2420
+
1744
2421
  ````
1745
2422
 
1746
2423
  **Example**
1747
2424
  ````typescript
1748
2425
  <script lang="ts">
1749
2426
  import * as atwin from 'architwin';
1750
-
2427
+ import type { Object3DPosition } from '../../architwin/src/types';
1751
2428
  ...
1752
2429
 
1753
2430
  // get all nearby objects
@@ -1766,9 +2443,9 @@ showObjectDimensions(selected:IObjectData)
1766
2443
  atwin.getNearbyObjects('3DX', 3)
1767
2444
 
1768
2445
  // creates pre-existing 2D/3D from the DB to the 3D space
1769
- await atwin.addObjectToScene(objectPayload.value)
2446
+ await atwin.addObjectToSpace(objectPayload)
1770
2447
 
1771
- // creates a 2D Frame Object
2448
+ // creates a 2D Frame Object
1772
2449
  atwin.addMediaScreen()
1773
2450
 
1774
2451
  // translates object
@@ -1798,178 +2475,39 @@ showObjectDimensions(selected:IObjectData)
1798
2475
  // show object dimension
1799
2476
  atwin.showObjectDimensions(atwin.selectedObject)
1800
2477
 
1801
- ...
2478
+ // create a duplicate to an existing object in the space
2479
+ await atwin.copyObject(objectPayload)
1802
2480
 
1803
- </script>
1804
- ````
2481
+ // adds an object to the database
2482
+ await atwin.addObject(objectPayload)
1805
2483
 
1806
- ### Meeting
2484
+ // gets an object from the database
2485
+ await atwin.getObject(objectID)
1807
2486
 
1808
- ````typescript
1809
-
1810
- createMeeting(
1811
- spaceId: string,
1812
- hostName: string,
1813
- title: string,
1814
- meetingStart: string,
1815
- meetingStatus: MeetingStatus
1816
- duration: string,
1817
- password: string,
1818
- )
1819
-
1820
- // returns an object consist of meeting URL, meeting ID, meeting password
1821
- // this is an async function that returns a Promise
1822
-
1823
- startMeeting(meetingUrl: string, meetingPassword?: string, meetingConfig: MeetingConfig)
1824
- // meetingUrl - URL generated by `createMeeting` function
1825
- // meetingPassword - optional but default is null
1826
- // meetingConfig - optional but default is null
1827
- // this is an void async function
1828
-
1829
- stopMeeting()
1830
- // this is an async function
1831
-
1832
- getMeetingParticipants()
1833
- // return a list of participants
1834
- // this is an async function
1835
-
1836
- getSpaceMeetings(spaceId: string)
1837
- // spaceId - the id of Space
1838
- // returns a list if meetings
1839
- // this is an async function
2487
+ // updates an existing object from the database
2488
+ await atwin.updateObject(objectID, objectPayload)
1840
2489
 
1841
- getMeeting(meetingId: string)
1842
- // meetingId - the id of the meeting
1843
- // returns a meeting
1844
- // this is an async function
2490
+ // deletes an object from the database
2491
+ await atwin.deleteObject(objectID)
1845
2492
 
1846
- isMeetingExist(meetingId: string)
1847
- // meetingId - the id of the meeting
1848
- // returns a boolean
1849
- // this is an async function
2493
+ // deletes an object from the space
2494
+ await atwin.deleteObjectFromSpace(atwin.selectedObject)
1850
2495
 
1851
- isMeetingActive(meetingId: string)
1852
- // meetingId - the id of the meeting
1853
- // returns a boolean
1854
- // this is an async function
2496
+ // replaces an object in the space
2497
+ await atwin.replaceObject(objectData, atwin.selectedObject)
1855
2498
 
1856
- updateMeetingTitle(meetingId: string, meetingTitle: string)
1857
- // meetingId - the id of the meeting
1858
- // meetingTitle - the new meeting title
1859
- // returns a response status
1860
- // this is an async function
2499
+ // adds a text frame in the pace
2500
+ await atwin.addTextMarkupScreen(title, message, transform, textColor, backgroundColor)
1861
2501
 
1862
- updateMeetingStart(meetingId: string, meetingStart: string)
1863
- // meetingId - the id of the meeting
1864
- // meetingStart - the new date when meeting scheduled to start
1865
- // returns a response status
1866
- // this is an async function
2502
+ // updates the style and content of the text frame
2503
+ atwin.setTextMarkupScreenContent(id, title, text, textColor, backgroundColor)
1867
2504
 
1868
- updateMeetingStatus(meetingId: string, meetingStatus: string)
1869
- // meetingId - the id of the meeting
1870
- // meetingStatus - can be 0 for SCHEDULED, 1 for STARTED, 2 for STOPPED, 3 for CANCELLED
1871
- // returns a response status
1872
- // this is an async function
1873
-
1874
- updateMeetingSpace(meetingId: string, spaceId: string)
1875
- // meetingId - the id of the meeting
1876
- // spaceId - the ID of the new Space
1877
- // returns a response status
1878
- // this is an async function
1879
- ````
1880
-
1881
- **Example**
1882
- ````typescript
1883
- <script lang="ts">
1884
- import * as atwin from 'architwin';
1885
2505
  ...
1886
2506
 
1887
- // create a meeting and generate meeting URL
1888
- atwin.createMeeting(
1889
- '1',
1890
- 'John Doe',
1891
- 'Daily Meeting',
1892
- '2023-07-19T17:34',
1893
- 1.5,
1894
- 'password123',
1895
- )
1896
-
1897
- // start a meeting
1898
- atwin.startMeeting(
1899
- meetingUrl: "http://www.example.com/?meetingId=290d9f7d-fb14-4c8f-9d95-695cac59e44b&role=host",
1900
- meetingPassword: 'password123',
1901
- meetingConfig: {
1902
- customColors: {
1903
- primary900: '16 29 70',
1904
- primary200: '141 164 239',
1905
- primary: '58 92 204',
1906
- }
1907
- deviceControl: {
1908
- videoInput: false,
1909
- audioInput: true,
1910
- audioOutput: true
1911
- },
1912
- meetingBarPosition: 'top',
1913
- }
1914
- )
1915
-
1916
- // stop current or initialized meeting
1917
- atwin.stopMeeting()
1918
-
1919
- // get all current meeting's participant
1920
- atwin.getMeetingParticipants()
1921
-
1922
- // get all meetings in specific Space
1923
- atwin.getSpaceMeetings(spaceId: 1)
1924
-
1925
- // get specific meeting
1926
- await atwin.getMeeting(meetingId: 'bac67012-d2ff-47f6-b427-fc2538caac2b')
1927
-
1928
- // check if meeting exist
1929
- atwin.isMeetingExist(meetingId: 'bac67012-d2ff-47f6-b427-fc2538caac2b')
1930
-
1931
- // check if meeting is active or on-going
1932
- atwin.isMeetingActive(meetingId: 'bac67012-d2ff-47f6-b427-fc2538caac2b')
1933
-
1934
- // updates the meeting title
1935
- atwin.updateMeetingTitle(meetingId: 'bac67012-d2ff-47f6-b427-fc2538caac2b', meetingTitle: 'New Meeting Title')
1936
-
1937
- // updates the date when the meeting schedule to start
1938
- atwin.updateMeetingStart(meetingId: 'bac67012-d2ff-47f6-b427-fc2538caac2b', meetingStart: '2023-07-19T17:34')
1939
-
1940
- // updates the meeting status
1941
- atwin.updateMeetingStatus(meetingId: 'bac67012-d2ff-47f6-b427-fc2538caac2b', meetingStatus: '0')
1942
-
1943
- // updates the meeting space ID
1944
- atwin.updateMeetingSpace(meetingId: 'bac67012-d2ff-47f6-b427-fc2538caac2b', spaceId: 2)
1945
-
1946
2507
  </script>
1947
2508
  ````
2509
+
1948
2510
  **To Do:**
1949
- * when adding an object it should specify the position, scale, rotate of the object
1950
- for example:
1951
- ```typescript
1952
- atwin.addObjectToScene(object:I3DObject, option:object, position:Vector3, scale:Vector3, rotate:Vector3)
1953
- ```
1954
-
1955
- or
1956
- ```typescript
1957
- atwin.addObjectToScene(object:I3DObject, option:object, tranform:Object3DPosition)
1958
- ```
1959
-
1960
- * adding a media screen should be
1961
-
1962
- ```typescript
1963
- addMediaScreen(mediaUrl:string, transform:Object3DPosition, readonly:boolean = false, autoplay:boolean = false)
1964
- ```
1965
- where
1966
- * media could be an empty string or URL string
1967
- * readonly and autoplay is optional
1968
-
1969
- * scale and rotation is not working in transform
1970
- * setMediaScreenContent() has CORS error when getting url from google images
1971
- * for setting the media screen content, we need to get the payload of the media screen object because we need the object ID
1972
- * we can do this by returning the media screen payload from addMediaScreen()
1973
2511
 
1974
2512
  * deleteMediaScreen()
1975
2513
  * hideMediaScreen()