This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
ds84182's profile picture

[MC 1.6.4] CCLights2 v0.4.1

Started by ds84182, 05 February 2013 - 11:31 AM
ds84182 #1
Posted 05 February 2013 - 12:31 PM
Disclaimer
CCLights2 is pretty easy to use… Until you get into the advanced methods. I am still trying to clean things up with these advanced methods, but if you use it wrong, your cat may die, you house may explode, your love interest may spontaneously combust. That warning goes for the rest of the mod also. That warning goes to modding in general.

Also, if you looked at Sangar's Camera peripheral and was disappointed because it doesn't take pictures, in the beta(on github in "yolobranch") we have a working camera for the tablet.
CCLights2 - a Minecraft mod for real-time pixel manipulation

Quick Info and stuff
Teel Deer, CCLights2 is a sequel to CCLights. You can do stuff with monitors AND lights in this one. You can do pretty stuff with the GPU, you can draw pictures, make pretty pixels, and, I dunno, make a real internet browser by porting Webkit to CC (Good Luck).


CCLights2 is opensource on Github:
https://github.com/ds84182/CCLights2/

Official Documentation on the ComputerCraft Wiki:
http://computercraft.../wiki/CCLights2

Jenkins Build Server:
http://alekbnc.opens.../job/CCLights2/

Download (Click the link that says CCLights2-[VERSION]-[BUILD NUMBER].jar):
http://alekbnc.tk:80.../artifact/dist/

Read "Fifty shades of pixel" from my Skydrive: https://skydrive.liv...hint=file%2c.do


So, if you are truly interested in CCLights2, the GPU api mostly resembles Love2D's graphics api. Internally, textures are essentially a framebuffer.


A CCLights2 tablet, showing an orange box with a drop-shadow.

CCLights2 was originally managed by myself, but now I welcome alekso56 to the development team! I hope to work hard to provide the ComputerCraft community with pixel manipulation and graphical drawing in ComputerCraft!
Edited on 10 August 2014 - 04:08 PM
NeverCast #2
Posted 05 February 2013 - 02:18 PM
I look forward to using this tonight.
Has the lag bug been fixed in CCLights2? I had to disable the mod because of it unfortunately.
Edit: Just noticed 'WIP'.. I'll keep watch for when it's available.
ds84182 #3
Posted 05 February 2013 - 02:36 PM
I look forward to using this tonight.
Has the lag bug been fixed in CCLights2? I had to disable the mod because of it unfortunately.
Edit: Just noticed 'WIP'.. I'll keep watch for when it's available.
You mean CCLights?
Just updated it a minute ago.
xuma202 #4
Posted 06 February 2013 - 12:33 PM
By rendering texture do you mean rendering an image from an external image file or also rendering minecraft textures?
I'd like rendering items and blocks like MC does in the inventories.

However I'm looking forward for the release.

Chris
Oddstr13 #5
Posted 07 February 2013 - 07:28 AM
By rendering texture do you mean rendering an image from an external image file or also rendering minecraft textures?
I'd like rendering items and blocks like MC does in the inventories.

However I'm looking forward for the release.

Chris
Texture as in a picture you can use to draw on the screen, instead of setting many pixles every time you want to draw the same thing, you make a texture, and draw that texture to the screen several times over.

That is my understanding of it from the conversation on IRC atleast.


Also, feature request: Persistent image over world reloads (server restart)
CoolisTheName007 #6
Posted 07 February 2013 - 08:02 AM
1-up for mouse_up/mouse_down
Feature-request:
what I talk about here: basically many drawPixel calls in one call using Lua varargs since tables can't be passed around.
Textures are an improvement, though.
ds84182 #7
Posted 07 February 2013 - 01:57 PM
By rendering texture do you mean rendering an image from an external image file or also rendering minecraft textures?
I'd like rendering items and blocks like MC does in the inventories.

However I'm looking forward for the release.

Chris
Texture as in a picture you can use to draw on the screen, instead of setting many pixles every time you want to draw the same thing, you make a texture, and draw that texture to the screen several times over.

That is my understanding of it from the conversation on IRC atleast.


Also, feature request: Persistent image over world reloads (server restart)
One problem with persistent images is that it makes the saves bigger. It also makes saving a lot slower. Trust me, you don't want that :)/>
ds84182 #8
Posted 07 February 2013 - 02:00 PM
1-up for mouse_up/mouse_down
Feature-request:
what I talk about here: basically many drawPixel calls in one call using Lua varargs since tables can't be passed around.
Textures are an improvement, though.
This could be possible.
My proposed function name would probably be drawPixelBatch(x,y,(r,g,B)/> <- repeated hundreds of times.)
tesla1889 #9
Posted 07 February 2013 - 05:16 PM
YAY GUI!

that was literally the only thing keeping me away from CCLights 1
lieudusty #10
Posted 07 February 2013 - 05:24 PM
Much more realistic. I like it! :D/>
xuma202 #11
Posted 10 February 2013 - 03:38 AM
1-up for mouse_up/mouse_down
Feature-request:
what I talk about here: basically many drawPixel calls in one call using Lua varargs since tables can't be passed around.
Textures are an improvement, though.
This could be possible.
My proposed function name would probably be drawPixelBatch(x,y,(r,g, B)/> <- repeated hundreds of times.)

I have tried this for my mod but I had a multidimensional array and therefore wrote my own onpack() which called itself recursively. It worked but once I ran into trouble because lua was not able to handle my function as a function. So I guess there is a limit with parameters.

2nd:

Can you please allow placing the Light Grids facing upwards/downwards?
People have asked for this with CC Monitors many times. And it would enable creating a DISCO or holodeck thingy.
redeye83 #12
Posted 10 February 2013 - 04:34 AM
2nd:

