Forum Replies Created
-
AuthorPosts
-
Ha, nicely done.
Cool, thanks, have saved that for reference, will try grasp it, or as much as I need when I need it!
I have stumbled across ModelViewProjectionMatrix and the like in GLSL fragment shaders, something I’ll be dabbling in again soon, and I realised earlier that this vertex drawing is probably a good candidate for shader-ising anyway.
Got my terrain vertex drawing working for now, slow as heck (obviously), but this might actually help me narrow it down within a given range and speed up slightly.
At least I can see where the vertices are in relation to my texture, which is what I was after!
Thanks, Mark, that looks to have done it… handy to know it was that simple!
Hmm, wasn’t able to get FileStream.ReadAll to read into the array without crashing (no idea why), so suggest using DataBuffer instead! Gives you a block of unsigned bytes, much like a byte array…
[/crayon]Monkey12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455[crayon-5cbaa04bc40e7625987985 inline="true" ]' IGNORE CRAYON CRAP IF SHOWN ABOVE#Import "<std>"Using std..Class TestField bytes:DataBufferEndFunction Main ()Local t:Test = New TestLocal f:String = "C:\Windows\System32\notepad.exe" ' Never assume system paths!If GetFileType (f) = FileType.FilePrint "File " + f + " found!"Print "File size is " + GetFileSize (f) + " bytes"t.bytes = New DataBuffer (GetFileSize (f))Print "Data buffer is " + t.bytes.Length + " bytes"' TEMP WINDOWS BUG WORKAROUND! Reported at https://github.com/blitz-research/monkey2/issues/370f = f.Replace ("\", "/")Local file:FileStream = FileStream.Open (f, "r")If filePrint "Opened"' Read file into data buffer...Print file.ReadAll (t.bytes, 0, t.bytes.Length)' Start of a Win32 executable is always "MZ" (for Mark Zbikowski, DOS developer!):Print String.FromChar (t.bytes.Data [0])Print String.FromChar (t.bytes.Data [1])file.Close ()ElsePrint "Failed"EndifEndifEndDocs are a bit tricky (WIP!), but this is how I would go about it, guessing that functions for interacting with files are likely going to be part of std… clicking into the std tree under Ted’s Docs tab, then finding std.filesystem, then going through the function list:
Amend f:String to the file you want to check. (Demo may or may not work as-is… never assume system paths like this, or that OS is even Windows!)
[/crayon]Monkey1234567891011121314151617181920212223242526272829303132[crayon-5cbaa04bc863e782791811 inline="true" ]' IGNORE CRAYON CRAP IF SHOWN ABOVE#Import "<std>"Using std..Class TestField bytes:Byte []EndFunction Main ()Local t:Test = New TestLocal f:String = "C:\Windows\System32\notepad.exe"If GetFileType (f) = FileType.FilePrint "File " + f + " found!"Print "File size is " + GetFileSize (f) + " bytes"' Resize array to match file size:t.bytes = New Byte [GetFileSize (f)]Print "Array is " + t.bytes.Length + " bytes"EndifEndDataBuffer is probably better for a load of bytes, or a simple byte array in your struct/class?
[/crayon]Monkey12345678910111213141516[crayon-5cbaa04bcb86c342990695 inline="true" ]#Import "<std>"Using std..Class TestField bytes:Byte []EndFunction Main ()Local t:Test = New Testt.bytes = New Byte [1024]EndUpdated my ToyBox thing to include new TerrainCollider-based TerrainBody, works great so far! (Above web demo updated to use this.)
[Forgot about the Chrome reloading thing — think this may just be down to my use of F5 to re-drop boxes, try amending source in Projects thread.]
Hmm, that sounds like a decent workaround, thanks!
Hmm, I’m on Firefox. I do use F5 for dropping boxes here, probably not ideal for web browsers, but assume not related from your description?
EDIT: Wait, from your description, that could well be the problem! Recommend a KeyHit edit and rebuild!
OK, this is getting pretty cool! Nice little terrain/cubes collision demo…
EDIT: Now using new TerrainCollider. See main ToyBox thread in Monkey 2 Projects forum for source.
Bit slow to start up — wonder if this might now be sped up with the aforementioned btHeightfieldTerrainShape? I’m using the MeshCollider here.
(Needs latest ‘develop’ version for anyone trying it.)
Just confirming the demo is working perfect now.
See my previous post if you fancy a porting job, but also this:
You can install via the Ted2Go module manager (Build menu) and try the examples in the module folder.
That collision code’s here, for what it’s worth. (Ctrl-F -> colli)
Cool, look forward to giving it a go!
-
AuthorPosts