Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - CKlosters

Pages: [1]
1
Plugin Development Forum / Re: WM PDK 2.3 Build Status on Device
« on: February 01, 2013, 01:56:40 AM »
Thanks Remnant,

that was exactly the answer I was looking for. Almost there porting all our plugins to 2.3.
Have to say it was easier than expected. Most name changes make sense and I'm glad you decided to use smart pointers.

Cheers Coen

2
Plugin Development Forum / WM PDK 2.3 Build Status on Device
« on: January 31, 2013, 10:20:17 AM »
There used to be a pstate member variable on the device to check what render state was being used by WM
I can't find it anymore in the 2.3 PDK. Can I still access that, or has it been replaced with a get function?

I used it to check if an export node was valid for rendering something to disk based on a build (in the Activate function).
In Preview mode, the export was skipped. Otherwise it would continue to the output function.

Is there any replacement for that?

Or is there a better way to render something to disk based on a normal build? The default file export seems to do it (save the file every time the world machine is being build).

Hope someone can help!

Coen

3
Is there someone that can help me out with this problem?
Managed to get the node export both RGB images and height maps (regular and tiled) but am unable to get the preview right.

The activate call looks like this:
Code: [Select]
bool GFileOut::Activate(BuildContext &context)
{
HField *output = NULL;

output = HF(RetrieveData(0, context));
if (!output)
return false;

OutputSet output_set(output);
if (context.pstate != P_PREVIEW && GEX_EXPORT_NODE)
{
GFileOut::EXPORT_STATUS = true;
doOutput(output_set, OUTPUT_NORMAL);
}

// Store our output content
if (output_set.num() > 0)
StoreOutputContents(output_set, output, context.pstate);

return true;
};

I assume the isExporting call has nothing to do with the preview?

Any help would be appreciated!

4
Hi!

I'm building a new export operator that can write out either tiled or single images.
All works fine except the preview.

I'm calling:
Code: [Select]
StoreOutputContents(output_set, output, P_PREVIEW); at the end of my activate function.
This works well the the moment the node is connected for the first time,
but after I change one of my parameters on the node itself and press OK, the node status turns red.
It doesn't enter the activate code block at that point. By changing any of the settings on nodes that lead up to the export, the status turns yellow (which is okay).
Also, by changing any of the parameters on the node, the data temporarely cooks. It's only when I press OK, that my node 'errors' (turns red)
Is there any reason for this behaviour or am I doing something wrong?


5
Plugin Development Forum / Re: Updating Parameter Flags
« on: November 21, 2011, 07:26:54 AM »
Thanks!

6
Plugin Development Forum / Re: Updating Parameter Flags
« on: November 18, 2011, 05:33:20 AM »
I implemented the AddDepence Method in the constructor after adding the parameters.
It seems to work, but only for the depending parameter slider and value.

The actual parameter name doesn't change color (grey to black, black to grey)

Is this expected behaviour?

Code: [Select]
// Add parameter dependencies
params.AddDependence("Edge Blend", "Blend Edges", VALUE_EQUAL, VAL(true));
params.AddDependence("Edge Power", "Blend Edges", VALUE_EQUAL, VAL(true));
params.AddDependence("Min Height","Map Incoming Values",VALUE_EQUAL,VAL(true));
params.AddDependence("Max Height","Map Incoming Values",VALUE_EQUAL,VAL(true));

7
Plugin Development Forum / Re: Updating Parameter Flags
« on: November 17, 2011, 04:07:20 PM »
That's exactly what I needed to know!
In the long run, having access to more comlex parameter sets would be beneficial as well.

Thanks  :D

8
Plugin Development Forum / Re: Updating Parameter Flags
« on: November 15, 2011, 04:33:37 AM »
mm, this seems to work when closing the parameter dialog and opening it again.
How can I refresh (or force a rebuild) of the parameter dialog?

9
Plugin Development Forum / Updating Parameter Flags
« on: November 15, 2011, 03:31:52 AM »
Hi!