Can you please allow placing the Light Grids facing upwards/downwards?
People have asked for this with CC Monitors many times. And it would enable creating a DISCO or holodeck thingy.
I 2nd his 2nd!
MudkipTheEpic #13
Posted 10 February 2013 - 05:03 AM
2nd:

Can you please allow placing the Light Grids facing upwards/downwards?
People have asked for this with CC Monitors many times. And it would enable creating a DISCO or holodeck thingy.

I 3rd his 2nd! Wait… I guess that doesn't work as well as I thought it would…
Kye_Duo #14
Posted 18 February 2013 - 10:45 AM
ok…so with this mod would it be possible to make a full touchscreen GUI for a program?

I also can't wait for this mod to come out…it'll make my Galaxy warp core so much cooler than it is now

and my friend can use this all over his Unova region map he's making

wonder how hard it'll be to make scrolling text screens with this…
ds84182 #15
Posted 01 March 2013 - 06:39 AM
ok…so with this mod would it be possible to make a full touchscreen GUI for a program?

I also can't wait for this mod to come out…it'll make my Galaxy warp core so much cooler than it is now

and my friend can use this all over his Unova region map he's making

wonder how hard it'll be to make scrolling text screens with this…
Your friend's idea sounds awesome!
I've been pretty tired lately, so no release yet!
I still don't have Non-gui monitors yet.
Zaggy1024 #16
Posted 01 March 2013 - 08:38 AM
While you're thinking about adding mouse_down and mouse_up events, what about key_down and key_up? Having them would make games so much more awesome it would be epic (CC itself would really benefit from having them too, because people could make some pretty amazing games). It might even encourage me to finally start rewriting my Minecraft clone (and this time with primarily CCLights)! :D/>
ds84182 #17
Posted 01 March 2013 - 01:05 PM
While you're thinking about adding mouse_down and mouse_up events, what about key_down and key_up? Having them would make games so much more awesome it would be epic (CC itself would really benefit from having them too, because people could make some pretty amazing games). It might even encourage me to finally start rewriting my Minecraft clone (and this time with primarily CCLights)! :D/>
I might think about that.
The problem with _up and _down is that I have to send packets… So if people mash random keys then… I get Overburdened Memory Connections and lag.
JustPingo #18
Posted 01 March 2013 - 01:15 PM
Awesome.

We will be able to make powerfuls and beautifuls games with textures and mouse compatibility. It will be "easy" to make games fully in Lua !

Finish it speed :P/>
Kye_Duo #19
Posted 01 March 2013 - 01:40 PM
Your friend's idea sounds awesome!
I've been pretty tired lately, so no release yet!
I still don't have Non-gui monitors yet.

if you just make the pixel panels touch sensitive like the advanced monitors it'd be up to us to program in the right responses
my bro is creating an interactive text based GUI using advanced monitors for his "danger room" and a full GUI would make it soooo much better
with persistent textures, couldn't you use external files for the textures, like CC already does for the programs? it wouldn't increase the save time, but it would still increase the size, though if you could create a universal texture file that anyone could call up from any computer that would cut down on the size if it was a common base for several pixel panels…
and I'm helping my friend with his map, managed to get a fairly accurate Nimbassa City Gym thanks to RC…though we had to cheat and use Teleporters from IC2 cause that building is a massive TARDIS
amtra5 #20
Posted 05 March 2013 - 06:32 PM
While you're thinking about adding mouse_down and mouse_up events, what about key_down and key_up? Having them would make games so much more awesome it would be epic (CC itself would really benefit from having them too, because people could make some pretty amazing games). It might even encourage me to finally start rewriting my Minecraft clone (and this time with primarily CCLights)! :D/>/>

Just as I predicted :)/>

If you could make the screen touch, someone is going to make MCPE :P/>/>
Shnupbups #21
Posted 05 March 2013 - 06:39 PM
:o/> That Windows GUI made in the original, can ACTUALLY BE A GUI NOW!!!!!

Lol Windows 8 in Minecraft.
vScourge #22
Posted 23 March 2013 - 07:09 AM
Is this project still active? I hear CCLights2 is supposed to fix the slowdown problem with CCLights (the first) but at the moment there's no working download available for either of them.
Thanks.
ds84182 #23
Posted 23 March 2013 - 08:30 AM
I am still working on CCLights2, I just have less time than before to work on it.
amtra5 #24
Posted 25 March 2013 - 03:52 AM
DOWNLOAD!!!
Yay!
Kye_Duo #25
Posted 25 March 2013 - 08:02 AM
nice that there is a DL…but….where is everything? I can't find them.
vScourge #26
Posted 27 March 2013 - 07:07 AM
Right, the build posted loads up fine but doesn't seem to provide any blocks or recipes.
amtra5 #27
Posted 29 March 2013 - 01:58 PM
How do you use this?
ds84182 #28
Posted 30 March 2013 - 06:33 AM
Ugh…
GPU Block: 542
Monitor Block: 543
RAM: 544 (With meta values 0,1,2, and 3)
Kye_Duo #29
Posted 30 March 2013 - 07:13 AM
I asked due to the fact I can't find them in the creative tabs, the ram showed up in NEI, but the GPU and monitor blocks didn't show up.
ds84182 #30
Posted 30 March 2013 - 07:18 AM
I asked due to the fact I can't find them in the creative tabs, the ram showed up in NEI, but the GPU and monitor blocks didn't show up.
Hrm… I don't know why it is not in NEI.
Kye_Duo #31
Posted 30 March 2013 - 08:24 AM
I also can't find the config file…maybe I am just blind….
Flenix #32
Posted 13 April 2013 - 06:21 AM
They are showing up in NEI if you go find them by the ID. They're registered as "Unnamed" though; you forgot the language registry for them (at least it's not there in what's on Github)

