Still can't figure out how to get orthographic projection working, but I did have a play with the ClipPlane functions....
[img]http://i.imgur.com/cvTS7.jpg[/img]
This is a single entity being sliced into 4 sections with each slice being rendered in a different colour.
code:
[lua]
function ENT:Draw()
if( !self || !self:IsValid() || !self.PieSections ) then return end
local selfPos = self:GetPos()
local start = 0
render.EnableClipping( true )
-- Draw each pie section.
for _, section in pairs( self.PieSections ) do
local change = section.ratio * 360
local finish = start + change + 180
local norm1 = Angle(0,start,0):Forward()
local norm2 = Angle(0,finish,0):Forward()
local dist1 = norm1:Dot( selfPos )
local dist2 = norm2:Dot( selfPos )
local r,g,b = section.color.r/255, section.color.g/255, section.color.b/255
-- First cut
render.SetColorModulation( r,g,b )
render.PushCustomClipPlane( norm1, dist1 )
-- If the change is more than 180 degrees then we need to do some voodoo
if ( change > 180 ) then
self:DrawModel()
render.PopCustomClipPlane()
end
-- Second cut
render.PushCustomClipPlane( norm2, dist2 )
self:DrawModel()
render.PopCustomClipPlane()
if ( change <= 180 ) then render.PopCustomClipPlane() end
-- Start the next section where this one finished off
start = start + change
end
end
ENT.PieSections = { { color = {r=r,g=g,b=b}, ratio = float }, { ... } }
-- Ratio is a float between 0 & 1 representing the amount of pie the section should take up.
-- You can have as many sections as you want but ideally the sum of all the ratios will add up to 1.
[/lua]
Can I have the green piece? :D
How many times is the model rendered just to do that?
[QUOTE=haza55;18986975]Can I have the green piece? :D
How many times is the model rendered just to do that?[/QUOTE]
Equal to the number of slices, and once extra if one of the slices is more than 50%.
[QUOTE=Jinto;11993547][img_thumb]http://cdbarrett.com/dump/gm_construct0002.jpg[/img_thumb]
[/QUOTE]
What is this in the picture actually? Cloth physics?
[QUOTE=maurits150;19100798]What is this in the picture actually? Cloth physics?[/QUOTE]
That it is.
[QUOTE=Jinto;19102045]That it is.[/QUOTE]
Holy shit...
Would you mind telling us how you've managed to do that..? :biggrin:
(It's funny that I ask this ~1.2 years after you posted that picture.)
It's a point mass system. Uses verlet integration and constraint relaxation. Then a mesh is drawn between the points in the system.
[QUOTE=Jinto;19114317]It's a point mass system. Uses verlet integration and constraint relaxation. Then a mesh is drawn between the points in the system.[/QUOTE]
Seems extremely fluid, how many points lay between the cloth, and it's not expensive is it?
That image with the green ribbon is a 128 x 4 system.
Plain lua can't really handle it. It's not a speed issue so much as the garbage collector can't handle it. The garbage collector is extremely inefficient. All of these were done using a binary module.
My video of the flags had no decrease in frame rate. I haven't profiled the code yet, but it doesn't look bad as it stands now.
[QUOTE=Jinto;19134630]Plain lua can't really handle it. It's not a speed issue so much as the garbage collector can't handle it. The garbage collector is extremely inefficient. All of these were done using a binary module.[/QUOTE]
I assumed as much, excellent work, I might add.
Woa that's interesting. Thanks for your info.
[QUOTE=Jinto;17579718]
[media]http://cdbarrett.com/dump/gm_flatgrass0034.jpg[/media]
[media]http://cdbarrett.com/dump/gm_flatgrass0031.jpg[/media]
[media]http://cdbarrett.com/dump/gm_flatgrass0032.jpg[/media]
[media]http://cdbarrett.com/dump/gm_flatgrass0033.jpg[/media]
I have just a little more tweaking to do, then I'll release the update.[/QUOTE]
Jinto i'm still curious as to how the colouring is done in that?
-snip-
now what we need is someone to eventually finish a portal mod...
ummm guys.. i dont understand what are those for and how to install this? [url]http://www.youtube.com/watch?v=yOL3jqanVBQ&feature=related[/url] plz anyone make a tutorial.. im begging
[editline]08:57AM[/editline]
sorry for double posting but i just want a portal gun......I have one from black ops but there is no render or view whatever you call it heh,,,,sorry for my bad english
i just wanted a real portal gun/swep for the garry's mod latest updATE jinto,blackops,luabanana please make one!!
[editline]10:18AM[/editline]
[QUOTE=Lexinator;20038924]now what we need is someone to eventually finish a portal mod...[/QUOTE]
yup
bump no one is answering me!!! please!!! anyone??? or you guys don't want to make because........
maybe you guys can't make a final released of the handheld portal device???
no one is answering me! and sorry for my bad attitude but please help me..or....
just help me with this because i have a portal swep that blackops made and cl_init.lua makes error so i can't see through portals!!!!
I CANT SEE THROUGH PORTALS BECAUSE OF THE lua/entities/prop_portal/cl_init.lua THING!!! OH GOD HELP ME!! ANYONE HELP ME TOO!!! PLEASE!!!
the is probably a stupid question but how does one install this???
[QUOTE=Lantian;20099597]the is probably a stupid question but how does one install this???[/QUOTE]
No need, it now comes with garrys mod by default.
hey no one is answering me please! answer me please!!
[editline]10:12PM[/editline]
ok please help me........with this error
lua\entities\prop_portal\cl_init.lua with the portal, and i have the renderx
[QUOTE=androidboy19;20104832]hey no one is answering me please! answer me please!!
[editline]10:12PM[/editline]
ok please help me........with this error
lua\entities\prop_portal\cl_init.lua with the portal, and i have the renderx[/QUOTE]
can you tell me how to install the renderx
[QUOTE=Lantian;20117010]can you tell me how to install the renderx[/QUOTE]
It's built in to gmod.
help me with the error please!
please the errors i just installed it
This portal gun is OUTDATED, it will not work anymore...
where install this library???
[QUOTE=Guago1;20155148]where install this library???[/QUOTE]
[quote=yakahughes]It's built in to gmod.[/quote]
i cant donwload it ??????!?!?! can you upload it to gmod.org? pls
[QUOTE=Hanfie;20718065]i cant donwload it ??????!?!?! can you upload it to gmod.org? pls[/QUOTE]
It's included in garrysmod default, and from your spelling, I dont think you can figure out how to use it just yet anyhow.
Sorry, you need to Log In to post a reply to this thread.