Rick Posted December 18, 2009 Share Posted December 18, 2009 hmm not sure why fw.main.camera:SetMatrix(object.cameraPivot:GetMatrix()) is failing for me then. Getting index for object is not a valid field or method. The wiki doesn't show a GetEntityMatrix() for lua. Was this overlooked? Can it be added? Quote Link to comment Share on other sites More sharing options...
Josh Posted December 18, 2009 Author Share Posted December 18, 2009 entity.matis a member where the matrix can be accessed. Rick, I need more information from you. I don't know if you are running something in the editor, a scripted app, a C++ program, etc. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
macklebee Posted December 18, 2009 Share Posted December 18, 2009 I am still getting GL_Invalid_Value errors whenever I try to load a map with a bmx program. It appears to be related to shaders. If I have a firepit in my scene, I get the error stating "A bug inside the file [C:\Documents and Settings\Josh\Desktop\Projects\Engine\Source\ShaderReference.bmx] can't be debugged because the original source is missing. Without the firepit, it appears to work ok from the small amount I have tested. But I also notice that a simple emitter doesn't show up either. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Rick Posted December 18, 2009 Share Posted December 18, 2009 entity.matis a member where the matrix can be accessed. Rick, I need more information from you. I don't know if you are running something in the editor, a scripted app, a C++ program, etc. My bad, everything I'm doing is via the editor & lua. I created my own object and I have this code I listed above in the object:Update() function. When I save my objects lua file is when I get this error and it's point to the line of code I posted above. Quote Link to comment Share on other sites More sharing options...
Josh Posted December 18, 2009 Author Share Posted December 18, 2009 Try this: fw.main.camera:SetMatrix(object.cameraPivot.mat) Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
gordonramp Posted December 18, 2009 Share Posted December 18, 2009 I'm not getting any shadows, collision is working with the new require("scripts/class") local class=CreateClass(...) but no shadows even though 'Cast shadows..true' is ticked in the properties box. Quote AMD Athlon x2 7750 2.7ghz, 6gb ddr2 ram, Galaxy9800GT 1gig ddr2 video card, Windows 7,64. Link to comment Share on other sites More sharing options...
Rick Posted December 18, 2009 Share Posted December 18, 2009 I'll give that a try when I get home Josh, thanks. So sorry if I missed this, but how do we get all loaded objects/models now? I assume there is a table of all the objects that I can loop through? Quote Link to comment Share on other sites More sharing options...
Josh Posted December 18, 2009 Author Share Posted December 18, 2009 The world has a list of entities. You can also look for a specific class in the classnametable: local class=classnametable["light_directional"] Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Nilium Posted December 18, 2009 Share Posted December 18, 2009 Think this looks like a bug? Not entirely sure if it's the script or what. Seems like it'd be the script, though... Quote MacBook Pro 15.4", Intel Core 2 Duo T9600 2.80GHz, 4GB 1066MHz DDR3, GeForce 9400M 256MB, GeForce 9600M GT 512MB - Mac OS 10.6.2, Vista32 Link to comment Share on other sites More sharing options...
Josh Posted December 18, 2009 Author Share Posted December 18, 2009 How do I produce this result? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Nilium Posted December 18, 2009 Share Posted December 18, 2009 How do I produce this result? 1. New Scene 2. Create terrain: 512x512, 4 meters 3. Sculpt the terrain a bit, just need some minor bumps, really 4. Add two road nodes Things cease to work as expected right about there. I would attach an example SBX, but it won't let me. Quote MacBook Pro 15.4", Intel Core 2 Duo T9600 2.80GHz, 4GB 1066MHz DDR3, GeForce 9400M 256MB, GeForce 9600M GT 512MB - Mac OS 10.6.2, Vista32 Link to comment Share on other sites More sharing options...
Josh Posted December 18, 2009 Author Share Posted December 18, 2009 Okay, there is a confirmed bug where the roads don't construct properly when meters per tile is other than the default value. The number 2 is probably hard-coded in the script somewhere, so I will find it. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
gordonramp Posted December 18, 2009 Share Posted December 18, 2009 Have shadows working, did a clean reinstall.. Quote AMD Athlon x2 7750 2.7ghz, 6gb ddr2 ram, Galaxy9800GT 1gig ddr2 video card, Windows 7,64. Link to comment Share on other sites More sharing options...
Rick Posted December 19, 2009 Share Posted December 19, 2009 Try this: fw.main.camera:SetMatrix(object.cameraPivot.mat) That worked Josh thanks, but I have to wonder why GetMatrix() isn't there? Quote Link to comment Share on other sites More sharing options...
Josh Posted December 19, 2009 Author Share Posted December 19, 2009 I thought it seemed sort of redundant when you have the member itself to access. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Rick Posted December 19, 2009 Share Posted December 19, 2009 So I assume I could just set one mat to the other and wouldn't require the SetMatrix() also then? I guess it's just confusing not having them the same is all. Quote Link to comment Share on other sites More sharing options...
Josh Posted December 19, 2009 Author Share Posted December 19, 2009 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. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
macklebee Posted December 20, 2009 Share Posted December 20, 2009 Josh, I notice that the new class lua script does not get the global objects for framewerk like previously done in the base lua script. This prevents script based entities like emitters from being actually seen in a bmx program from what I can tell. Do you suggest editing the class script to include these: fw=GetGlobalObject("framewerk") world_main=GetGlobalObject("world_main") world_transparency=GetGlobalObject("world_transparency") world_background=GetGlobalObject("world_background") camera_main=GetGlobalObject("camera_main") camera_transparency=GetGlobalObject("camera_transparency") camera_background=GetGlobalObject("camera_background") or edit the individual scripts that would use any of these to get the global objects? also see that globals.lua was completely commented out... is there a reason for that or for the absence of the GetGlobalObjects? Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Josh Posted December 20, 2009 Author Share Posted December 20, 2009 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 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
macklebee Posted December 20, 2009 Share Posted December 20, 2009 is there any thing else that needs to be done? do I need to do a "GetScriptObject" in the lua scripted entity? using the above functions and this in bmax to set the globals: SetScriptObject("fw", fw) SetScriptObject("world_main", fw.Main.world) SetScriptObject("world_transparency", fw.transparency.world) SetScriptObject("world_background", fw.background.world) SetScriptObject("camera_main", fw.Main.camera) SetScriptObject("camera_transparency", fw.transparency.camera) SetScriptObject("camera_background", fw.background.camera) SetScriptObject("listener", CreateListener(fw.Main.camera)) and right now I do not see emitters or hear sounds driven from lua scripts... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
macklebee Posted December 21, 2009 Share Posted December 21, 2009 ok... sounds work... Interestingly enough all I had to do was just change "fw.listener" inside the oildrum.lua file to "listener". It appears "listener" is setup already inside the editor to be equal to "fw.listener"?? so that change allows the sound to still work inside the editor and in bmax... Still getting the occasional GL error with emitters or they just do not show atm... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
macklebee Posted December 21, 2009 Share Posted December 21, 2009 found the issue with the firepit crashing a bmx program whenever it was loaded into a scene... inside the firepit.lua's GetKey function the return has too many parameters: return self.super:GetKey(model,key,value) and it needs to be: return self.super:GetKey(key,value) This is the reason for the GL_INVALID_VALUE error that crashes bmx. now to figure out why i can't get other standalone lua scripted emitters to work inside bmax... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Canardia Posted December 29, 2009 Share Posted December 29, 2009 Here's the LEO version to set the global fw variable in LUA (LuaTools is not part of LEO, but it inherits LEO's Lua class, so you have to copy this code to your program): class LuaTools : public Lua { public: int GetStackSize() { return GetTop(); } void SetStackSize( int size ) { int currentsize = GetStackSize(); if( size<currentsize ) Pop( currentsize-size ); } void SetScriptObject( const std::string& name, BP o ) { int size = GetStackSize(); PushObject( o ); SetGlobal( name ); SetStackSize( size ); } }; Then you can load a whole scene without any need for processcene (water, skybox, lights, everything works): #include "leo.h" using namespace LEO; int main() { Engine engine; Framework fw; engine.Create("Integrated Framework Demo",640,480); fw.Create(); LuaTools luat; luat.Create(); luat.SetScriptObject("fw",fw); fw.SetStats(2); Scene scene; scene.Load("abstract::main.sbx"); fw.main.GetCamera().Move(-10,140,30); fw.main.GetCamera().Turn(0,180,0); while( !Keyboard::I****() && !engine.IsTerminated() ) { fw.Update(); fw.Render(); engine.Flip(0); } fw.Free(); return engine.Free(); } Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.