How functional is this right now? I've swapped out CCLights 1 for this… or is it possible/wise to run both at the moment? All I really need is the ability to render web images in-game, but the idea of being able to draw sounds awesome too.
Sariaz #33
Posted 18 April 2013 - 08:03 PM
I have only two questions. First what version of minecraft is it for. Second which folder does it go in, coremods or mods?
Edited on 19 April 2013 - 02:57 PM
xuma202 #34
Posted 01 May 2013 - 07:40 AM
I have only two questions. First what version of minecraft is it for. Second which folder does it go in, coremods or mods?

You can find instructions and more on this mod here: http://www.minecraftforum.net/topic/1789583-wip151forge-cclights2-v08-tablets-monitors-gpus-eau-my/
xuma202 #35
Posted 01 May 2013 - 12:47 PM
Can you plese make it so we can set the memory in a config 8192 Bytes is too less for me.
Kye_Duo #36
Posted 01 May 2013 - 09:59 PM
are you going to bring back the computer controlled light block? I would love for that to come back.
TorakTu #37
Posted 02 May 2013 - 04:02 PM
Holy Cow ! Just ran into this CCLlights 2 thread. NICE.

I love OpenGL. It would be great to use those functions in this. I never knew this existed until now. :o/>
Sariaz #38
Posted 03 May 2013 - 12:52 AM
I have only two questions. First what version of minecraft is it for. Second which folder does it go in, coremods or mods?

You can find instructions and more on this mod here: http://www.minecraft...rs-gpus-eau-my/

Thank you good sir.
amtra5 #39
Posted 08 May 2013 - 03:01 AM
We NEED floor/roof lights!
manawyrm #40
Posted 10 May 2013 - 01:32 PM
Hello,

have you still got a binary for the 1.4.7 version?
I tried to build it from the source, but failed at compiling.

Thanks,
Tobias
ds84182 #41
Posted 14 May 2013 - 10:25 AM
Hello,

have you still got a binary for the 1.4.7 version?
I tried to build it from the source, but failed at compiling.

Thanks,
Tobias
No. I do not have a 1.4.7 binary. The current version cannot be ported either, because it uses new forge hooks. Sorry.
manawyrm #42
Posted 14 May 2013 - 10:28 AM
hmm. It can be done…
It worked fine, I only had a weird bug on ForgeBukkit that caused my client's to crash, if I was setting the pixels to fast…
allquan #43
Posted 14 May 2013 - 04:35 PM
Yeah love the new CC lights 2! I hope you will continue this gigant work :)/>
Tiin57 #44
Posted 01 June 2013 - 07:50 PM
By the way…
CCLights2 for 1.5.2:
[REDACTED -tiin57]
Totally untested, I just recompiled it in MCP 7.51.
Please don't bother reporting bugs for this version, since I'm not offering support for it and ds84182 didn't have anything to do with it.
ArchAngel075 #45
Posted 08 June 2013 - 08:30 AM
this is absolutely brilliant!, if one can make a game with models that define their own shape and colors then a highly detailed graphical game can be made!
i might just abuse this!

Love the program, and love how making a 128*128 screen randomise each and every pixel every 0.1 doesnt kill my pc XD


that's meant for cclights1

Going to start abusing CClights2 and see what crazy i can get up to!
MindenCucc #46
Posted 04 July 2013 - 11:21 AM
This is for 1.4.7 MC? Because I tried almost every forge for 1.4.7, and it just keeps crashing with this:

java.lang.VerifyError:
(class: ds/mods/CCLights2/PacketHandler, method: onPacket
Data signature: (Lcg;Ldk;Lcpw/mods/fml/common/network/Player;)V)
Incompatible object argument for function call
ds84182 #47
Posted 11 July 2013 - 12:23 PM
This is for 1.4.7 MC? Because I tried almost every forge for 1.4.7, and it just keeps crashing with this:

java.lang.VerifyError:
(class: ds/mods/CCLights2/PacketHandler, method: onPacket
Data signature: (Lcg;Ldk;Lcpw/mods/fml/common/network/Player;)V)
Incompatible object argument for function call
I forgot to update the post after the recent forum rollback.
It is for 1.5.2.
Wiiplay123 #48
Posted 11 August 2013 - 02:48 PM
Where is the CCDesk version of it?
Shaun #49
Posted 23 August 2013 - 05:50 PM
What's the current status of this mod? Are there recipes for survival mode? Are crashes/other bugs fixed? What's the bandwidth load caused by the screens?

also, is there any way for these screens to accept keyboard/mouse input? can you hook multiple screens into one like with normal CC monitors?

sorry for all the questions but the OP doesn't give a lot of information.
gudenau #50
Posted 27 August 2013 - 05:16 PM
Never mind.
Pecacheu #51
Posted 02 November 2013 - 12:38 PM
I don't know how to use this mod at all.
SpoilerThis is what I setup: (The blocks will only place in one direction for some reason.)

This is what happens when I try to use it:

It's giving a weird error about doubles…
I looked everywhere for a tutorial on CCLights or CCLights 2, but couldn't even find a spotlight!
I really need some help. I would also like to know how to use the "tablet"…
Knux14 #52
Posted 08 November 2013 - 02:05 PM
For notch's sake, please .setHardness() and .setResistance()
karelmikie3 #53
Posted 16 November 2013 - 09:33 AM
can you include this mod in modpacks couldn't find anything about that?
Maltiez #54
Posted 09 December 2013 - 02:04 PM
All blocks of this mod are placed so, that their face side looks to one only direction: BigMonitor only to south and monitor only to north. Help!
bobster71 #55
Posted 17 December 2013 - 03:28 AM
hey,

Great work! I was a big fan of cclights, I was the one behind the idea originally. Have a look at my youtube vid (link below) and you'll see what I mean. I'll have a look with your ver and let you know how I go.

Thanks again, I love the idea of displaying bmp's or pic on a big monitor in minecraft.
btw - turn your vol down before watching the vid, mo creatures crickets get annoying… you've been warned :-)
Bobster

