|
|
« Reply #30 on: March 25, 2013, 09:42:12 AM » |
|
def enc(f): i=0
if f==0: return i if f<0: i+=2**31; f*=-1 #set the sign #NOTE: 2^31 = 29; 2**31 = 1<<31
e=0 while f<1.0 or f>=2.0: if f<1.0: f*=2.0; e-=1 else: f/=2.0; e+=1
i+=(e+127)*(2**23) #add the exponent i+=round((f-1)*(2**23)) #add mantissa
return int(i) print enc(0.35) = 3EB33333, which is correct
This seems to work, you just had this exponent wrong, and it was throwing the result off slightly. I tested my program enough and it should have been correct to begin with. Note the >= in the while loop, else it might let in numbers that are a power of 2 one early (although it might not make a difference, it should be inclusive one side and exclusive the other).
|
|
« Last Edit: March 25, 2013, 09:43:50 AM by jdaster64 »
|
Logged
|
|
|
|
|
|
|
« Reply #31 on: March 26, 2013, 05:43:58 AM » |
|
ahhh I see... well now you've told me more than PyTony over at Daniweb thanx
now it's time for me to make this work with multiple any byte-size, and then 'or' the calculations together. (adding is less efficient, so I believe) ^built a binary adder in minecraft...
prove me wrong plox
Post Merge: March 26, 2013, 06:04:42 AM @Diddy: your exe for UMC...
is there a way you could make it display the results of the python interpreter??
if so, UMC can be launched with pythonw.exe (no console)
also... please make it close itself when you close UMC
Post Merge: March 26, 2013, 07:27:14 AM as for progress... the GUI is now just as functional as it was previously
I'm now working on the scrollbar and scrollbox widgets.
after that comes the file browsers. (yes, custom file browsers for each type of file handling) ^ mainly models, animations, and images...
Post Merge: March 26, 2013, 08:34:51 AM @jdaster: it works! and it works perfectly
dec(enc(0.35,1),1) >>> 0.34375
for an 8bit float, that's 0x16 (tested with other tests as well)
here's the code for whatever uses you may have:
def enc(value, byte_size=4): if value==0: return 0 #speedy (before performing calculations) e= #copy this code from one of my previous posts S,E,M=0,b,0 #set the exponent as the bias if value<0: S=1; value*=-1 while value<1.0 or value>=2.0: #calculate the normalized exponent #this code hasn't changed (other than renaming 'f' to 'value' and 'e' to 'E') M=int(round((value-1)*(1<<m))) #calculate the mantissa return (S<<(e+m))|(E<<m)|M
you can now get an int of any size from a float of whatever you input eg: enc(1.0,5) >>> 0x3f80000000
thanx again
Post Merge: March 26, 2013, 06:16:50 PM let's not forgot... both of you are getting credit on what you did for UMC
in both the credits and the src
er... Diddy... yours shows easily
it just needs some work XDD
thank you guys so much for your help, honestly
you have no idea how excited I am and can't wait to release dev5 for you guys =D
|
|
« Last Edit: March 26, 2013, 06:16:50 PM by DarkPika »
|
Logged
|
|
|
|
|
|
|
|
|
|
|
|
« Reply #37 on: April 02, 2013, 03:57:40 PM » |
|
|
|
« Last Edit: April 02, 2013, 05:08:35 PM by DarkPika »
|
Logged
|
|
|
|
|
|
|
« Reply #38 on: April 05, 2013, 06:47:21 PM » |
|
found out what was causing the rest of the lag... >_> it was the fonts... -.-*
so... now I'm simplifying the font layers to just contain text with some font info, and then set up another buffer specifically for holding the character-texture IDs for a particular font size... (these will be managed to not recalculate the same font)
one problem I'm having though is I have to try not to use dictionaries to store the ID, or {'A':0, 'B':1}...
while dictionaries are ungodly fast for access, they consume quite a bit of memory... (I'm already getting memory access issues from the widget and layer buffers, since they use multi-dimentional dictionaries) ^ luckilly that doesn't happen very often.
I'll try to have it as good as I can... but right now, I have no idea on how to set up a font system as complex as this >_<
Post Merge: April 06, 2013, 07:12:01 PM I'm not sure if this is good news or bad news... take it how you please XD
well... I've just recently stumbled across the input module for PyGame/PyOpenGL called Albow
Albow adds the ability to have widget control in your "game"... (since UMC is technically a game)
this is exactly what I was working on coding, except compaired to this, I've only got about 30% support for what's needed...
this thing does throw quite a large stone in my path as it hijacks the GL run-loop and supplies it through it's 3rd-party interface...
this means that all of my current work with GL and SDL is now scrap...
however, the replacement code will be more than simple XD
subtract 1284 lines of code add 5 lines of code
|
|
« Last Edit: April 06, 2013, 07:15:58 PM by DarkPika »
|
Logged
|
|
|
|
|
|
|
|
« Reply #40 on: April 07, 2013, 06:36:17 AM » |
|
What happend to "complexity == fun >:3"? D:<
Lol jk, glad to hear you found something much more simple.
lol, glad you noticed that =3
it still applies but sadly, the time to work on it doesn't... I don't think people can wait another 2 years for this... heh
this thing just killed about 40% of the whole program... heh (or the code I've put into it)
don't mind me though, this is about my 5th time scrapping and rebuilding this thing XDD
I lost count of how many scrap and rebuilds I've done since UMC2x
and thanx btw
Post Merge: April 07, 2013, 09:01:33 PM well... I've just done enough research about Albow to know that it's not what I want...
while it efficiently manages widgets, it draws it's widgets using PyGame surfaces and converts them to GL pixel draws...
if I didn't have around 20 to 50 widgets being drawn on the screen, and if PyGame surface alpha worked for me, I'd use it.
but because I use GL, this thing isn't very efficient with alot of widgets... :/
so while this wasn't what I needed, it did inspire me to look for other similar libraries, and I've found one that has a better screenshot and description. it's called SPG (Simple Pygame GUI) and actually mentions about a widget order, which caught my interest...
I've asked to see if this will: - work with GL - allow for back-layering (drawing frm FG to BG) - allow rendering of transparent fonts (PyGame does not do this)
I'll keep you guys updated on the results
but for the meantime, does anyone have any ideas they'd like to see in UMC's GUI?? I havn't really been thinking of operations to perform, or what to put in the layout as I've been busy designing the layout itself... heh
|
|
« Last Edit: April 07, 2013, 09:01:34 PM by DarkPika »
|
Logged
|
|
|
|
|
|
|
« Reply #41 on: April 08, 2013, 02:08:20 PM » |
|
the main thing here on this project i am hoping for getting to work: convert brawl/NSMBwii animetions to 3ds max without models or animetions gets messed up and convert the mld0 models aswell perfect since for some ppl export the mld0 to dae via brawlbox and the import that dae to 3ds max dont work the bones/polygons gets messed up and also alot of times the normals
also hoping it will be possible to keep the model´s shaders/materials with this program from mld0 to 3ds max (or from 3ds max to mld0 models)
|
|
|
Logged
|
I Dont Take Requests & Dont Do Brawl Mods anymore Maybe Sm4sh modz later
|
|
|
|
|
|
« Reply #42 on: April 08, 2013, 02:29:09 PM » |
|
This looks incredibly interesting. Definitely be keeping my eye on this (even though I have for a while now, just didn't say anything).
This will be a great asset to the hacking community.
Keep up the good work Tcll. You got this.
|
|
|
Logged
|
In other words, LURK MORE. In other news, birds fly, sun shines, fishes swim, and the sky is [censored]ing BLUE. 3. ... You seriously don't know who Clinton is? If only hacking Brawl paid bills. O snap But you are in a Smash Bros. thread. You can't have an opinion here.
|
|
|
|
|
|
« Reply #43 on: April 08, 2013, 02:59:15 PM » |
|
the main thing here on this project i am hoping for getting to work: convert brawl/NSMBwii animetions to 3ds max without models or animetions gets messed up and convert the mld0 models aswell perfect since for some ppl export the mld0 to dae via brawlbox and the import that dae to 3ds max dont work the bones/polygons gets messed up and also alot of times the normals
also hoping it will be possible to keep the model´s shaders/materials with this program from mld0 to 3ds max (or from 3ds max to mld0 models)
well for the models... I'll be supporting materials and texture parameters (they're not shaders) 100%.
I'm still learning and experimenting in sub-programs, thank you Ian ^_^
as for animations, I've got too many ideas for linking them to the model, and I'm not sure which to choose... :/ I'll make a list soon, as my ideas are kindof dis-organized and tied into one another... (that's my disability in action for ya)
Post Merge: April 08, 2013, 03:04:00 PM
This looks incredibly interesting. Definitely be keeping my eye on this (even though I have for a while now, just didn't say anything).
This will be a great asset to the hacking community.
Keep up the good work Tcll. You got this.
well thanx
though I'm really hoping for some feedback on features to fill this thing with (it'll help me design the GUI and organize the operations better)
I can at least understand some of C++ now, though Blender24 is still too complex for me >_<
Post Merge: April 08, 2013, 06:14:33 PM well... forget everything I've said about the removed controls in dev4... I wasn't expecting this much change... :/
to shorten the release date by alot, instead of worrying about the viewer and everything... the main part of UMC isn't it's viewer... it's it's console.
so I'll release the console converter as a pre-release, and then work on developing it's viewer, and it's GUI from there.
UMC as a console converter WILL be fully compatable with the dev5 script format, meaning you can work with materials, textures, and the new PT buffer.
however, you will be limited to single-file imports for both models and animations.
if the file is an archive for models or animations, it will handle all of them as the same file... ("batch" conversion via the scripts)
for the console commands: Ctrl+I/E - import/export Model(s) Ctrl+Alt+I/E - import/export Animation(s)
the reason you won't be able to I/O multiple files is because of script conflicts.
although I've just now thought of a way to work with re-initializing the scripts for each file, so I just may allow opening multiple files...
once I finish the viewer, all you'll need to do is DL and copy it to the data directory
UMC's viewer will work w/o it's GUI as well
|
|
« Last Edit: April 08, 2013, 06:41:28 PM by DarkPika »
|
Logged
|
|
|
|
|
|
|
« Reply #44 on: April 11, 2013, 10:02:04 AM » |
|
Will this model converter work for the game Beyond Good & Evil?
|
|
|
Logged
|
E-scope [PICTURE REMOVED. Reason: All signature pics must fit a 695x200 frame.] [/url]
|
|
|
|
|