This chapter realizes the effect, through the gui quickly add scenes, furniture, and can quickly set the furniture to achieve an editor effect
I. Basic setup and object addition list
Change it with a case you've done before
First don't have the model, then change the background color and add a mesh helper
1.1 Adding scenarios
First add a function to the event object, then click will call this function, and this function is to add this variable to the scene, then the variable will be assigned to the scene model to be loaded.
Same loading model, except instead of loading it directly, the basicscene is put in after clicking on it
1.2 Adding objects
Next make two buttons to add a potted plant and a sofa
Because there may be a lot of objects here, a loop is used, if the data is such that such data can be given by the backend to the
Create a folder for the gui, use a loop to add buttons to the folder, and note where the clicked buttons go to look for this function to add the object in
II. Manipulating objects with transform controllers
Creating a controller after import
First you need to pass in two parameters camera and canvas element
Then when the controller changes, it also constantly refreshes the scene changes
Also listen to the event of dragging the controller on the object, while dragging the track controller does not move, i.e. the scene does not move.
And then when adding an object in to make that object have a controller.Just bind the object via his attach method.
I made a stupid mistake. I've been doing this for a while. I'm not going to talk about it.
Anyway, that's the end result.
2.1 Furniture list and control object switching
Start by creating a furniture list folder
Then the logic is to drop a gui into the folder after clicking on a new object and to add a change controller to the object to select it.
2.2 Displacement rotation scaling mode
Patterns are required
Of course it can also be set up quickly by setting up keyboard events
2.3 Switching coordinates and deselecting objects
There are two coordinates local and world, you can make the object rotate and shift around whatever coordinates, etc., deselect the direct call method
2.4 Fixed ratio for scaling displacement rotation
Now the zoom displacement and so on are more arbitrary, if you want to fix each displacement and so on the distance can be set so, first of all in the gui can define a variable is no longer a function of the
Then create a folder thatNote that if gui is a variable, it can be followed by an object to set the optional range of values for the variableThen the eventobj gets the value of each change and assigns it to tcontrols.
Rotation and scaling are the same, but the settings are different.
take note ofThe gui can set a range and change the size each time it is dragged
2.5 Adsorption floor and interior light switch
It is now possible to drag randomly to the bottom of the scene, if you want to keep the object on the ground all the time
Also set a gui variable
Add a button
Just change this variable, and then you can use the controller's change event to keep getting the value of the variable so that the y-axis stays at 0 and doesn't fall to the ground.
The lights in the room are turned on by first defining a gui
Need to tone map the renderer
At the same time, adjust the exposure to 1
Change exposure by judging the value of the light