static WResourceManager() { m_j3dList = new List <TSharedRef <J3D> >(); m_objList = new List <TSharedRef <SimpleObjRenderer> >(); // We're going to laod the actor descriptors from the json data, and then store them in a // dictionary which is looked up by the Actor Name. This should give us a quick lookup time. m_actorDescriptors = new Dictionary <string, WActorDescriptor>(); string jsonData = File.ReadAllText("resources/ActorDatabase.json"); var lightPos = new Vector4(250, 200, 250, 0); m_mainLight = new GXLight(lightPos, -lightPos.Normalized(), new Vector4(0, 0, 1, 1), new Vector4(1.075f, 0, 0, 0), new Vector4(1.075f, 0, 0, 0)); m_secondaryLight = new GXLight(lightPos, -lightPos.Normalized(), new Vector4(0, 0, 1, 1), new Vector4(1.075f, 0, 0, 0), new Vector4(1.075f, 0, 0, 0)); //m_secondaryLight.Position = new Vector4(CalculateLightPosition((float)Math.PI / 2f), 0); WActorDescriptor[] allDescriptors = JsonConvert.DeserializeObject <WActorDescriptor[]>(jsonData); foreach (var descriptor in allDescriptors) { if (string.IsNullOrEmpty(descriptor.ActorName)) { continue; } m_actorDescriptors[descriptor.ActorName] = descriptor; } }
internal void OnMainEditorWindowLoaded(GLControl child) { m_glControl = child; m_frameBuffer = new WFrameBuffer(m_glControl.Width, m_glControl.Height); m_lineBatcher = new WLineBatcher(); m_alphaVisualizationShader = new Shader("AlphaVisualize"); m_alphaVisualizationShader.CompileSource(File.ReadAllText("resources/shaders/Debug_AlphaVisualizer.vert"), ShaderType.VertexShader); m_alphaVisualizationShader.CompileSource(File.ReadAllText("resources/shaders/Debug_AlphaVisualizer.frag"), ShaderType.FragmentShader); m_alphaVisualizationShader.LinkShader(); m_screenQuad = new ScreenspaceQuad(); // Set up the Editor Tick Loop System.Windows.Forms.Timer editorTickTimer = new System.Windows.Forms.Timer(); editorTickTimer.Interval = 16; //ms editorTickTimer.Tick += (o, args) => { DoApplicationTick(); }; editorTickTimer.Enabled = true; var lightPos = new Vector4(250, 200, 250, 0); m_mainLight = new GXLight(lightPos, -lightPos.Normalized(), new Vector4(1, 0, 1, 1), new Vector4(1.075f, 0, 0, 0), new Vector4(1.075f, 0, 0, 0)); m_secondaryLight = new GXLight(lightPos, -lightPos.Normalized(), new Vector4(0, 0, 1, 1), new Vector4(1.075f, 0, 0, 0), new Vector4(1.075f, 0, 0, 0)); m_secondaryLight.Position = new Vector4(CalculateLightPosition((float)Math.PI / 2f), 0); // Check to see if there's any file on the command line argument now that we've initialized, incase they opened via double clicking on a file. string[] cmdArgs = Environment.GetCommandLineArgs(); for (int i = 1; i < cmdArgs.Length; i++) { LoadAssetFromFilepath(cmdArgs[i], false); } }
public void SetHardwareLight(int index, GXLight light) { if (index < 0 || index >= 8) { throw new ArgumentOutOfRangeException("index", "index must be >= 0 or < 8. Maximum of 8 hardware lights supported!"); } m_hardwareLights[index] = light; // Fill the buffer with data at the chosen binding point GL.BindBufferBase(BufferRangeTarget.UniformBuffer, (int)ShaderUniformBlockIds.LightBlock, m_hardwareLightBuffer); GL.BufferData(BufferTarget.UniformBuffer, (IntPtr)(GXLight.SizeInBytes * 8), m_hardwareLights, BufferUsageHint.DynamicDraw); }