<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[GMan's Mods & Stuff — Sprites instead of billboard]]></title>
		<link>https://gprogs.com/viewtopic.php?id=183</link>
		<atom:link href="https://gprogs.com/extern.php?action=feed&amp;tid=183&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Sprites instead of billboard.]]></description>
		<lastBuildDate>Thu, 19 Apr 2007 16:51:53 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Sprites instead of billboard]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=820#p820</link>
			<description><![CDATA[<p>Ok, I think I understood the problem. thanks<br />Just another thought: I was testing for speed between irrlicht billboards and this manually created sprite (with the above update code in the loop)&nbsp; and , to my surprise, the speed was almost the same (for 500 sprites/billboards I had a diference of +/- 1 fps!!). I thought the billboards would have some kind of optimization that would make them faster, but no...<br />So I think there is no problem to use this manualy created sprite instead of billboards...</p>]]></description>
			<author><![CDATA[null@example.com (ksalomao)]]></author>
			<pubDate>Thu, 19 Apr 2007 16:51:53 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=820#p820</guid>
		</item>
		<item>
			<title><![CDATA[Re: Sprites instead of billboard]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=819#p819</link>
			<description><![CDATA[<p>glad i could help <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" />&nbsp; trying to get good rotations using a turn function (which is what the camera and entity turn uses) is pretty hectic.&nbsp; i think the following code may also work for you:<br /></p><div class="codebox"><pre><code>Local rot_x#=0
Local rot_y#=cam.Yaw()
Local rot_z#=cam.Roll()           
sprite.setRotation(_VECTOR3DF( rot_x , rot_y , rot_z) )</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Thu, 19 Apr 2007 15:11:06 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=819#p819</guid>
		</item>
		<item>
			<title><![CDATA[Re: Sprites instead of billboard]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=818#p818</link>
			<description><![CDATA[<p>Thanks!</p>]]></description>
			<author><![CDATA[null@example.com (jippo)]]></author>
			<pubDate>Thu, 19 Apr 2007 14:34:47 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=818#p818</guid>
		</item>
		<item>
			<title><![CDATA[Re: Sprites instead of billboard]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=817#p817</link>
			<description><![CDATA[<p>Perfect!! Thanks!</p>]]></description>
			<author><![CDATA[null@example.com (ksalomao)]]></author>
			<pubDate>Thu, 19 Apr 2007 14:27:34 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=817#p817</guid>
		</item>
		<item>
			<title><![CDATA[Re: Sprites instead of billboard]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=813#p813</link>
			<description><![CDATA[<p>try this for the update code:<br /></p><div class="codebox"><pre><code>Local cam_rot:Vector3df=cam._node.getRotation()
cam_rot.setX(0)
sprite.setRotation(cam_rot)</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Thu, 19 Apr 2007 12:03:19 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=813#p813</guid>
		</item>
		<item>
			<title><![CDATA[Re: Sprites instead of billboard]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=811#p811</link>
			<description><![CDATA[<p>I couldn&#039;t solve it neither, something with setrotation because it works with minib3d. <br />I guess the solution is to use one of the axis rotation codes in the irrlich forum. I will have to figure out how to covert them. If gman could have a look would be great... <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[null@example.com (ksalomao)]]></author>
			<pubDate>Wed, 18 Apr 2007 21:25:03 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=811#p811</guid>
		</item>
		<item>
			<title><![CDATA[Re: Sprites instead of billboard]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=809#p809</link>
			<description><![CDATA[<p>I gave it a look but couldn&#039;t fix the flip. <img src="https://gprogs.com/img/smilies/sad.png" width="15" height="15" alt="sad" /></p><p>Have you had any success?</p>]]></description>
			<author><![CDATA[null@example.com (jippo)]]></author>
			<pubDate>Wed, 18 Apr 2007 16:03:26 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=809#p809</guid>
		</item>
		<item>
			<title><![CDATA[Re: Sprites instead of billboard]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=768#p768</link>
			<description><![CDATA[<p>Hi, jippo<br />there is a problem in the update code that makes the sprite flip (and thus disappear). I am trying to figure out why.<br /></p><div class="codebox"><pre><code>&#039;Update code
Local rot_x#=0
Local rot_y#=cam.Yaw(True)
Local rot_z#=cam.Roll(True)
sprite.setRotation(_VECTOR3DF( rot_x , rot_y , rot_z) )</code></pre></div><p>If you add &quot;EMF_BACK_FACE_CULLING,false&quot; for the sprite (with some image of course) you can see that it flips:<br /></p><div class="codebox"><pre><code>sprite.setmaterialflag(EMF_BACK_FACE_CULLING,0)</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (ksalomao)]]></author>
			<pubDate>Fri, 13 Apr 2007 15:52:38 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=768#p768</guid>
		</item>
		<item>
			<title><![CDATA[Re: Sprites instead of billboard]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=761#p761</link>
			<description><![CDATA[<p>This is something I plan on implementing in near future myself as a part of larger terrain based project I am working on. Thanks for making a good start ksalomao. I am sure we can work this out.</p>]]></description>
			<author><![CDATA[null@example.com (jippo)]]></author>
			<pubDate>Fri, 13 Apr 2007 10:28:20 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=761#p761</guid>
		</item>
		<item>
			<title><![CDATA[Re: Sprites instead of billboard]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=759#p759</link>
			<description><![CDATA[<div class="codebox"><pre><code>SuperStrict
Framework irrlicht.b3d

Global Dwidth:Int = 800
Global DHeight:Int = 600
ib3d_Graphics3D (DWidth,DHeight , 32,2)

&#039;MOUSE
Global FreeLookXS#, FreeLookZS#, FreeLookRotXS#, FreeLookRotYS#, oldmx:Float,oldmy:Float

&#039;CAMERA and LIGHT
Global cam:Camera = ib3d_CreateCamera()
cam.Position (0,0,-12)
Local light:light = ib3d_CreateLight()
ib3d_LightAmbientColor(light,255,255,255)   &#039;&lt;= this seems to activate ambientlight on v1.3

&#039;CREATE b3d Quad  ,It does not appear on screen
Local Quad:MESH=ib3d_CreateMesh()
Local Surf:Surface= ib3d_CreateSurface(Quad,SF_NORMAL)
    Surf.AddVertex(-1,-1,0, 0, 1)
    Surf.AddVertex(-1, 1,0, 0, 0)
    Surf.AddVertex( 1, 1,0, 1, 0)
    Surf.AddVertex( 1,-1,0, 1, 1)
    Surf.AddTriangle(0,1,2)
    Surf.AddTriangle(0 , 2 , 3) 
quad.position (2 , 0 , 0)
quad.scale(5 , 5 , 5)
&#039;Put some texture here:
&#039;Local tex:texture = ib3d_LoadTexture(&quot;midia/clark2.png&quot;)
&#039;ib3d_EntityTexture (quad,tex)


&#039;USE an Irrlicht Mesh
Local sp:IAnimatedMesh = _g_ib3d_engine.smgr.addHillPlaneMesh(&quot;sprite&quot; , _dimension2df(1.0 , 1.0) , _dimension2di(1 , 1) )
Global sprite:iscenenode=_g_ib3d_engine.smgr.addmeshscenenode(sp.getmesh(0))
sprite.setmaterialtype(EMT_TRANSPARENT_ALPHA_CHANNEL)
&#039;sprite.setmaterialtexture(0,_g_ib3d_engine.driver.gettexture(&quot;midia/clark2.png&quot;))
sprite.setscale(Vector3df.createFromVals(5,5,5))
sprite.setposition(_vector3df(-4,0,0))
_RotateAnimMesh(IanimatedMesh(sp).handle,_g_ib3d_engine.smgr.getMeshManipulator().handle,-90,0,0)


&#039;flush mouse moviment
MouseXSpeed()  
MouseySpeed()

Repeat
        
    FreeLook(cam,0.01,0.1)
    
    &#039;Update
    
    Local rot_x#=0
    Local rot_y#=cam.Yaw(True)
    Local rot_z#=cam.Roll(True)
            
    &#039;Quad.rotate (-rot_x,rot_y,rot_z)
    &#039;Update Sprite
    sprite.setRotation(_VECTOR3DF( rot_x , rot_y , rot_z) )
    
    ib3d_RenderWorld
    
Until ib3d_KeyHit(KEY_ESCAPE) 

Function FreeLook(camera:camera, sp# = .1, sp2#=0.2)
    Local pitch#,yaw#
    If sp# &gt; 0 Then
        FreeLookXS# = (FreeLookXS# + ((ib3d_KeyDown(KEY_D) Or ib3d_KeyDown(KEY_RIGHT)) - (ib3d_KeyDown(KEY_A) Or ib3d_KeyDown(KEY_LEFT))) * sp#) * .75
        FreeLookZS# = (FreeLookZS# + ((ib3d_KeyDown(KEY_W) Or ib3d_KeyDown(KEY_UP)) - (ib3d_KeyDown(KEY_S) Or ib3d_KeyDown(KEY_DOWN))) * sp#) * .75
        ib3d_MoveEntity camera, FreeLookXS#, 0, FreeLookZS#
    EndIf
    FreeLookRotXS# = ((-MouseXSpeed() - FreeLookRotXS#) * sp2 + FreeLookRotXS#) * .5
    FreeLookRotYS# = ((MouseYSpeed() - FreeLookRotYS#) * sp2 + FreeLookRotYS#) * .5
    If ib3d_EntityPitch(camera) + FreeLookRotYS# &lt; -89 pitch# = -89 ElseIf ib3d_EntityPitch(camera) + FreeLookRotYS# &gt; 89 pitch# = 89 Else pitch# = ib3d_EntityPitch(camera) + FreeLookRotYS#
        yaw# = -FreeLookRotXS# + ib3d_EntityYaw(camera)
        ib3d_RotateEntity camera, pitch#, yaw#, 0
        MoveMouse DWidth/ 2 , DHeight / 2
        MouseXSpeed()  
        MouseySpeed()
End Function

Function MouseXSpeed:Float()
    Local mxs:Float
    mxs=ib3d_MouseX()-oldmx
    oldmx=ib3d_MouseX()
    Return mxs
End Function

Function MouseYSpeed:Float()
    Local mys:Float
    mys=ib3d_MouseY()-oldmy
    oldmy=ib3d_MouseY()
    Return mys
End Function</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (ksalomao)]]></author>
			<pubDate>Thu, 12 Apr 2007 15:32:04 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=759#p759</guid>
		</item>
		<item>
			<title><![CDATA[Re: Sprites instead of billboard]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=755#p755</link>
			<description><![CDATA[<p>greetings <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" />&nbsp; off hand i dont see any issues although 3D programming is not my forte.&nbsp; do you have sample code for a running example to see it in action?&nbsp; may help resolve the issue.</p>]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Thu, 12 Apr 2007 12:56:55 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=755#p755</guid>
		</item>
		<item>
			<title><![CDATA[Sprites instead of billboard]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=726#p726</link>
			<description><![CDATA[<p>Hi,<br />I am trying to make sprites similar to b3d. Since Irrlicht billboards always face the camera, we have to use another method to simulate SpriteViewMode 2 (Free), 3 and 4 (upright).&nbsp; I am having some problems to emulate them.<br />First I tried to create a quad and texture it, but it did not work (nothing appeared on screen!!). I simply used the b3d method:<br /></p><div class="codebox"><pre><code>local Sprite:Mesh=ib3d_CreateMesh()
Local surf:Surface= ib3d_CreateSurface(Sprite,SF_NORMAL)
    surf.AddVertex(-1,-1,0, 0, 1)
    surf.AddVertex(-1, 1,0, 0, 0)
    surf.AddVertex( 1, 1,0, 1, 0)
    surf.AddVertex( 1,-1,0, 1, 1)
    surf.AddTriangle(0,1,2)
    surf.AddTriangle(0,2,3)
Local tex:texture = ib3d_loadtexture(tex_filename)
ib3d_EntityTexture (sprite,tex)</code></pre></div><p>After I searched on Irrlich forum I tried this (which worked!, just like a quad!)<br /></p><div class="codebox"><pre><code>global sprite3:iscenenode
Local sp:IAnimatedMesh = _g_ib3d_engine.smgr.addHillPlaneMesh(&quot;sprite&quot; , _dimension2df(1.0 , 1.0) , _dimension2di(1 , 1) )
    sprite3:iscenenode=_g_ib3d_engine.smgr.addmeshscenenode(sp.getmesh(0))
    sprite3.setmaterialtype(EMT_TRANSPARENT_ALPHA_CHANNEL)
    sprite3.setmaterialtexture(0,_g_ib3d_engine.driver.gettexture(&quot;sprite.png&quot;))
    sprite3.setscale(Vector3df.createFromVals(10,10,10))
    sprite3.setposition(_vector3df(-7,7,-55))
    sprite3.setRotation(_VECTOR3DF(-90,0,0))   &#039;</code></pre></div><p>ok, my problem now is to update the sprite position. I am having problems to get it right. it behaves strangely, now and then it flips and disapears. If someone could take a look on this code, and help me out, would be great:</p><div class="codebox"><pre><code>Function updateSprite(SpriteViewMode)
Local rot_x#,rot_y#,rot_z#
Select SpriteViewMode
    Case 1
        rot_x#=camera.Pitch(True)
        rot_y#=camera.Yaw(True)
        rot_z#=0
    Case 2
        &#039;FREE
    Case 3
        rot_x#=camera.Pitch(True)
        rot_y#=camera.Yaw(True)
        rot_z#=camera.Roll(True)
    Case 4
        rot_x#=0
        rot_y#=camera.Yaw(True)
        rot_z#=camera.Roll(True)
End Select

sprite3.setRotation(_VECTOR3DF((rot_x+90),rot_y,rot_z))    
End Function</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (ksalomao)]]></author>
			<pubDate>Mon, 09 Apr 2007 20:16:53 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=726#p726</guid>
		</item>
	</channel>
</rss>