I'm trying to change parameter flags based on a user action.
For example: if the user toggles "Visualize" on or off, I want a parameter to be read only or editable based on the state of Visualize (true or false).

I can set flags, but can't find methods to remove them (in the Parameter object). Is there a simple way to accomplish this?
Currenlty in the activate function i do?:

Code: [Select]

bool blend_edges = BlendEdges;

// Try to blank out
if (!blend_edges)
params.GetParam(BlendStart)->setFlag(PARM_FLAG_READONLY);
else
????


10
Plugin Development Forum / Re: text input field parameter
« on: November 07, 2011, 03:25:03 AM »
Thanks for clarifying that Remnant.
I'll have to start looking into building a resource manager, as we'll need one later on anyway.

Cheers Coen


11
Plugin Development Forum / Re: text input field parameter
« on: November 02, 2011, 07:30:39 AM »
Thanks, that did it for me  :D
I couldn't figure it out through the example files.

Another question (related to the previous one, or causing the previous one)
I noticed that when switching between views (for example from device to lay-out) the objects get destructed and constructed again.
When dealing with data that needs to be imported (and kept around, for example images) this becomes quite heavy. The actual processing times are low compared to loading the image in memory every time.

I tried creating a singleton class holding the image but this results in only one image to be loaded at all times (shared across the generators). The other option would be to create some sort of file manager but that looks (to me) as overkill. How would you approach handling data that needs to be associated with an object (generator for example) and kept around?

Is there any method or functionality in world machine that supports this?

Thanks in advance!

Cheers Coen

12
Plugin Development Forum / text input field parameter
« on: October 26, 2011, 03:27:01 AM »
Hi,

How can I add and set the context of a simple text field parameter?
I can create int/float/bool parameters and enumerators but can't seem to find a simple method for creating a simple text input field which I can set.

Similar to the file input > file details parm.

Any help would be appreciated, regards, Coen

13
Just figured out it's better to use Mutex...  sorry about that!


14
Hi,

What would be the best way to force a process to run single threaded (not sharing or accessing resources).
I'm currently working with the ANN library and need to lock some functionality on one thread.

I have tried incorporating critical sections but as soon as it enters the critical sections world machine crashes.
Any suggestions? Would there maybe be a WM function set availble that would let me access or lock threads?

Any help would be greatly appreciated!







15
Plugin Development Forum / Re: World To Height Map Coordinates
« on: September 20, 2011, 01:28:07 PM »
Great news :)
I'll keep an eye on the forum

16
Plugin Development Forum / Re: World To Height Map Coordinates
« on: September 20, 2011, 04:39:28 AM »
On  a quick side note, would it be possible to get the PDK compiled and working for Visual Studio 2010?
That would really help us out over here (Guerrilla), as we write all of our other code in vs2010 (+perforce integration)

17
Plugin Development Forum / Re: World To Height Map Coordinates
« on: September 20, 2011, 02:25:35 AM »
Got my test to work! Your feedback was exactly what I was looking for.
Here's the bit of code that uses a specific list of world space coordinates to create height data, bound by the user specified range...

Thanks again for al the help! No on to some more interesting looking things ;)

Code: [Select]
bool Scatter::Activate(BuildContext &context) {

// Create a new heightfield using current specified world size
// Make sure to set it's contents to a value of 0.0
HField *map = GetNewHF(context.GetWorldSize());
map->Clear();

// get the current origin
CoordF origin = getOrigin();

// get our parameters
float scale = Scale;
float area = Area;
int seed = Seed;
int generator_amount = Amount;

// Create a Random Coordinate array
// Array is constructed out of world space coordinates
// Amount of entries is controlled through the amount parameter
vector<CoordF> generators;
srand(seed);
for (int i=0; i<generator_amount; i++)
{
// This is where we create a world space coordinate based on a random value fit within the range, Specified by the user
// The result is added on to the generators stack
float xcor = (rand() % int(area*100.0f)/100.0f)-(area/2.0f)+(origin.x);
float ycor = (rand() % int(area*100.0f)/100.0f)-(area/2.0f)+(origin.y);

CoordF rint = CoordF(xcor,ycor);
generators.push_back(rint);
}

// Create our height map bound information
Rect4 bounds;
bounds.x0 = 0;
bounds.y0 = 0;
bounds.x1 = map->w()-1;
bounds.y1 = map->h()-1;

// Increment Our Seed
srand(seed+1);

// iterate over all our coordinates in the array
// make sure the values are within range to output!
// add random value if within height map tile
for(vector<CoordF>::iterator i = generators.begin(); i!=generators.end(); ++i)
{
CoordF local_loc = TransformCoord_WorldToHF(context,*i);
if (Intersect_Point_Rect4(Coord(int(local_loc.x),int(local_loc.y)), bounds))
{
(*map)[Coord(int(local_loc.x),int(local_loc.y))] = (float(rand() % 100)/100.0f) * scale;
}
}

// Handoff to output(s)
StoreData(map,0, context); // pass the heightfield to our output stage.
// Success!
return true;
}

