Jump to content

Diffuse/Specular Reflection


Recommended Posts

http://forums.getpaint.net/index.php?showtopic=9480

You may or may not remember this topic for my plug-ins to simulate diffuse and specular reflections on a heightmap. Well, I lost the source to these files somehow in the ether of my hard drive, so I'm recoding them. This time, it has a few different options than before.

Anyways, I rebuilt them in CodeLab (like I had before), and they work flawlessly when run from CodeLab. Then when I try to save the scripts as .dlls, there's a build error apparently with syntax...even though it actually runs correctly inside of CodeLab.

Also, I tried rewriting the scripts, because maybe there was some kind of unrecognizable character that may have found it's way inside my script...apparently you can type it on the keyboard in the UI editor without knowing you did, because that's happened to me twice now. ._.

All that happened with that script is it's pretty much the default script...There are a few differences, and some of them work, because the .dll built successfully with them in place. Anyways, they are that I abbreviated "selection" to "sel", "PrimaryColor" to "PC", and "SecondaryColor" to "SC"; I deleted the comments, excluding the ones that are needed at the top for the UI; I deleted the center pixel lines; and I deleted the brush width line. I also have 12 UI controls as well.

I cannot seem to figure out the problem, except for the possibility that you can't have 12 or more controls. Here's the minimally changed default script:

#region UICode
double Amount1 = -90; // [-720,720] Light Direction
double Amount2 = 1; // [-180,180] Light Pitch
double Amount3 = 1; // [-65536,65536] Scale
int Amount4 = 4; // [0,4] Red Byte Position
int Amount5 = 0; // [0,4] Green Byte Position
int Amount6 = 0; // [0,4] Blue Byte Position
int Amount7 = 0; // [0,4] Alpha Byte Position
bool Amount8 = false; // [0,1] Nudge Left
bool Amount9 = false; // [0,1] Nudge Up
bool Amount10 = false; // [0,1] Use Primary/Secondary Colors
bool Amount11 = false; // [0,1] Swap Primary/Secondary Colors
bool Amount12 = false; // [0,1] "Visible" Shadows
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{
   Rectangle sel = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
   ColorBgra PC = (ColorBgra)EnvironmentParameters.PrimaryColor;
   ColorBgra SC = (ColorBgra)EnvironmentParameters.SecondaryColor;

   ColorBgra CP;
   for (int y = rect.Top; y < rect.Bottom; y++)
   {
       for (int x = rect.Left; x < rect.Right; x++)
       {
           CP = src[x,y];
           dst[x,y] = CP;
       }
   }
}

I'm also uploading the two scripts that I was working that both have issues.

Broken Scripts.zip

Wii Friend Codes (PM me with yours if you use mine): Super Smash Bros. Brawl: 0087-3452-9356 Mario Kart Wii: 2234-8268-1808 Guitar Hero World Tour: 403891994256

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...