[media]http://www.youtube.com/watch?v=e6nfSW4xmtk[/media]



I don't know how to use this mod at all.
SpoilerThis is what I setup: (The blocks will only place in one direction for some reason.)

This is what happens when I try to use it:

It's giving a weird error about doubles…
I looked everywhere for a tutorial on CCLights or CCLights 2, but couldn't even find a spotlight!
I really need some help. I would also like to know how to use the "tablet"…


Have a look at
m=peripheral.getMethods("right")
for lp=1,#m do print(m[lp]) end

God I hope that's right, if not you'll get the idea I hope.
Bobster
Edited on 17 December 2013 - 03:16 AM
ds84182 #56
Posted 22 December 2013 - 01:51 AM
Ok, about stuff and stuff.
I've been away for some time.
If you want documentation, look for it on the ComputerCraft wiki. I think it's still there.
EDIT: http://computercraft.info/wiki/CCLights2 (The information is not up to date though)
I don't know how to use this mod at all.
SpoilerThis is what I setup: (The blocks will only place in one direction for some reason.)

This is what happens when I try to use it:

It's giving a weird error about doubles…
I looked everywhere for a tutorial on CCLights or CCLights 2, but couldn't even find a spotlight!
I really need some help. I would also like to know how to use the "tablet"…
First, you are using setPixels, which is used to set multiple pixels at a time. The syntax for setPixels is (w,h,{r,g,b,a…}).
Right click the tablet with the tablet transmitter and it will link up. I don't have clicking in the tablet gui fixed.
Please don't use CCLights1, it's broken.
Edited on 22 December 2013 - 12:52 AM
xDerParagorn #57
Posted 27 December 2013 - 12:36 PM
Download Error :-(
gamax92 #58
Posted 29 December 2013 - 01:43 AM
BTW, CCLight2 builds are downloadable here: http://alekbnc.tk:8080/

Got bored, decided to try shaded triangles. Made this:
http://pastebin.com/U8EiePtB
Based on pseudo code from here


local gpuobj
local function putpixel(obj)
	gpuobj.setColor(obj.r,obj.g,obj.B)/>/>/>
	gpuobj.plot(obj.x,obj.y)
end

local function copy(orig)
    local orig_type = type(orig)
    local copy
    if orig_type == 'table' then
        copy = {}
        for orig_key, orig_value in pairs(orig) do
            copy[orig_key] = orig_value
        end
    else -- number, string, boolean, etc
        copy = orig
    end
    return copy
end

function gouraud(gpu,x1,y1,x2,y2,x3,y3,r1,g1,b1,r2,g2,b2,r3,g3,b3)
	gpuobj = gpu
	A = {x = x1,y = y1,r = r1,g = g1,b = b1}
	B = {x = x2,y = y2,r = r2,g = g2,b = b2}
	C = {x = x3,y = y3,r = r3,g = g3,b = b3}
	if B.y > C.y then
		B,C = C,B
	end
	if A.y > B.y then
		A,B = B,A
	end
	if A.y > C.y then
		A,C = C,A
	end
	if (B.y-A.y > 0) then
		dx1=(B.x-A.x)/(B.y-A.y);
		dr1=(B.r-A.r)/(B.y-A.y);
		dg1=(B.g-A.g)/(B.y-A.y);
		db1=(B.b-A.B)/>/>/>/(B.y-A.y);
	else
		dx1,dr1,dg1,db1=0,0,0,0;
	end
	
	if (C.y-A.y > 0) then
		dx2=(C.x-A.x)/(C.y-A.y);
		dr2=(C.r-A.r)/(C.y-A.y);
		dg2=(C.g-A.g)/(C.y-A.y);
		db2=(C.b-A.B)/>/>/>/(C.y-A.y);
	else 
		dx2,dr2,dg2,db2=0,0,0,0;
	end
	
	if (C.y-B.y > 0) then
		dx3=(C.x-B.x)/(C.y-B.y);
		dr3=(C.r-B.r)/(C.y-B.y);
		dg3=(C.g-B.g)/(C.y-B.y);
		db3=(C.b-B.B)/>/>/>/(C.y-B.y);
	else 
		dx3,dr3,dg3,db3=0,0,0,0;
	end
	
	E=copy(A);
	S=copy(E);
	if (dx1 > dx2) then
		while (S.y<=B.y) do
			if (E.x-S.x > 0) then
				dr=(E.r-S.r)/(E.x-S.x);
				dg=(E.g-S.g)/(E.x-S.x);
				db=(E.b-S.B)/>/>/>/(E.x-S.x);
			else 
				dr,dg,db=0,0,0;
			end
			P=copy(S);
			while (P.x < E.x) do
				putpixel(P);
				P.r=P.r+dr; P.g=P.g+dg; P.b=P.b+db;
				P.x = P.x + 1
			end
			S.x=S.x+dx2; S.r=S.r+dr2; S.g=S.g+dg2; S.b=S.b+db2;
			E.x=E.x+dx1; E.r=E.r+dr1; E.g=E.g+dg1; E.b=E.b+db1;
			S.y = S.y + 1
			E.y = E.y + 1
		end

		E=copy(B)/>/>/>;
		while (S.y<=C.y) do
			if (E.x-S.x > 0) then
				dr=(E.r-S.r)/(E.x-S.x);
				dg=(E.g-S.g)/(E.x-S.x);
				db=(E.b-S.B)/>/>/>/(E.x-S.x);
			else 
				dr,dg,db=0,0,0;
			end
			P=copy(S);
			while (P.x < E.x) do
				putpixel(P);
				P.r=P.r+dr; P.g=P.g+dg; P.b=P.b+db;
				P.x = P.x + 1
			end
			S.x=S.x+dx2; S.r=S.r+dr2; S.g=S.g+dg2; S.b=S.b+db2;
			E.x=E.x+dx3; E.r=E.r+dr3; E.g=E.g+dg3; E.b=E.b+db3;
			S.y = S.y + 1
			E.y = E.y + 1
		end
	else
		while (S.y<=B.y) do
			if (E.x-S.x > 0) then
				dr=(E.r-S.r)/(E.x-S.x);
				dg=(E.g-S.g)/(E.x-S.x);
				db=(E.b-S.B)/>/>/>/(E.x-S.x);
			else 
				dr,dg,db=0,0,0;
			end

			P=copy(S);
			while (P.x < E.x) do
				putpixel(P);
				P.r=P.r+dr; P.g=P.g+dg; P.b=P.b+db;
				P.x = P.x + 1
			end
			S.x=S.x+dx1; S.r=S.r+dr1; S.g=S.g+dg1; S.b=S.b+db1;
			E.x=E.x+dx2; E.r=E.r+dr2; E.g=E.g+dg2; E.b=E.b+db2;
			S.y = S.y + 1
			E.y = E.y + 1
		end

		S=copy(B)/>/>/>;
		while (S.y<=C.y) do
			if (E.x-S.x > 0) then
				dr=(E.r-S.r)/(E.x-S.x);
				dg=(E.g-S.g)/(E.x-S.x);
				db=(E.b-S.B)/>/>/>/(E.x-S.x);
			else 
				dr,dg,db=0,0,0;
			end

			P=copy(S);
			while (P.x < E.x) do
				putpixel(P);
				P.r=P.r+dr; P.g=P.g+dg; P.b=P.b+db;
				P.x = P.x + 1
			end
			S.x=S.x+dx3; S.r=S.r+dr3; S.g=S.g+dg3; S.b=S.b+db3;
			E.x=E.x+dx2; E.r=E.r+dr2; E.g=E.g+dg2; E.b=E.b+db2;
			S.y = S.y + 1
			E.y = E.y + 1
		end
	end
end
Edited on 29 December 2013 - 12:44 AM
ds84182 #59
Posted 23 January 2014 - 09:13 PM
BTW, CCLight2 builds are downloadable here: http://alekbnc.tk:8080/

Got bored, decided to try shaded triangles. Made this:
http://pastebin.com/U8EiePtB
Based on pseudo code from here


local gpuobj
local function putpixel(obj)
	gpuobj.setColor(obj.r,obj.g,obj.B)/>/>/>/>
	gpuobj.plot(obj.x,obj.y)
end

local function copy(orig)
	local orig_type = type(orig)
	local copy
	if orig_type == 'table' then
		copy = {}
		for orig_key, orig_value in pairs(orig) do
			copy[orig_key] = orig_value
		end
	else -- number, string, boolean, etc
		copy = orig
	end
	return copy
end

function gouraud(gpu,x1,y1,x2,y2,x3,y3,r1,g1,b1,r2,g2,b2,r3,g3,b3)
	gpuobj = gpu
	A = {x = x1,y = y1,r = r1,g = g1,b = b1}
	B = {x = x2,y = y2,r = r2,g = g2,b = b2}
	C = {x = x3,y = y3,r = r3,g = g3,b = b3}
	if B.y > C.y then
		B,C = C,B
	end
	if A.y > B.y then
		A,B = B,A
	end
	if A.y > C.y then
		A,C = C,A
	end
	if (B.y-A.y > 0) then
		dx1=(B.x-A.x)/(B.y-A.y);
		dr1=(B.r-A.r)/(B.y-A.y);
		dg1=(B.g-A.g)/(B.y-A.y);
		db1=(B.b-A.B)/>/>/>/>/(B.y-A.y);
	else
		dx1,dr1,dg1,db1=0,0,0,0;
	end
	
	if (C.y-A.y > 0) then
		dx2=(C.x-A.x)/(C.y-A.y);
		dr2=(C.r-A.r)/(C.y-A.y);
		dg2=(C.g-A.g)/(C.y-A.y);
		db2=(C.b-A.B)/>/>/>/>/(C.y-A.y);
	else
		dx2,dr2,dg2,db2=0,0,0,0;
	end
	
	if (C.y-B.y > 0) then
		dx3=(C.x-B.x)/(C.y-B.y);
		dr3=(C.r-B.r)/(C.y-B.y);
		dg3=(C.g-B.g)/(C.y-B.y);
		db3=(C.b-B.B)/>/>/>/>/(C.y-B.y);
	else
		dx3,dr3,dg3,db3=0,0,0,0;
	end
	
	E=copy(A);
	S=copy(E);
	if (dx1 > dx2) then
		while (S.y<=B.y) do
			if (E.x-S.x > 0) then
				dr=(E.r-S.r)/(E.x-S.x);
				dg=(E.g-S.g)/(E.x-S.x);
				db=(E.b-S.B)/>/>/>/>/(E.x-S.x);
			else
				dr,dg,db=0,0,0;
			end
			P=copy(S);
			while (P.x < E.x) do
				putpixel(P);
				P.r=P.r+dr; P.g=P.g+dg; P.b=P.b+db;
				P.x = P.x + 1
			end
			S.x=S.x+dx2; S.r=S.r+dr2; S.g=S.g+dg2; S.b=S.b+db2;
			E.x=E.x+dx1; E.r=E.r+dr1; E.g=E.g+dg1; E.b=E.b+db1;
			S.y = S.y + 1
			E.y = E.y + 1
		end

		E=copy(B)/>/>/>/>;
		while (S.y<=C.y) do
			if (E.x-S.x > 0) then
				dr=(E.r-S.r)/(E.x-S.x);
				dg=(E.g-S.g)/(E.x-S.x);
				db=(E.b-S.B)/>/>/>/>/(E.x-S.x);
			else
				dr,dg,db=0,0,0;
			end
			P=copy(S);
			while (P.x < E.x) do
				putpixel(P);
				P.r=P.r+dr; P.g=P.g+dg; P.b=P.b+db;
				P.x = P.x + 1
			end
			S.x=S.x+dx2; S.r=S.r+dr2; S.g=S.g+dg2; S.b=S.b+db2;
			E.x=E.x+dx3; E.r=E.r+dr3; E.g=E.g+dg3; E.b=E.b+db3;
			S.y = S.y + 1
			E.y = E.y + 1
		end
	else
		while (S.y<=B.y) do
			if (E.x-S.x > 0) then
				dr=(E.r-S.r)/(E.x-S.x);
				dg=(E.g-S.g)/(E.x-S.x);
				db=(E.b-S.B)/>/>/>/>/(E.x-S.x);
			else
				dr,dg,db=0,0,0;
			end

			P=copy(S);
			while (P.x < E.x) do
				putpixel(P);
				P.r=P.r+dr; P.g=P.g+dg; P.b=P.b+db;
				P.x = P.x + 1
			end
			S.x=S.x+dx1; S.r=S.r+dr1; S.g=S.g+dg1; S.b=S.b+db1;
			E.x=E.x+dx2; E.r=E.r+dr2; E.g=E.g+dg2; E.b=E.b+db2;
			S.y = S.y + 1
			E.y = E.y + 1
		end

		S=copy(B)/>/>/>/>;
		while (S.y<=C.y) do
			if (E.x-S.x > 0) then
				dr=(E.r-S.r)/(E.x-S.x);
				dg=(E.g-S.g)/(E.x-S.x);
				db=(E.b-S.B)/>/>/>/>/(E.x-S.x);
			else
				dr,dg,db=0,0,0;
			end

			P=copy(S);
			while (P.x < E.x) do
				putpixel(P);
				P.r=P.r+dr; P.g=P.g+dg; P.b=P.b+db;
				P.x = P.x + 1
			end
			S.x=S.x+dx3; S.r=S.r+dr3; S.g=S.g+dg3; S.b=S.b+db3;
			E.x=E.x+dx2; E.r=E.r+dr2; E.g=E.g+dg2; E.b=E.b+db2;
			S.y = S.y + 1
			E.y = E.y + 1
		end
	end
end
Holy crap, how bored were you? Anyways,I tried this a couple of months ago (except with textures instead of colors) and I have to say: I would love to have shaded triangles and textured triangles in CCLights2, but the current Graphics2D implementation does not allow for that :/.
Also, thanks for adding a download URL, updated post and stuff for more advertisement stuff. I even added screenshots.
basdxz #60
Posted 27 January 2014 - 12:39 AM
BTW, CCLight2 builds are downloadable here: http://alekbnc.tk:8080/

That one is now broken as well :L.
Alekso56 #61
Posted 27 January 2014 - 01:33 PM
That one is now broken as well :L.

Yes, dot tk was really broken, so i changed to this adress; http://alekso.openshell.no:8080/job/CCLights2/
ds84182 #62
Posted 13 February 2014 - 09:28 AM
Fifty shades of pixel is my non-vulgar document of how parts of CCLights2 works. You can read it here: https://skydrive.live.com/redir?resid=255843FEA16BED6F!979&amp;authkey=!AF9FU9AE3NM7WqY&amp;ithint=file%2c.do
allquan #63
Posted 27 February 2014 - 12:48 PM
Nice work, i like how cclights has been changed over the last year! Will there be a way to set the size of a external monitor to more than 32x32?
Alekso56 #64
Posted 27 February 2014 - 02:53 PM
external monitor to more than 32x32?

Well yes, we are trying to implement dynamic resize of everything based on config values. you might've already noticed the inactive monitor size option in the config.
but it takes time if there's only me working on it. ( busy irl ) and ds is offline 90% of the time. :P/>

also thanks!
Edited on 27 February 2014 - 01:54 PM
sci4me #65
Posted 28 February 2014 - 09:47 PM
my biggest issue: translate is not spelled transelate!!!! ffs!

Can we get some example code???

How do you properly scale text? I want to have text that is small enough to display a useful amount of information… and well, when I scale before drawing the text it just .. well.. messes up lol..
Edited on 28 February 2014 - 08:58 PM
ds84182 #66
Posted 01 March 2014 - 12:48 AM
my biggest issue: translate is not spelled transelate!!!! ffs!

Can we get some example code???

How do you properly scale text? I want to have text that is small enough to display a useful amount of information… and well, when I scale before drawing the text it just .. well.. messes up lol..
"transelate" -> Blame Alekos
Anyways, you cannot resize a pixel to be smaller than it already is
How are you going to make a pixel smaller, of course it would mess up.
Text drawing only supports a scale of 1 and bigger. I can't just take a pixel and make it smaller :P/>
Alekso56 #67
Posted 01 March 2014 - 01:23 AM
my biggest issue: translate is not spelled transelate!!!! ffs!
"transelate" -> Blame Alekso*

/me hides

oh hey, someone fixed the wiki! /me hides some more :ph34r:/>
sci4me #68
Posted 01 March 2014 - 01:28 AM
Well.. is there any easy way to have smaller text?… er..
ds84182 #69
Posted 10 March 2014 - 09:22 PM
Well.. is there any easy way to have smaller text?… er..
Ugh.
Can a pixel be smaller than a pixel?
aahgadi #70
Posted 15 March 2014 - 11:12 AM
while you are talking about monitors and pixels, is someone can help me about tablet transmitter and tablet?
Yevano #71
Posted 15 March 2014 - 09:03 PM
Well.. is there any easy way to have smaller text?… er..
Ugh.
Can a pixel be smaller than a pixel?

Technically yes, through anti-aliasing.
ds84182 #72
Posted 15 March 2014 - 09:07 PM
Well.. is there any easy way to have smaller text?… er..
Ugh.
Can a pixel be smaller than a pixel?

Technically yes, through anti-aliasing.
True, but CCLights2 has no anti-aliasing support.
Alekso56 #73
Posted 19 March 2014 - 02:41 PM
while you are talking about monitors and pixels, is someone can help me about tablet transmitter and tablet?

You mean the same thing this guy asked… or?
aahgadi #74
Posted 19 March 2014 - 04:11 PM
while you are talking about monitors and pixels, is someone can help me about tablet transmitter and tablet?

You mean the same thing this guy asked… or?

Yes, that's exactly what I mean, thanks.
harlekintiger #75
Posted 25 April 2014 - 04:52 PM
Hello programers, I want to ask you for some help.
If I want to start minecraft with CClights2 in the modfolder, I's just not launching it. The reason for that beeing that forge couldn't find "CCTurtle : any". The newest computercraft version and the very file I downloaded via the link in this thread are the only mods I put in. Also I made sure to use the most up to date forge version.
I really hope you can help me!
Regards
~harlekintiger
Edited on 25 April 2014 - 02:54 PM
Yevano #76
Posted 25 April 2014 - 08:58 PM
[MC 1.6.x] [CC1.56] CCLights2 v0.4.1

I'm guessing the mod hasn't been updated for the latest CC. I think you'll need to downgrade to CC 1.56 if you want to use this.
harlekintiger #77
Posted 25 April 2014 - 09:37 PM
Damn it… Alright, I'll test that. Thank you for the idea ;D
harlekintiger #78
Posted 29 April 2014 - 05:36 PM
Will the mod be updated for version 1.63 or at least updated at all? i really hope so, because this mod/addon is on my list of awesome the top most! ;D
Rougeminner #79
Posted 11 May 2014 - 01:25 AM
can you update for CC1.6 and/or minecraft 1.6.4 so i can run it with the new launcher?
Alekso56 #80
Posted 30 July 2014 - 05:12 PM
Updated for cc1.6 - 1.63, needs testing : http://alekso.opensh...b/CCLights2/75/
Edited on 30 July 2014 - 03:13 PM
micheel665 #81
Posted 02 August 2014 - 08:19 PM
Can I make a suggestion? you should add events that trigger when a keyboard key is down, Im suggesting this mainly because it could be really cool to see games with high resolutions that use the keyboard in cclights2
Alekso56 #82
Posted 02 August 2014 - 09:43 PM
Can I make a suggestion? you should add events that trigger when a keyboard key is down, Im suggesting this mainly because it could be really cool to see games with high resolutions that use the keyboard in cclights2

I actually just forgot to write about that event in the wiki, but i really appreciate your input
( since im not really getting any input or drive to move forward.)

("char" , "charhere")
or
("key", "keyhere")

PS: try placing 1 computer down, one gpu, and one tablet extender.
then turn on the computer after you linked the tablet, and "cd /cclights2" "tabletcam sideofgpu" then shiftrightclick with tablet
PSPS: before you discover that you can send images to the computer even out of range, it's a "feature" powered by black hole magic.
Edited on 02 August 2014 - 07:56 PM
Oninoni2 #83
Posted 03 August 2014 - 11:39 PM
Just found a bug:

http://imgur.com/JnKipUZ

Shouldn't this be flat on the Item frame? :D/> Hope you can add this.
Edited on 03 August 2014 - 09:40 PM
Oninoni2 #84
Posted 03 August 2014 - 11:51 PM
I just found out some more Problems:

1. If get about 20 Blocks from a external monitor it starts flickering (Maybe you can move the renderPlane a little bit away from the monitor)
2. And if you go much farther the screen disappeares while the chunks are still there

Aaaand it would be awesome to remotly activate the camera of the tablet (take a photo) when it is in the Itemframe.
Alekso56 #85
Posted 04 August 2014 - 04:12 PM
Shouldn't this be flat on the Item frame? :D/> Hope you can add this.

Yes, that should be flat on the itemframe, will look into that,


1. If get about 20 Blocks from a external monitor it starts flickering (Maybe you can move the renderPlane a little bit away from the monitor)
2. And if you go much farther the screen disappeares while the chunks are still there

Aaaand it would be awesome to remotly activate the camera of the tablet (take a photo) when it is in the Itemframe.

1: the render pane is the monitor… so this is just minecraft being buggy again, i can however load a different texture when it's out of range.
2: issue with minecraft's render distance, you can observe this if you place down a CC monitor and walk 20 blocks away (or a chest for that matter).

remotly activating camera is also a possibility, i will need to add a config option for that tho.
Edited on 04 August 2014 - 02:13 PM
theoriginalbit #86
Posted 05 August 2014 - 02:04 AM
2: issue with minecraft's render distance, you can observe this if you place down a CC monitor and walk 20 blocks away (or a chest for that matter).
take a look into getMaxRenderDistanceSquared and getRenderBoundingBox on your TileEntity.
Alekso56 #87
Posted 07 August 2014 - 08:21 PM
Okay, the issue with the render pane flickering was because ds rendered another surface behind the pane…. so there's that. (it wasn't supposed to be there at all)

