Jump to content

Get surface of a BrushClass entity


thehankinator
 Share

Recommended Posts

I wrote a script that will convert a prefab(containing just CSG) to a obj/mtl file. Below is the relevant code. RecordInfo reports that the class is BrushClass. If I run the script in a separate directory (paths to shaders and textures broken) the entities are ModelClass, which has surfaces and the obj/mtl are exported as expected. But that's neither here nor there.

 

world=World:Create()
Prefab:Load(prefabfile)
local aabb = AABB(-99999999,-99999999,-99999999,99999999,99999999,99999999)
world:ForEachEntityInAABBDo(aabb, "RecordInfo")

Link to comment
Share on other sites

At runtime, a csg/brush is converted to the Model Class - assuming it doesn't have a script or mass. You can then get the surface easily. Out of curiosity, does the inherent export for the CSG not work for your needs or is there another aspect that requires you to make your own export?

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

I'm looking in the header file for Brush in C++ and there is a function called FindSurface(). You pass a material and it returns a surface with that material in the brush. Try that.

Unfortunately that function isn't visible in Lua, I should have mentioned that in OP.

 

At runtime, a csg/brush is converted to the Model Class - assuming it doesn't have a script or mass. You can then get the surface easily. Out of curiosity, does the inherent export for the CSG not work for your needs or is there another aspect that requires you to make your own export?

There is already an export for CSG? How!

Link to comment
Share on other sites

Unfortunately that function isn't visible in Lua, I should have mentioned that in OP.

yep, in lua the only FindSurface() available was for Model:FindSurface() - which you may be able to use after the csg/brush is auto converted.

There is already an export for CSG? How!

Its been available for quite sometime to export to OBJ.

post-14-0-61881200-1456626945.jpg

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

  • 1 year later...

At runtime, a csg/brush is converted to the Model Class - assuming it doesn't have a script or mass. You can then get the surface easily. Out of curiosity, does the inherent export for the CSG not work for your needs or is there another aspect that requires you to make your own export?

 

I still have the question about getting the surface of a csg..!

> "After runtime", do you mean after start() ?

> if the csg cannot have an added script, how do you want to get the surface ???

thx

 

Edit I checked this too

http://www.leadwerks.com/werkspace/topic/14455-getting-brushes-surface/page__hl__surface

 

 

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