public MuseumStoryLayout(IEmbeddedResources embeddedResources, IWorldTreeService worldTreeService) { this.worldTreeService = worldTreeService; floorModel = embeddedResources.PlaneModel(PlaneModelSourcePlane.Xy, PlaneModelSourceNormalDirection.Positive, globalRadius, globalRadius, 1, 1); ceilingModel = embeddedResources.PlaneModel(PlaneModelSourcePlane.Xy, PlaneModelSourceNormalDirection.Negative, globalRadius, globalRadius, 1, 1); exitWallModel = embeddedResources.PlaneModel(PlaneModelSourcePlane.Xz, PlaneModelSourceNormalDirection.Negative, exitHalfLength, ceilingHalfHeight, 1, 1); corridorWallModel = embeddedResources.PlaneModel(PlaneModelSourcePlane.Xz, PlaneModelSourceNormalDirection.Negative, corridorHalfWidth, ceilingHalfHeight, 1, 1); frustumModel = embeddedResources.SimpleFrustumModel(); floorMaterial = StandardMaterial.New() .SetDiffuseMap(embeddedResources.Image("Textures/museum_floor.jpg")) .SetNoSpecular(true) .FromGlobalCache(); ceilingMaterial = StandardMaterial.New() .SetDiffuseMap(embeddedResources.Image("Textures/museum_ceiling.jpg")) .SetNoSpecular(true) .FromGlobalCache(); wallMaterial = StandardMaterial.New() .SetDiffuseMap(embeddedResources.Image("Textures/museum_wall.jpg")) .SetNoSpecular(true) .FromGlobalCache(); frustumMaterial = StandardMaterial.New() .SetDiffuseColor(Color4.Green) .SetIgnoreLighting(true) .FromGlobalCache(); }
public GlStandardMaterialShader(IStandardMaterial standardMaterial) { this.Material = standardMaterial; var vertexShaderSrc = @" # version 120 varying vec4 vertexPosition; varying vec4 vertexColor; varying vec3 vertexNormal; varying vec2 normalUv; varying vec2 uv; void main() { vertexPosition = gl_ModelViewMatrix * gl_Vertex; gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex; vertexNormal = normalize(gl_ModelViewMatrix * vec4(gl_Normal, 0)).xyz; normalUv = normalize(gl_ProjectionMatrix * gl_ModelViewMatrix * vec4(gl_Normal, 0)).xy; vertexColor = gl_Color; uv = gl_MultiTexCoord0.st; }"; var fragmentShaderSrc = @$ " # version 130 uniform sampler2D diffuseTexture; uniform sampler2D normalTexture; uniform float useLighting; out vec4 fragColor;
public SphereStoryLayout(IEmbeddedResources embeddedResources) { frustumModel = embeddedResources.SimpleFrustumModel(); frustumMaterial = StandardMaterial.New() .SetDiffuseColor(Color4.Green) .SetIgnoreLighting(true) .FromGlobalCache(); }
private void AddNewEdge(UnorderedPair <ISceneNode> key, IStandardMaterial material, IStandardRenderState renderState) { var gizmo = AmFactory.Factory.CreateWorldNodeWithComponent <StoryFlowchartEdgeGizmoComponent>(out var component); gizmo.Name = $"EdgeGizmo({key.First}->{key.Second})"; component.Material = material; component.RenderState = renderState; edgeGizmos.Add(key, gizmo); Node.ChildNodes.Add(gizmo); }
public CommonObjects(IContext glContext, IShaderProgramFactory shaderProgramFactory) { StandardShaderProgram = shaderProgramFactory.CreateDefault(); TransformUb = new UniformBufferSugar <TransformUniform>(glContext); CameraUb = new UniformBufferSugar <Matrix4x4>(glContext); CameraExtraUb = new UniformBufferSugar <Vector3>(glContext); LightUb = new UniformBufferSugar <Vector3>(glContext); MaterialUb = new UniformBufferSugar <MaterialUniform>(glContext); GlobalUb = new UniformBufferSugar <GlobalUniform>(glContext); UndefinedMaterial = CreateUndefinedMaterial(); }
public StandardMaterialData(IStandardMaterial material) { DiffuseColor = material.DiffuseColor; DiffuseMap = material.DiffuseMap; NormalMap = material.NormalMap; Sampler = material.Sampler; IgnoreLighting = material.IgnoreLighting; NoSpecular = material.NoSpecular; HasTransparency = material.HasTransparency; HighlightEffect = material.HighlightEffect; RtTransparencyMode = material.RtTransparencyMode; }
public OrbitStoryLayout(IEmbeddedResources embeddedResources) { frustumModel = embeddedResources.SimpleFrustumModel(); circleModel = embeddedResources.CircleModel(256); frustumMaterial = StandardMaterial.New() .SetDiffuseColor(Color4.Green) .SetIgnoreLighting(true) .FromGlobalCache(); circleMaterial = StandardMaterial.New() .SetDiffuseColor(Color4.Yellow) .SetIgnoreLighting(true) .FromGlobalCache(); }
protected StoryFlowchartEditSceneComponent() { gizmosByNodes = new Dictionary <ISceneNode, ISceneNode>(); edgeGizmos = new Dictionary <UnorderedPair <ISceneNode>, ISceneNode>(); defaultViewpointMechanism = new OrthoDefaultViewpointMechanism(Node, new PlaneOrthoBoundControlledCamera.Props { Distance = 3f, ZFar = 1000f, ZNear = 0.01f }); routeMaterial = StandardMaterial.New() .SetIgnoreLighting(true) .FromGlobalCache(); routeRenderState = StandardRenderState.New() .SetLineWidth(3) .FromGlobalCache(); }
public GlStandardMaterialShaderV2(IStandardMaterial standardMaterial) { this.Material = standardMaterial; var vertexShaderSrc = @" # version 120 in vec3 in_Position; in vec3 in_Normal; in vec2 in_Uvs[4]; varying vec4 vertexPosition; varying vec4 vertexColor; varying vec3 vertexNormal; varying vec2 normalUv; varying vec2 uv; void main() { vertexPosition = gl_ModelViewMatrix * vec4(in_Position, 1); gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vec4(in_Position, 1); vertexNormal = normalize(gl_ModelViewMatrix * vec4(in_Normal, 0)).xyz; normalUv = normalize(gl_ProjectionMatrix * gl_ModelViewMatrix * vec4(in_Normal, 0)).xy; vertexColor = vec4(1); uv = in_Uvs[0]; }"; var fragmentShaderSrc = @$ " # version 130 uniform sampler2D diffuseTexture; uniform sampler2D normalTexture; uniform sampler2D ambientOcclusionTexture; uniform sampler2D emissiveTexture; uniform float useLighting; out vec4 fragColor;
public static ITexture?GetFor(IStandardMaterial material) => material.DiffuseTexture ?? material.AmbientOcclusionTexture;
public BuildingStoryLayout(ICoroutineService coroutineService, IEmbeddedResources embeddedResources, IInputService inputService, Lazy <INavigationService> navigationServiceLazy) { this.embeddedResources = embeddedResources; this.inputService = inputService; this.navigationServiceLazy = navigationServiceLazy; this.coroutineService = coroutineService; planeModel = embeddedResources.SimplePlaneXzModel(); lineModel = embeddedResources.LineModel(); frustumModel = embeddedResources.SimpleFrustumModel(); colorMaterials = new IMaterial[] { StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(1f, 0f, 0f) * 0.8f, 1.0f)).SetIgnoreLighting(true), StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(0f, 1f, 0f) * 0.8f, 1.0f)).SetIgnoreLighting(true), StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(0f, 0f, 1f) * 0.8f, 1.0f)).SetIgnoreLighting(true), StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(1f, 1f, 0f) * 0.8f, 1.0f)).SetIgnoreLighting(true), StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(1f, 0f, 1f) * 0.8f, 1.0f)).SetIgnoreLighting(true), StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(0f, 1f, 1f) * 0.8f, 1.0f)).SetIgnoreLighting(true), }; frustumMaterial = StandardMaterial.New() .SetDiffuseColor(new Color4(0f, 1f, 0f)) .SetIgnoreLighting(true) .FromGlobalCache(); lineMaterial = StandardMaterial.New() .SetDiffuseColor(Color4.White) .SetIgnoreLighting(true) .FromGlobalCache(); currentLineMaterial = StandardMaterial.New() .SetDiffuseColor(Color4.Red) .SetIgnoreLighting(true) .FromGlobalCache(); lineRenderState = StandardRenderState.New().SetLineWidth(3).FromGlobalCache(); var mirrorSampler = new ImageSampler { AddressModeU = ImageSamplerAddressMode.Mirror, AddressModeV = ImageSamplerAddressMode.Mirror, AddressModeW = ImageSamplerAddressMode.Mirror, }.FromGlobalCache(); floorMaterial = StandardMaterial.New() .SetDiffuseMap(embeddedResources.Image("Textures/museum_floor.jpg")) .SetNoSpecular(true) .SetSampler(mirrorSampler) .FromGlobalCache(); ceilingMaterial = StandardMaterial.New() .SetDiffuseMap(embeddedResources.Image("Textures/museum_ceiling.jpg")) .SetNoSpecular(true) .SetSampler(mirrorSampler) .FromGlobalCache(); wallMaterial = StandardMaterial.New() .SetDiffuseMap(embeddedResources.Image("Textures/museum_wall.jpg")) .SetDiffuseColor(new Color4(92, 82, 72)) //.SetNoSpecular(true) .SetNormalMap(embeddedResources.Image("Textures/museum_wall_2_norm.jpg")) .FromGlobalCache(); rawWallMaterial = StandardMaterial.New() .SetDiffuseColor(Color4.Green) .SetIgnoreLighting(true) .FromGlobalCache(); }