English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 03 August 2017, 19:26   #21
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,546
thanks alkis, i saw this, but is this enough?
one thing mandatory, they want a SPACE between each of the settings.

i have to test the plugin again, *brb*

#1) it doesnt work. Blinker plugin is different plugin type,
it saves its properties in the object file, and this does work.
even just removing the c++ part from load/save.

other plugins save to the scene file and here i get only the plugin tag
with a empty line - which should hold the parameters.

once started the plugin, the load function should read from that scene file,
result it some big random numbers, in the plugin option panel.

i do some more tests.

Last edited by emufan; 03 August 2017 at 19:55.
emufan is offline  
Old 03 August 2017, 19:50   #22
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 47
Posts: 456
It's not mandatory.
They are saving strings with spaces in between. My proposal saves (and loads) raw structure data. If blinkc.c works, I can't see how this technique won't work here.
alkis is online now  
Old 03 August 2017, 20:11   #23
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,546
Quote:
Originally Posted by alkis View Post
It's not mandatory.
They are saving strings with spaces in between. My proposal saves (and loads) raw structure data. If blinkc.c works, I can't see how this technique won't work here.
thats what i ask myself.

in one plugin the author fixed a space in the "save" function - it didnt work before,
i so i got that "info" from

#1) in lwran.h there is a LWIO_SCENE and LWIO_OBJECT mode.
and i found a support file for the layout load/save operations.
header file is at the end of the c file.

they deal with LWIO_ modes

LWIO_OBJECT mode: (*lState->read) (lState->readData, (char *) &len, 1);
LWIO_SCENE mode: (*lState->read) (lState->readData, str, maxStr);

#2) btw. i've uploaded the Lightwave SDK 5.6 to the ftp, it comes with html docs.
it lists compatibility of funtions for version 4.0 and 5.0.
much more info compared to the tiny standard sdk.

Last edited by emufan; 04 August 2017 at 03:26.
emufan is offline  
Old 03 August 2017, 21:20   #24
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 47
Posts: 456
don't throw several new things at once. One thing at a time. Does load/save now work?
alkis is online now  
Old 03 August 2017, 21:32   #25
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,546
Quote:
Originally Posted by alkis View Post
don't throw several new things at once. One thing at a time. Does load/save now work?
i cannot say for sure.

just to explain a bit:
there are differnt types of plugins, for example: Surface shader, Image Shader

blinker is a Surface shader - it's settings will be saved with the object file, you apply the plugin to.
it manipulates some surface settings.

VidLines - is a Image shader, it draws some tv look-alike lines on the image,
in the very last step of a rendering.
the Image Shader settings will be stored in the scene file.

#1) just tested the fader plugin ( based on Blinker ) is surface plugin,
this one does store and read ( save/load) the settings from the manipulated object.

so your load/save routine does work with object files.

so maybe it is somehow different if the plugin has to save the setings in the scene file.

#2) if there is a difference, then we would see it in the original c++ source code.
there seems nothing to hint on the IOMODE ( object vs scene)

in lwran.h - also in the old 5.0 version,
LWLoadState/ LWSaveState structs lists a ioMODE member.

not sure if it is of any importance.

#3) take a look at lod.c - this plugin does write settings to scene files.
and it does some IOMODE magic with sprintf .

LOD Level Of Detail -> uses different objects dependent of the distance to the camera eye.

in the scene file it look like this:
Code:
Plugin ObjReplacementHandler 1 LOD
 3
objects/lod/saguaro_h.lwo
0
objects/lod/saguaro_m.lwo
150
objects/lod/saguaro_l.lwo
300
EndPlugin
this of course differs from other plugins.

Last edited by emufan; 04 August 2017 at 03:27.
emufan is offline  
Old 04 August 2017, 00:26   #26
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 47
Posts: 456
Give this a shot.
Attached Files
File Type: zip vidline.zip (17.9 KB, 24 views)
alkis is online now  
Old 04 August 2017, 00:48   #27
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,546
Quote:
Originally Posted by alkis View Post
Give this a shot.
you are a magican
Code:
Plugin ImageFilterHandler 1 T42_Vidlines
 10
 3
 6
 0.100000
 0.050000
EndPlugin
did save and load of the scene, values are preserved. very cool

now i can fix the other plugins. thanks alot


#1) just looking at the code, looks universal.
you added pluginio.c - this is cool.
new load/save function looks easy enough to replicate

#2) how do i #define WORD?
found it, definition in .h file, have to move the #define block on top of src file.
lesson learned

#3) you've added readDouble and and writeDouble, nice one

#4) first one is fixed:
Code:
Plugin ImageFilterHandler 1 T42_ImageProc
 7.000000
 0
 10.000000
 3.000000
 2.000000
 4.000000
 2.000000
 7.000000
 3.000000
 9.000000
 2.000000
EndPlugin


#5) fixed now 4 plugins, all do work, saving their settings to the scene file.
this is really a great achievement. there are still some plugins in WIP state.
but this will be solved for sure too.

