-
Posts
23,313 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by Josh
-
-
I am adding to this lesson. It's getting quite long, and talks about all aspects of the engine and Lua.
-
If you just loaded a model and set the target it would actually work automagically.
-
I think by "procedural" they probably mean they have a series of connected nodes the artist places, and the engine builds a mesh at runtime, sort of like how ours work.
-
Let me know if you find any other problems. I am going through the scripts looking for any errors.
This is a good practical lesson in the importance of consistency. B)
-
This should work to set globals in the Lua virtual machine:
Function SetScriptObject(name:String,o:Object) Local size:Int=GetStackSize() lua_pushbmaxobject(luastate.L,o) lua_setglobal(luastate.L,name) SetStackSize(size) EndFunction Function GetStackSize:Int() Return lua_gettop(luastate.L) EndFunction Function SetStackSize(size:Int) Local currentsize:Int=GetStackSize() If size<currentsize lua_pop(luastate.L,currentsize-size) EndIf EndFunction
-
It may be invisible, but it will still be stored in memory and in the lua object table. The class will never get freed either.
-
I usually like to have a lot of extra checks:
function class:CreateObject(model) local object=self.super:CreateObject(model) object.cube=CreateCube() function object:Free() if self.cube~=nil then self.cube:Free() self.cube=nil end self.super:Free() end end
Don't forget self.super:Free()!
-
Yes, just apply a different material.
I fixed the math function name thing. It's in the sync folder.
-
Nope. The terrain shader doesn't use a matrix multiplication, for better speed.
-
Turn on trilinear filtering and set anistropic filtering to 4.0.
-
You can do quite a bit to the 2.3 editor with scripts.
- 1
-
That looks familiar.
-
I added a vcproject to the Transparency and Refraction lesson. I'm going to include a project with each lesson showing the final result.
Unfortunately, the Windows 64-bit Program Files convention interferes with this, because the project doesn't know if the header files are in C:\Program Files\Leadwerks Engine SDK or C:\Program Files (x86)\Leadwerks Engine SDK. I am going to make these projects with the header in C:\Leadwerks Engine SDK, and the default installation directory will be moved there as well.
-
The floor/ceiling sliders can be used to control the opacity.
-
There are still a few things I can do to improve performance with points lights especially. Multithreading won't actually make that much of a difference, because most of the bottlenecks occur on the GPU.
-
Within one month.
-
TerrainHeight will return the height at a specific grid point. Terrain elevation will return an interpolated height at a 3D position in global coordinates.
-
-
The issue is resolved. Sync.
-
Your first code you posted worked perfectly.
-
function object:Free() (no parameters)
-
If you add require("scripts/loop") at the top, you will import the loop script, which has a few functions declared the engine picks up:
require("Scripts/hooks") function UpdateWorldHook() RunHooks("UpdateWorld") end function UpdatePhysicsHook() RunHooks("UpdatePhysics") end function FlipHook() RunHooks("Flip") end
I just added the FlipHook() function, so I guess it doesn't make sense to call this file "loop" anymore. Maybe "enginehooks" would be a better file name?
Then the user can use AddHook("UpdateWorld",myfunction) to add their own Lua hooks, and your main loop doesn't have to have any code hardly.
-
You could but the results would be unpredictable because SetMatrix() updates the entity position, rotation, scale, etc.
Here is a list of members:
http://leadwerks.com...ntities#Members
The following are the documented members of the Entity class. Generally, members should be treated as read-only. For example, setting the entity position by changing the position vector values will fail to perform necessary updates the SetPosition() command would call, and the results may be unpredictable.
-
Getting started with Lua script
in Programming
Posted
I updated the file. It's 21 pages now and growing. So far it covers all aspects of scripting, and next I will write about integrating Lua with other languages.