DrawFeature() ?

DrawFeature() ?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

DrawFeature() ?

Post by Beherith »

Is there a callin like DrawUnit? Except for features? Because Im having a bit of difficulty applying jK's wonderful vertex shader to feature trees.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: DrawFeature() ?

Post by Beherith »

what just happened here?
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: DrawFeature() ?

Post by jK »

someone made a post and deleted it :p

And no, features and units are handled differently in the engine. There isn't a lua controlled rendering pass for features. For more info check my history, I explained the details of this in the past.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: DrawFeature() ?

Post by Beherith »

Yeah, lucky I read it before it got deleted, but I wanted to know if having no texture wasnt really an issue if the unit got textured by the fragment shader anyway, no? I might be saying stupid things, so stop me if I am.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: DrawFeature() ?

Post by jK »

You mean gl.Feature().
You can bind the textures yourself before calling it

Code: Select all

gl.Texture(0,"%"..(-featureDefId)..":1")
gl.Texture(1,"%"..(-featureDefId)..":2")
gl.Feature(featureID)
gl.Texture(0,false)
gl.Texture(1,false)
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: DrawFeature() ?

Post by Argh »

Ah, that would provide a path- just make the Feature invisible by default, use a shader or whatever.

However, it'd cast no shadow and the geometry would still run through the ARB shader, so it's not a cheap way to do things.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: DrawFeature() ?

Post by jK »

Argh wrote:However, it'd cast no shadow and the geometry would still run through the ARB shader, so it's not a cheap way to do things.
erm what? both wrong.

PS: it would SLOW!
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: DrawFeature() ?

Post by zwzsg »

zwzsg hit delete after he wrote:
Beherith wrote:Is there a callin like DrawUnit? Except for features? Because Im having a bit of difficulty applying jK's wonderful vertex shader to feature trees.
There is. But the texture is not applied. Please have a look at http://springrts.com/phpbb/viewtopic.php?f=11&t=18959

jK also mentionned me in IRC a way to manually calculate the texture index used by a feature.
Beherith wrote:what just happened here?
jK wrote:someone made a post and deleted it
I deleted it because I realised shortly after posting that I was doubly irrelevant
  • Beherit request was about the engine calling a Lua function for every feature that's placed on the map.
  • My answer was about Lua calling the engine to render feature that aren't there.
In other words:
  • Call-ins(=Engine->Lua) != Call-outs(=Lua->Engine)
  • Not drawing what exists != Drawing what not exist
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: DrawFeature() ?

Post by Beherith »

Hmm, I thought of a workaround to this: I add features on the map, that are empty objects with a hitsphere, then have lua draw units on each feature which disappear when the feature is reclaimed/destroyed.

Does this make sense?
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: DrawFeature() ?

Post by jK »

featureDef.drawtype = -1
+
featureDef.collisionVolume... = ...

-> engine won't draw a model at all
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: DrawFeature() ?

Post by Beherith »

Hmm, that sounds very good, in fact then I can add LOD-ing to the features as well...
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: DrawFeature() ?

Post by Argh »

featureDef.drawtype = -1
+
featureDef.collisionVolume... = ...
Oh, you can do that? My apologies then, you're absolutely right, that's a lot cleaner. It wouldn't draw to the shadowmap, though, then... oh well.
Post Reply

Return to “Lua Scripts”