thanks alot for your help, alkis

Last edited by emufan; 04 August 2017 at 03:27.
emufan is offline  
Old 04 August 2017, 04:18   #28
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,546
another WIP plugin, while linking says this:
Code:
SAS/C Amiga Compiler 6.58
Copyright (c) 1988-1995 SAS Institute Inc.
Slink - Version 6.58
Copyright (c) 1988-1995 SAS Institute, Inc.  All Rights Reserved.

Error 502: _malloc symbol - Distance for Reloc16 > 32768

  First Reference in Unit vhud.c at offset 00000098 in file 'vhud.o'
  To Unit malloc.o at offset 0000e558 in file 'LIB:sc.lib'

*** SMAKE: Error return from child process ***
there are 2x malloc in the src file (150kb)
Code:
line: 356:        lw = malloc(sizeof(struct IFPLUGIN_TAG));
....
line: 3279:         udata = malloc(sizeof(struct callback_TAG));
...
something is going to be too big? any idea?

#1) in the sasc manual, is a solution:
Code:
Compile the file with -code=far, or
            declare the function with the __far keyword.
not sure how to do that, but i'll have a look.

#2) in SCOPTIONS file, add: CODE=FAR

Last edited by emufan; 04 August 2017 at 04:52.
emufan is offline  
Old 04 August 2017, 18:41   #29
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,546
another attempt with goo plugin. initially the original c++ src was fixed,
but the resulting SASC binary does not work at all - hence the conversion to c

i converted allmost all like seen in the other successfull builds.
with goo, there is a include file, with c++ class, constructors.
this differs from other class defintions - i cannot convert it to c.

attached, original cc, c src which builds, but missing functions,
and the c scr with partially included stuff from lwglobals.hh

alkis?

Last edited by emufan; 05 August 2017 at 15:24.
emufan is offline  
Old 04 August 2017, 19:00   #30
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 47
Posts: 456
Quote:
Originally Posted by emufan View Post
#2) in SCOPTIONS file, add: CODE=FAR
Put that in smakefile (for that plugin) so you won't need to worry about the scoptions file.
alkis is online now  
Old 04 August 2017, 19:08   #31
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,546
Quote:
Originally Posted by alkis View Post
Put that in smakefile (for that plugin) so you won't need to worry about the scoptions file.
allright
Code:
CFLAGS  = cpu=68020 math=68881 opt nostkchk idir=$(UINC) CODE=FAR
emufan is offline  
Old 04 August 2017, 21:19   #32
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 47
Posts: 456
Any chance this works?
Attached Files
File Type: zip gooc.zip (6.5 KB, 22 views)
alkis is online now  
Old 04 August 2017, 21:41   #33
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,546
Quote:
Originally Posted by alkis View Post
Any chance this works?
almost

Melt mode does melting the obhect. when it starts ( frame 5) it starts with skrinking the object by 50%, next it does the melting.
with OOZE mode nothing happens.

i try the peecee version, to get a clue what it should do.
*argh* only sgi binary of the plugin :/

#1) looking at the source and your changes. i guess i now understand what to do in such case.
thanks, another lesson learned

#2) i found somthing:
Code:
//Flags function
XCALL_(unsigned int) flags(LWInstance)
{
        return LWDMF_WORLD;
////return NULL;
}
i reverted the return value, so now it does a good melt
one initial value seems wrong, lastg value in the gui, is 0.0078, but working value is 1.
in the scene file the last value is 0, i have to look at the value in the src.

--> it is float fObjBounds , it is always handled as float,
but whatever is saved in the scene file (save fucntion),
when opening the gui, it allways says: 0.0078
rather strange.