and 2: is normal minecraft behaviour…
Alekso56 #88
Posted 10 August 2014 - 05:48 PM
updated stuff/fixed stuff: http://goo.gl/OjvDY4
no remote camera yet, soz
Edited on 10 August 2014 - 06:57 PM
ds84182 #89
Posted 10 August 2014 - 08:01 PM
I am back and I am thinking about developing things again. Alekso56, prepare your eyes because I am about to GL all over the place.
Mc Fow1er #90
Posted 22 August 2014 - 12:52 PM
Uhh, could you please fix the file hosting, the site seems to be down.
Simon #91
Posted 25 August 2014 - 06:21 AM
Yeahh. Your site's jenkins server is down and 50 shades of pixel is no longer on your sky drive.

:(/>
Alekso56 #92
Posted 25 August 2014 - 07:18 PM
blergh, try this instead then https://alekso.openshell.no/jenkins/
AssossaGPB #93
Posted 06 October 2014 - 12:16 AM
Hey ds,
What file format does the "gpu.import(string imagestoredinCC)" function use? Can I import bitmaps or pngs? I'm trying to load in minecraft textures.

Thanks
Alekso56 #94
Posted 13 October 2014 - 07:46 PM
Hey alekso56*,
What file format does the "gpu.import(string imagestoredinCC)" function use? Can I import bitmaps or pngs? I'm trying to load in minecraft textures.

Thanks
gpu.import can import all kinds of images that java support :P/>
Agent Silence #95
Posted 05 November 2014 - 05:01 AM
No download, please supply one because this mod looks awesome, consider using dropbox
Alekso56 #96
Posted 15 December 2014 - 02:13 PM
No download, please supply one because this mod looks awesome, consider using dropbox

wot, but https://alekso.openshell.no/jenkins/ works fine for me
Agent Silence #97
Posted 15 December 2014 - 10:07 PM
No download, please supply one because this mod looks awesome, consider using dropbox

wot, but https://alekso.openshell.no/jenkins/ works fine for me
THANK YOU
You have the wrong link on the OP
Edited on 15 December 2014 - 09:11 PM
Alekso56 #98
Posted 16 December 2014 - 08:22 AM
You have the wrong link on the OP

hahahaha, try talking to ds about that, i don't have control over that post.
J15t98J #99
Posted 01 February 2015 - 03:27 PM
Is this going to be updated for 1.7/1.8? I've just tried the latest download on the Jenkins link that Alekso56 provided, and unsurprisingly it crashed.
thatsimplekid #100
Posted 09 August 2015 - 01:46 AM
Is this going to be updated for 1.7/1.8? I've just tried the latest download on the Jenkins link that Alekso56 provided, and unsurprisingly it crashed.
I second this! After seeing the screens from the original mod, I almost died. And now I've seen this, it's killing me that it's not on 1.7 :(/>
MindenCucc #101
Posted 09 August 2015 - 01:09 PM
Is this going to be updated for 1.7/1.8? I've just tried the latest download on the Jenkins link that Alekso56 provided, and unsurprisingly it crashed.
I second this! After seeing the screens from the original mod, I almost died. And now I've seen this, it's killing me that it's not on 1.7 :(/>

Since it's opensoos, everyone can update it :D/> (btw, I'm currently doin' that :P/>)
PixelFox #102
Posted 15 August 2015 - 07:57 PM
Is this going to be updated for 1.7/1.8? I've just tried the latest download on the Jenkins link that Alekso56 provided, and unsurprisingly it crashed.
I second this! After seeing the screens from the original mod, I almost died. And now I've seen this, it's killing me that it's not on 1.7 :(/>

Since it's opensoos, everyone can update it :D/> (btw, I'm currently doin' that :P/>)
PLEASE PUT IT UP, I really wanna use it :D/>
MindenCucc #103
Posted 15 August 2015 - 08:11 PM
–snip o' quotes–

PLEASE PUT IT UP, I really wanna use it :D/>

Okay, I'll debug it a bit more and report the progress. I think I derp'd something up in the networking, because only the external monitor is working (kinda), and nothing else.
MindenCucc #104
Posted 15 August 2015 - 09:08 PM
Okay, it kinda works… idk if it's my crappy potato toaster, or I broke something, but it shows some life :P/>
It looks like drawText is broken, and sometimes drawings are cut off, but otherwise it seems working.

Spoiler
http://puu.sh/jCMzi/e77fe8bca9.png

Edit:

OMG, I can't believe it's working ^_^/> I compiled the .jar, and posted it here. It's for MC1.7.10 with Forge#1291+
Sometimes things break, but otherwise it's not that buggy :P/> I even found a singleplayer-only dupebug, and fixed it :P/>
And I also optimized the RAM-recipe generator. It just wasn't working for me, so I fixed it too.

Note: the mod .jar is in the archive, you'll have to extract it into your "mods" folder. Oh, and if you see a README.TXT, ALWAYS READ IT :P/>
Edited on 15 August 2015 - 09:34 PM
PixelFox #105
Posted 22 August 2015 - 02:49 PM
Okay, it kinda works… idk if it's my crappy potato toaster, or I broke something, but it shows some life :P/>
It looks like drawText is broken, and sometimes drawings are cut off, but otherwise it seems working.

Spoiler
http://puu.sh/jCMzi/e77fe8bca9.png

Edit:

OMG, I can't believe it's working ^_^/> I compiled the .jar, and posted it here. It's for MC1.7.10 with Forge#1291+
Sometimes things break, but otherwise it's not that buggy :P/> I even found a singleplayer-only dupebug, and fixed it :P/>
And I also optimized the RAM-recipe generator. It just wasn't working for me, so I fixed it too.

Note: the mod .jar is in the archive, you'll have to extract it into your "mods" folder. Oh, and if you see a README.TXT, ALWAYS READ IT :P/>
THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, v
Alais #106
Posted 04 October 2015 - 10:45 PM
Thanks for updating this to 1.7, MindenCucc (and thanks to ds84182 and everyone else who has been involved with the project). It's such a great tool. I don't suppose you know what might be wrong with drawText? I was thinking of using CCLights2 for a major project, but somewhat hard without text capabilities!
MindenCucc #107
Posted 05 October 2015 - 05:45 AM
I don't suppose you know what might be wrong with drawText?

I was just too lazy to edit the post properly. I tested everything, and it works for me.
AmiThist #108
Posted 24 October 2016 - 01:25 AM
Hey, the download link's dead