graphics/material

  Source   Edit

Types

EsPrecision = enum
  EsPrecisionNone, EsPrecisionLow, EsPrecisionMedium, EsPrecisionHigh
  Source   Edit
Material = ref object
  engine* {.cursor.}: MyouEngine
  name*: string
  textures*: OrderedTable[string, Texture]
  ubos*: seq[UBO]
  varyings*: seq[Varying]
  vertex*: string
  fragment*: string
  double_sided*: bool
  fixed_z*: Option[float]
  point_size*: Option[float]
  animation_strips*: seq[AnimationStrip]
  glsl_version*: string
  es_precision*: EsPrecision
  defines*: Table[string, string] ## #
  scene* {.cursor.}: Scene
  feedback_varyings*: seq[string]
  Source   Edit
Shader = ref object
  engine* {.cursor.}: MyouEngine
  id*: int
  program*: GPUProgram
  material* {.cursor.}: Material
  ubos*: seq[UBO]
  ubo_indices*: seq[GLuint]
  camera_render_ubo_index*: GLuint
  object_render_ubo_index*: GLuint
  object_ubo_index*: GLuint
  texture_locations*: seq[GLint]
  shadowmap_location*: GLint
  cubemap_locations*: seq[GLint]
  when not false:
      vs_code*, fs_code*: string

  
  Source   Edit
Varying = object
  vtype*: VaryingType
  varname*, attname*, gltype*: string
  multiplier*: float32
  Source   Edit
VaryingType = enum
  Unused, ViewPosition, WorldPosition, ProjPosition, ViewNormal, WorldNormal,
  ObjectNormal, Uv, VertexColor, Tangent, Orco
  Source   Edit

Procs

proc delete_all_shaders(self: Material; destroy: bool = true) {.
    ...raises: [Exception], tags: [RootEffect].}
  Source   Edit
proc destroy(self: Material) {....raises: [Exception], tags: [RootEffect].}
  Source   Edit
proc destroy(self: Shader) {....raises: [], tags: [].}
  Source   Edit
proc get_shader(self: Material; mesh: Mesh): Shader {....raises: [Exception],
    tags: [RootEffect].}
  Source   Edit
proc initShader(self: Shader; engine: MyouEngine; material: Material;
                layout: AttributeList; modifiers: seq[VertexModifier];
                defines: Table[string, string]) {.
    ...raises: [ValueError, Exception, CatchableError, KeyError],
    tags: [RootEffect].}
  Source   Edit
proc newMaterial(engine: MyouEngine; name: string; scene: Scene; vertex = "";
                 fragment = ""; textures = initOrderedTable[string, Texture]();
                 ubos: seq[UBO] = @[]; varyings: seq[Varying] = @[];
                 double_sided = false;
                 glsl_version: string = engine.glsl_version;
                 es_precision = EsPrecisionHigh;
                 defines = initTable[string, string]()): Material {....raises: [],
    tags: [].}
  Source   Edit
proc newSolidMaterial(engine: MyouEngine; name: string; color: Vec4): Material {.
    ...raises: [ValueError], tags: [].}
  Source   Edit
proc newVertexColordMaterial(engine: MyouEngine; name: string): Material {.
    ...raises: [], tags: [].}
  Source   Edit
proc use(self: Shader): GLuint {.inline, discardable, ...raises: [Exception],
                                 tags: [RootEffect].}
  Source   Edit