Jump to content

2.3 Sync


Josh
 Share

Recommended Posts

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 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

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.

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

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.

Link to comment
Share on other sites

Think this looks like a bug?

 

road.jpg

 

Not entirely sure if it's the script or what. Seems like it'd be the script, though...

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

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.

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

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.

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

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.

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

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?

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

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

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

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...

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

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...

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

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. :blink:

 

 

now to figure out why i can't get other standalone lua scripted emitters to work inside bmax... :unsure:

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

  • 2 weeks later...

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();
}

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...