فهرست منبع

added ignoreLight param for mesh geo

Alexander Rose 5 سال پیش
والد
کامیت
6fbe7efcab

+ 3 - 0
src/mol-geo/geometry/mesh/mesh.ts

@@ -361,6 +361,7 @@ export namespace Mesh {
         doubleSided: PD.Boolean(false),
         flipSided: PD.Boolean(false),
         flatShaded: PD.Boolean(false),
+        ignoreLight: PD.Boolean(false),
     }
     export type Params = typeof Params
 
@@ -410,6 +411,7 @@ export namespace Mesh {
             dDoubleSided: ValueCell.create(props.doubleSided),
             dFlatShaded: ValueCell.create(props.flatShaded),
             dFlipSided: ValueCell.create(props.flipSided),
+            dIgnoreLight: ValueCell.create(props.ignoreLight),
         }
     }
 
@@ -424,6 +426,7 @@ export namespace Mesh {
         ValueCell.updateIfChanged(values.dDoubleSided, props.doubleSided)
         ValueCell.updateIfChanged(values.dFlatShaded, props.flatShaded)
         ValueCell.updateIfChanged(values.dFlipSided, props.flipSided)
+        ValueCell.updateIfChanged(values.dIgnoreLight, props.ignoreLight)
     }
 
     function updateBoundingSphere(values: MeshValues, mesh: Mesh) {

+ 1 - 0
src/mol-gl/renderable/mesh.ts

@@ -19,6 +19,7 @@ export const MeshSchema = {
     dFlatShaded: DefineSpec('boolean'),
     dDoubleSided: DefineSpec('boolean'),
     dFlipSided: DefineSpec('boolean'),
+    dIgnoreLight: DefineSpec('boolean'),
 }
 export type MeshSchema = typeof MeshSchema
 export type MeshValues = Values<MeshSchema>

+ 6 - 2
src/mol-gl/shader/mesh.frag.ts

@@ -24,8 +24,12 @@ void main() {
     #elif defined(dColorType_depth)
         gl_FragColor = material;
     #else
-        #include assign_normal
-        #include apply_light_color
+        #ifdef dIgnoreLight
+            gl_FragColor = material;
+        #else
+            #include assign_normal
+            #include apply_light_color
+        #endif
         #include apply_marker_color
         #include apply_fog
     #endif

+ 2 - 2
src/mol-gl/shader/mesh.vert.ts

@@ -23,7 +23,7 @@ attribute mat4 aTransform;
 attribute float aInstance;
 attribute float aGroup;
 
-#if !defined(dFlatShaded) || !defined(enabledStandardDerivatives)
+#if !defined(dFlatShaded) || !defined(enabledStandardDerivatives) || defined(dIgnoreLight)
     #ifdef dGeoTexture
         uniform sampler2D tNormal;
     #else
@@ -38,7 +38,7 @@ void main(){
     #include assign_marker_varying
     #include assign_position
 
-    #if !defined(dFlatShaded) || !defined(enabledStandardDerivatives)
+    #if !defined(dFlatShaded) || !defined(enabledStandardDerivatives) || defined(dIgnoreLight)
         #ifdef dGeoTexture
             vec3 normal = readFromTexture(tNormal, aGroup, uGeoTexDim).xyz;
         #else

+ 1 - 0
src/mol-repr/shape/loci/angle.ts

@@ -53,6 +53,7 @@ type ArcParams = typeof ArcParams
 const SectorParams = {
     ...Mesh.Params,
     ...SharedParams,
+    ignoreLight: PD.Boolean(true),
     sectorOpacity: PD.Numeric(0.75, { min: 0, max: 1, step: 0.01 }),
 }
 type SectorParams = typeof SectorParams

+ 1 - 0
src/mol-repr/shape/loci/dihedral.ts

@@ -58,6 +58,7 @@ type ArcParams = typeof ArcParams
 const SectorParams = {
     ...Mesh.Params,
     ...SharedParams,
+    ignoreLight: PD.Boolean(true),
     sectorOpacity: PD.Numeric(0.75, { min: 0, max: 1, step: 0.01 }),
 }
 type SectorParams = typeof SectorParams