#3) in the save function, there was/is an "ends as last entry,
this one is nowhere defined in the source,
so i skiped it in my save conversion:
Code:
XCALL_(LWError) save(LWInstance inst, const LWSaveState *lwss)
{
        GOO *defInst = (GOO *)(inst);
                writeInt(lwss, defInst->uStartMelt);
                writeInt(lwss, defInst->uMaxTime);
                writeFloat(lwss, defInst->fObjBounds);
                writeFloat(lwss, defInst->fGroundPlane);
                writeFloat(lwss, defInst->fFlatWidth);
                writeInt(lwss, defInst->tTypeGoo);


        // ostr << defInst->uStartMelt << SPACE << defInst->uMaxTime;
        // ostr << SPACE << defInst->fObjBounds;
        // ostr << SPACE << defInst->fGroundPlane << SPACE << defInst->fFlatWidth << SPACE;
        // ostr << defInst->tTypeGoo << ends;
can we skip "ends" ? it shouldnt matter, since load does not read a value with name "ends",
but i dunno exactly.

Last edited by emufan; 05 August 2017 at 14:55.
emufan is offline  
Old 04 August 2017, 22:27   #34
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 47
Posts: 456
Hmm, try changing line 326 from double val; to float val;

Ok, I realised I reformated the code and I might have changed the lines...here is the code

Code:
float readFloat(const LWLoadState       *lState)
{
	if (lState->ioMode == LWIO_OBJECT) {
		float            val;
		(*lState->read) (lState->readData, (char *) &val, 4);
		BSWAP_L(val);
		return val;
	} else {
		char             buf[50];
		float           val;
		(*lState->read) (lState->readData, buf, 50);
		sscanf (buf, "%f", &val);
		return (float) val;
	}
}
change is marked red.
alkis is online now  
Old 05 August 2017, 01:15   #35
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,546
Quote:
Originally Posted by alkis View Post
change is marked red.
this did the trick.
maybe we should write a bug report to newtek, for their pluginio.c code

while melt does work ok, there is not a single pixel moving in Ooze mode.

#1) i've managed to build the win32 version with MSVC6 and
cl.exe using original c++ src code, just changing:
Code:
//	istrstream istr(cInBuf, 64);
	std::istringstream istr(cInBuf, 64);
//	ostrstream ostr(cOutBuf, 64);
	std::ostringstream ostr(cOutBuf, 64);
it does work the same way, as the amiga version.
melt does work well, while ooze does nothing,
maybe it needs some experimenting with the values.

so for now i'd say, goo is done.

thanks again alkis

ps: is HiSOFT C++ 4.0 any good?

Last edited by emufan; 05 August 2017 at 03:07.
emufan is offline  
Old 05 August 2017, 12:29   #36
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 47
Posts: 456
well, if you look at the source code in evaluate you'll see that ooze doesn't have any real work to be done. it's just two ifs and no frame-dependent code. So, I don't think the original author wanted it to do anything more.

Never tried HiSOFT C++ 4.0. I've heard it's a sort of customised gcc and the impressions of it all arround are mixed.
alkis is online now  
Old 05 August 2017, 14:31   #37
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,546
that was a good pointer. from the lines in the src, it does manipulate values
dependent on position of the object to the groundplane.
so now when moving an object below the ground plane, it does
animate the oozing/melting.
melt does work with a static, non moving objects. while ooze will handle animated objects.

#1) ok, i skip hisoft.
c++ to c conversion is more fun anyway and it does work very well
Attached Images
 

Last edited by emufan; 05 August 2017 at 16:32.
emufan is offline  
Old 05 September 2017, 21:02   #38
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,546
some small issue with a cpp source and sas/c:

"abs undeclared" - i exchanged all "abs with "fabs", which was used in another cpp source.
is this an issue - is there another solution?
emufan is offline  
Old 05 September 2017, 21:09   #39
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 47
Posts: 456
abs is for integers, fabs is for floats.
abs is/should-be prototyped in <stdlib.h>
fabs is/should-be prototyped in <math.h>

check the type of the argument and use the apropiate one.
alkis is online now  
Old 05 September 2017, 21:12   #40
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,546
Quote:
Originally Posted by alkis View Post
abs is for integers, fabs is for floats.
abs is/should-be prototyped in <stdlib.h>
fabs is/should-be prototyped in <math.h>

check the type of the argument and use the apropiate one.
thanks alkis

both are included, only int stuff, for some coordinates:
Code:
    switch (bi->ndigits)
            {
            case 0:
                    l = abs((int)storeit[1]);
                    if (l > 9999) l = 9999;
                    sprintf(buffer,"%.4d",l);
                    break;
            case 1:
                    l = abs((int)storeit[1]);
                    if (l > 99999) l = 99999;
                    sprintf(buffer,"%.6d",l);
                    break;
            default:
                    l = abs((int)storeit[1]);
                    if (l > 99999999) l = 99999999;
                    sprintf(buffer,"%.8d",l);
                    break;
            }
sc:include/math.h only has fabs
sc:include/stdlib.h only defines abs #ifndef _cplusplus

stdlib.h has a labs "long int", should i use this?

#2) the CODE=FAR issue went away, after I disabled the strstream stuff.
it's a lot stuff to replace - so i just disabled the load and save routines, for now

#3) the strsteam stuff i'll replace with the working c alternative, shouldn't matter

Last edited by emufan; 05 September 2017 at 22:13.
emufan is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
"Screech!! v2.41" & "Screech!! [AGA] v2.51" - "HD install" --> "ADFs" DamienD request.Old Rare Games 38 20 September 2018 16:09
"Voices8" 8 Channel Soundtracker "DemoSongI" song - "This is the Amiga with 8 Voices" DemosongIHunter request.Music 40 13 April 2017 06:06
"Reminder "Lincs Amiga User Group aka "LAG" Meet Sat 5th of January 2013" rockape News 4 30 January 2013 01:06
CD32 Image-Name-Bug: "...(bla)[!].zip" -> "...(bla)[" / "...[test].zip" -> "...[tes" cfTrio support.WinUAE 8 18 December 2012 17:31
Problems with "Thespywholovedme", "Flood", "Shinobi" sareks support.Games 12 03 May 2006 15:52

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 23:22.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.09284 seconds with 14 queries