18
Plugin Development Forum / Re: World To Height Map Coordinates
« on: September 19, 2011, 02:28:10 PM »
Thanks for the quick reply Remnant, that did shed some light on my problems!

Your second code snippet looks exactly like the thing I was looking for and I'll put it to the test tomorrow morning asap..
I read and managed to compile your (well written) examples and already wrote a handy intersection filter (iterating over all the values as mentioned).
Was just a bit unsure how world machine managed the layout view (using various threads) and didn't want to iterate over all the pixels when just creating some "arbitrary" data in some predefined space using world coordinates.  The notion of having acces to the exact ws position together with the actual render context (area) is something I have to get used to

Again, thanks for the clarification. I assume there will be more questions but this should help me get further!

Cheers Coen

19
Plugin Development Forum / Re: World To Height Map Coordinates
« on: September 19, 2011, 10:53:28 AM »
Thought I'd break the problem down a bit to get a better understanding of what's going on.

When iterating over all the height map data I can check if something is within my defined tile.
But what I'd like to do is set a value based on a list of coordinates (as given above).
But in that case I need to know what the min and max world space coordinates are of the area I'm trying to render.
Only then I can assume it is safe to access a certain height map value within that range.

For example: I might have a world space coordinate with a value of 0.5 @ (2.2,1.0).
Transforming this into a height map coordinate yields a result but I need to test if that result is availble within the area I'm trying to render.
Is that possible? Otherwise I have to iterate over all the current height map values in order to test if that value is defined in the array.

Hopefully this makes more sense?.....

20
Plugin Development Forum / World To Height Map Coordinates
« on: September 19, 2011, 06:58:53 AM »
Hello,

I'm trying to wrap my head around the various spaces being active or available in WM.
Creating generic filters or iterating over all coordinates fetching their corresponding world space coordinates works fine.
I'm having issues setting world space coordinates to a finite size. (retrieving hf coordinates)

I'm currently generating an array holding coordinates of size x.
Transforming this to local space coordinates works fine in preview or 2d/3d mode.
But when changing to layout mode  I get memory allocation errors.

I'm currently dividing the  TransformCoord_WorldToHF coordinates by 128, somehow my values matched the height maps values. I know this is wrong but how can
I get absolute world space coordinates relative to the height map being rendered? Is this possible?

Here's the snippet of code i'm working with

Thanks for any help.


Code: [Select]
// Create a Random Coordinate array
// Array is constructed out of world space coordinates
int generator_amount = AMOUNT;
vector<CoordF> generators;
srand(time(NULL));
for (int i=0; i<generator_amount; i++)
{
CoordF rint = CoordF(float(rand() % 129), float(rand() % 129));
generators.push_back(rint);
}

// Try and figure out local space coordinates and assign random value
for (int i=0; i<generators.size(); i++)
{
// convert to local space
CoordF local_loc = TransformCoord_WorldToHF(context, generators[i]);
Coord  flocal = Coord(int(local_loc.x/128.0f),int(local_loc.y/128.0f));
(*map)[flocal] = 1/float(rand() % 100);
}

Pages: [1]