static MscClient() { DefaultResourceLocator.AddManifestResourceLoader(ManifestResourceLoader.GetResourceLoader(typeof(ClientResourceLocator).Assembly, "theori.Resources")); DefaultResourceLocator.AddManifestResourceLoader(ManifestResourceLoader.GetResourceLoader(typeof(MscClient).Assembly, "Museclone.Resources")); ScriptService.RegisterType <Highway>(); }
protected void InitializeShader(out ShaderProgram shaderProgram) { var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoSimplePointSpriteElement.vert"); string fragmentShaderSource = string.Empty; switch (this.fragShaderType) { case FragShaderType.Simple: fragmentShaderSource = ManifestResourceLoader.LoadTextFile( @"DemoSimplePointSpriteElement_Simple.frag"); break; case FragShaderType.Analytic: fragmentShaderSource = ManifestResourceLoader.LoadTextFile( @"DemoSimplePointSpriteElement_Analytic.frag"); break; default: throw new NotImplementedException(); } shaderProgram = new ShaderProgram(); shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null); shaderProgram.AssertValid(); }
/// <summary> /// Create a text renderer. /// </summary> /// <param name="maxCharCount">Max char count to display for this label. Careful to set this value because greater <paramref name="maxCharCount"/> means more space ocupied in GPU nemory.</param> /// <param name="labelHeight">Label height(in pixels)</param> /// <param name="fontTexture">Use which font to render text?</param> /// <returns></returns> public static TextRenderer Create(int maxCharCount = 64, int labelHeight = 32, IFontTexture fontTexture = null) { if (fontTexture == null) { fontTexture = FontTexture.Default; } // FontResource.Default; } var shaderCodes = new ShaderCode[2]; shaderCodes[0] = new ShaderCode(ManifestResourceLoader.LoadTextFile( @"Resources.TextModel.vert"), ShaderType.VertexShader); shaderCodes[1] = new ShaderCode(ManifestResourceLoader.LoadTextFile( @"Resources.TextModel.frag"), ShaderType.FragmentShader); var provider = new ShaderCodeArray(shaderCodes); var map = new AttributeMap(); map.Add("position", TextModel.strPosition); map.Add("uv", TextModel.strUV); var model = new TextModel(maxCharCount); var renderer = new TextRenderer(model, provider, map); renderer.fontTexture = fontTexture; return(renderer); }
/// <summary> /// Create a label renderer. /// </summary> /// <param name="maxCharCount">Max char count to display for this label. Careful to set this value because greater <paramref name="maxCharCount"/> means more space ocupied in GPU nemory.</param> /// <param name="labelHeight">Label height(in pixels)</param> /// <param name="fontTexture">Use which font to render text?</param> /// <returns></returns> public static LabelRenderer Create(int maxCharCount = 64, int labelHeight = 32, IFontTexture fontTexture = null) { if (fontTexture == null) { fontTexture = FontTexture.Default; } var model = new TextModel(maxCharCount); var shaderCodes = new ShaderCode[2]; shaderCodes[0] = new ShaderCode(ManifestResourceLoader.LoadTextFile( @"Resources\Label.vert"), ShaderType.VertexShader); shaderCodes[1] = new ShaderCode(ManifestResourceLoader.LoadTextFile( @"Resources\Label.frag"), ShaderType.FragmentShader); var provider = new ShaderCodeArray(shaderCodes); var map = new AttributeMap(); map.Add("in_Position", TextModel.strPosition); map.Add("in_UV", TextModel.strUV); var blendState = new BlendState(BlendingSourceFactor.SourceAlpha, BlendingDestinationFactor.One); var renderer = new LabelRenderer(model, provider, map, blendState); renderer.blendState = blendState; renderer.fontTexture = fontTexture; renderer.LabelHeight = labelHeight; return(renderer); }
/// <summary> /// Gets shader's source code for color coded picking. /// </summary> /// <param name="shaderType"></param> /// <returns></returns> public static string GetShaderSource(ShaderTypes shaderType) { string result = string.Empty; switch (shaderType) { case ShaderTypes.VertexShader: if (vertexShader == null) { vertexShader = ManifestResourceLoader.LoadTextFile(@"PickingShader.vert"); } result = vertexShader; break; case ShaderTypes.FragmentShader: if (fragmentShader == null) { fragmentShader = ManifestResourceLoader.LoadTextFile(@"PickingShader.frag"); } result = fragmentShader; break; default: throw new NotImplementedException(); } return(result); }
public static CodeShader LoadShaderSourceCode(string shaderName, CodeShader.GLSLShaderType shaderType) { CodeShader result = null; switch (shaderType) { case CodeShader.GLSLShaderType.VertexShader: result = new CodeShader(ManifestResourceLoader.LoadTextFile(string.Format( "{0}.{0}.vert", shaderName)), CodeShader.GLSLShaderType.VertexShader); break; case CodeShader.GLSLShaderType.GeometryShader: result = new CodeShader(ManifestResourceLoader.LoadTextFile(string.Format( "{0}.{0}.geom", shaderName)), CodeShader.GLSLShaderType.GeometryShader); break; case CodeShader.GLSLShaderType.FragmentShader: result = new CodeShader(ManifestResourceLoader.LoadTextFile(string.Format( "{0}.{0}.frag", shaderName)), CodeShader.GLSLShaderType.FragmentShader); break; default: break; } return(result); }
private void InitializeOpenGL(OpenGL gl, int width, int height) { // Set a blue clear colour. this.gl = gl; gl.ClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.PolygonMode(SharpGL.Enumerations.FaceMode.Front, SharpGL.Enumerations.PolygonMode.Lines); gl.Enable(OpenGL.GL_CULL_FACE); gl.CullFace(OpenGL.GL_BACK); // Create the shader program. var vertexShaderSource = ManifestResourceLoader.LoadTextFile("OpenGLRenderer\\Shaders\\VertexShader - Copy.glsl"); var fragmentShaderSource = ManifestResourceLoader.LoadTextFile("OpenGLRenderer\\Shaders\\FragmentShader - Copy.glsl"); //for(int i = 0; i<100; i++) { shaderProgram = new ShaderProgram(); //var shaderTime = _stopwatch.ElapsedMilliseconds; shaderProgram.Create(gl, vertexShaderSource, fragmentShaderSource, null); //File.AppendAllText("shader" + ".txt", (_stopwatch.ElapsedMilliseconds - shaderTime).ToString() + "\n"); //} shaderProgram.BindAttributeLocation(gl, attributeIndexPosition, "in_Position"); shaderProgram.BindAttributeLocation(gl, attributeIndexColour, "in_Color"); shaderProgram.BindAttributeLocation(gl, attributeIndexNormal, "in_Normal"); shaderProgram.AssertValid(gl); // Now create the geometry for the square. _poStructs = new List <poStruct>(); foreach (var po in _primordialObject) { _poStructs.Add(new poStruct { _vertexBufferArray = CreateVertexBufferArray(gl, po), _primordialObject = po }); } }
/// <summary> /// /// </summary> /// <param name="anchor"></param> /// <param name="margin"></param> /// <param name="size"></param> /// <param name="zNear"></param> /// <param name="zFar"></param> /// <param name="fontTexture"></param> /// <param name="maxCharCount"></param> public UIText( System.Windows.Forms.AnchorStyles anchor, System.Windows.Forms.Padding margin, System.Drawing.Size size, int zNear, int zFar, IFontTexture fontTexture = null, int maxCharCount = 100) : base(anchor, margin, size, zNear, zFar) { if (fontTexture == null) { this.fontTexture = FontTexture.Default; } // FontResource.Default; } else { this.fontTexture = fontTexture; } var shaderCodes = new ShaderCode[2]; shaderCodes[0] = new ShaderCode(ManifestResourceLoader.LoadTextFile( @"Resources.TextModel.vert"), ShaderType.VertexShader); shaderCodes[1] = new ShaderCode(ManifestResourceLoader.LoadTextFile( @"Resources.TextModel.frag"), ShaderType.FragmentShader); var map = new AttributeMap(); map.Add("position", TextModel.strPosition); map.Add("uv", TextModel.strUV); var model = new TextModel(maxCharCount); var renderer = new Renderer(model, shaderCodes, map); this.textModel = model; this.Renderer = renderer; }
private ShaderProgram InitShader(OpenGL gl, RenderMode renderMode) { String vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"Grids.HexahedronGrid.vert"); String fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"Grids.HexahedronGrid.frag"); ShaderProgram shaderProgram = new ShaderProgram(); shaderProgram.Create(gl, vertexShaderSource, fragmentShaderSource, null); //shaderProgram.BindAttributeLocation(gl, ATTRIB_INDEX_POSITION, in_position); //shaderProgram.BindAttributeLocation(gl, ATTRIB_INDEX_COLOUR, in_uv); { int location = shaderProgram.GetAttributeLocation(gl, in_Position); if (location < 0) { throw new ArgumentException(); } this.ATTRIB_INDEX_POSITION = (uint)location; } { int location = shaderProgram.GetAttributeLocation(gl, in_uv); if (location < 0) { throw new ArgumentException(); } this.ATTRIB_INDEX_UV = (uint)location; } shaderProgram.AssertValid(gl); return(shaderProgram); }
protected void InitializeShader(out ShaderProgram shaderProgram) { var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"DoubleTexture.vert"); var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"DoubleTexture.frag"); shaderProgram = new ShaderProgram(); shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null); }
protected void InitializeShader(out ShaderProgram shaderProgram) { var vertexShaderSource = ManifestResourceLoader.LoadTextFile("DiffuseReflectionPointLight.vert"); var fragmentShaderSource = ManifestResourceLoader.LoadTextFile("DiffuseReflectionPointLight.frag"); shaderProgram = new ShaderProgram(); shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null); }
static ClientSkinService() { DefaultSkin = new ClientResourceLocator("skins/user-custom", "materials/basic"); DefaultSkin.AddManifestResourceLoader(ManifestResourceLoader.GetResourceLoader(typeof(ClientResourceLocator).Assembly, "theori.Resources")); DefaultSkin.AddManifestResourceLoader(ManifestResourceLoader.GetResourceLoader(typeof(NscClient).Assembly, "NeuroSonic.Resources")); CurrentlySelectedSkin = DefaultSkin; }
void InitializeShader(out ShaderProgram shaderProgram) { var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoVolumeRendering02.vert"); var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoVolumeRendering02.frag"); shaderProgram = new ShaderProgram(); shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null); }
protected void InitializeShader(out ShaderProgram shaderProgram) { var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"SceneElements.AxisElement2.vert"); var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"SceneElements.AxisElement2.frag"); shaderProgram = new ShaderProgram(); shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null); }
protected void InitializeShader(out ShaderProgram shaderProgram) { var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"Renderers.Polkadot3d.vert"); var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"Renderers.Polkadot3d.frag"); shaderProgram = new ShaderProgram(); shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null); }
protected void InitializeShader(out ShaderProgram shaderProgram) { var vertexShaderSource = ManifestResourceLoader.LoadTextFile("DemoText.vert"); var fragmentShaderSource = ManifestResourceLoader.LoadTextFile("DemoText.frag"); var geometryShaderSource = ManifestResourceLoader.LoadTextFile("DemoText.geom"); shaderProgram = new ShaderProgram(); shaderProgram.Create(vertexShaderSource, fragmentShaderSource, geometryShaderSource); }
public static PropertyNameMap LoadPropertyNameMap(string shaderName) { string content = ManifestResourceLoader.LoadTextFile(string.Format( "{0}.{0}.PropertyNameMap.xml", shaderName)); PropertyNameMap result = PropertyNameMap.Parse(XElement.Parse(content)); return(result); }
protected void InitializeShader(OpenGL gl, out ShaderProgram shaderProgram) { var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"TexturedCube.vert"); var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"TexturedCube.frag"); shaderProgram = new ShaderProgram(); shaderProgram.Create(gl, vertexShaderSource, fragmentShaderSource, null); shaderProgram.AssertValid(gl); }
protected void InitializeShader(out ShaderProgram shaderProgram) { var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoTexImage2D.vert"); var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoTexImage2D.frag"); shaderProgram = new ShaderProgram(); shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null); shaderProgram.AssertValid(); }
private void InitShaderProgram() { var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"WholeFontTextureElement.vert"); var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"WholeFontTextureElement.frag"); var shaderProgram = new ShaderProgram(); shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null); this.shaderProgram = shaderProgram; }
protected ShaderProgram InitializeShader() { var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"UIs.SimpleUICube.vert"); var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"UIs.SimpleUICube.frag"); shaderProgram = new ShaderProgram(); shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null); return(shaderProgram); }
protected ShaderProgram InitializeShader() { var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoHexahedron2Element.vert"); var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoHexahedron2Element.frag"); var shaderProgram = new ShaderProgram(); shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null); return(shaderProgram); }
/// <summary> /// Create and add a new ShaderProgram from the given sources. /// Call this function if you decide to add your own shaders. /// </summary> /// <param name="gl">The OpenGL</param> /// <param name="vertexShaderSource">The path to the vertex shader code.</param> /// <param name="fragmentShaderSource">The path to the fragment shader code.</param> /// <param name="shaderName">The name for the shader.</param> public static ExtShaderProgram CreateShader(OpenGL gl, IShaderParameterIds parameters, string vertexShaderSource, string fragmentShaderSource) { // Create the per pixel shader. ShaderProgram shader = new ShaderProgram(); shader.Create(gl, ManifestResourceLoader.LoadTextFile(vertexShaderSource), ManifestResourceLoader.LoadTextFile(fragmentShaderSource), _attributeLocations); return(new ExtShaderProgram(shader, parameters)); }
private void InitShaderProgram() { var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"SceneElements.FontElement.vert"); var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"SceneElements.FontElement.frag"); var shaderProgram = new ShaderProgram(); shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null); shaderProgram.AssertValid(); this.shaderProgram = shaderProgram; }
private void InitShaderProgram() { // Create the shader program. var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"PointSpriteStringElement.vert"); var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"PointSpriteStringElement.frag"); var shaderProgram = new ShaderProgram(); shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null); this.attributeIndexPosition = shaderProgram.GetAttributeLocation("in_Position"); shaderProgram.AssertValid(); this.shaderProgram = shaderProgram; }
private FontResource() { this.FontBitmap = ManifestResourceLoader.LoadBitmap("LucidaTypewriterRegular.ttf.png"); string xmlContent = ManifestResourceLoader.LoadTextFile("LucidaTypewriterRegular.ttf.xml"); XElement xElement = XElement.Parse(xmlContent, LoadOptions.None); this.FontHeight = int.Parse(xElement.Attribute(strFontHeight).Value); this.FirstChar = (char)int.Parse(xElement.Attribute(strFirstChar).Value); this.LastChar = (char)int.Parse(xElement.Attribute(strLastChar).Value); this.CharInfoDict = CharacterInfoDictHelper.Parse( xElement.Element(CharacterInfoDictHelper.strCharacterInfoDict)); }
protected ShaderProgram InitializeShader() { var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoColorCodedPickingElement.vert"); var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoColorCodedPickingElement.frag"); var shaderProgram = new ShaderProgram(); shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null); shaderProgram.AssertValid(); return(shaderProgram); }
protected ShaderProgram InitializeShader() { var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"UIs.SimpleUIColorIndicatorBar.vert"); var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"UIs.SimpleUIColorIndicatorBar.frag"); shaderProgram = new ShaderProgram(); shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null); in_PositionLocation = shaderProgram.GetAttributeLocation(strin_Position); in_ColorLocation = shaderProgram.GetAttributeLocation(strin_Color); return(shaderProgram); }
//static readonly object synObj = new object(); public static ShaderProgram GetPickingShaderProgram() { var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"ColorCodedPicking.PickingShader.vert"); string fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"ColorCodedPicking.PickingShader.frag"); var shaderProgram = new ShaderProgram(); shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null); shaderProgram.AssertValid(); return(shaderProgram); }
protected ShaderProgram InitializeShader() { var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoHexahedron1Element.vert"); var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoHexahedron1Element.frag"); var shaderProgram = new ShaderProgram(); shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null); this.in_PositionLocation = shaderProgram.GetAttributeLocation(strin_Position); this.in_ColorLocation = shaderProgram.GetAttributeLocation(strin_Color); this.renderWireframeLocation = shaderProgram.GetUniformLocation("renderWirframe"); return(shaderProgram); }