It's a 3D ray tracing program, and I'm having trouble making an addition to the SceneObject list before beginning the render.
I have my Mainwindow, which in it has a Scene class, which then contains the SceneObject list. In a different window I allow the user to add spheres to this list via a button click event.
In my event I try to do this:
private void addASphere(object sender, RoutedEventArgs e)
{
#Some calculation to define sphere
MainWindow.scene.AddObject(sphere);
}
The error from this is 'MainWindow.scene is inaccessible due to it's protection level'. I have no idea where to go with this, I've tried making Scene public, and static (which didn't work out). Any help would be massively appreciated.
If it's of any use, the MainWindow and Scene are set up like this:
public partial class MainWindow : Window
{
Scene scene;
#All the Mainwindow code here
}
class Scene
{
public void AddObject(SceneObjects newObject)
{
if (newObject != null)
{ Objects.Add(newObject); }
}
#All the Scene code here
}