@@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, Component, CUSTOM_ELEMENTS_SCHEMA, input } fro
22import { Meta } from '@storybook/angular' ;
33import { NgtArgs } from 'angular-three' ;
44import { NgtsHTML , NgtsHTMLContentOptions , NgtsHTMLOptions } from 'angular-three-soba/misc' ;
5+ import { NgtsDetailed } from 'angular-three-soba/performances' ;
56import { ColorRepresentation } from 'three' ;
67import { storyDecorators , storyFunction , storyObject , Turnable } from '../setup-canvas' ;
78
@@ -78,12 +79,57 @@ class HtmlTransformScene {
7879 htmlContentOptions = input ( { } as NgtsHTMLContentOptions ) ;
7980}
8081
82+ @Component ( {
83+ selector : 'html-lod-scene' ,
84+ template : `
85+ <ngts-detailed [distances]="[0, 8, 18]">
86+ <ngt-mesh>
87+ <ngt-icosahedron-geometry *args="[2, 4]" />
88+ <ngt-mesh-basic-material color="hotpink" wireframe />
89+
90+ <ngts-html [options]="{ position: [2.5, 0, 0] }">
91+ <div [htmlContent]="{ center: true }" style="color: white; background: rgba(0,0,0,0.5); padding: 4px 8px; white-space: nowrap;">
92+ High Detail
93+ </div>
94+ </ngts-html>
95+ </ngt-mesh>
96+
97+ <ngt-mesh>
98+ <ngt-icosahedron-geometry *args="[2, 2]" />
99+ <ngt-mesh-basic-material color="orange" wireframe />
100+
101+ <ngts-html [options]="{ position: [2.5, 0, 0] }">
102+ <div [htmlContent]="{ center: true }" style="color: white; background: rgba(0,0,0,0.5); padding: 4px 8px; white-space: nowrap;">
103+ Medium Detail
104+ </div>
105+ </ngts-html>
106+ </ngt-mesh>
107+
108+ <ngt-mesh>
109+ <ngt-icosahedron-geometry *args="[2, 1]" />
110+ <ngt-mesh-basic-material color="skyblue" wireframe />
111+
112+ <ngts-html [options]="{ position: [2.5, 0, 0] }">
113+ <div [htmlContent]="{ center: true }" style="color: white; background: rgba(0,0,0,0.5); padding: 4px 8px; white-space: nowrap;">
114+ Low Detail
115+ </div>
116+ </ngts-html>
117+ </ngt-mesh>
118+ </ngts-detailed>
119+ ` ,
120+ schemas : [ CUSTOM_ELEMENTS_SCHEMA ] ,
121+ changeDetection : ChangeDetectionStrategy . OnPush ,
122+ imports : [ NgtArgs , NgtsHTML , NgtsDetailed ] ,
123+ } )
124+ class HtmlWithLODScene { }
125+
81126export default {
82127 title : 'Misc/HTML' ,
83128 decorators : storyDecorators ( ) ,
84129} as Meta ;
85130
86131export const Default = storyFunction ( HtmlScene , { camera : { position : [ - 20 , 20 , - 20 ] } } ) ;
132+ export const WithLOD = storyFunction ( HtmlWithLODScene , { camera : { position : [ 0 , 0 , 10 ] } } ) ;
87133export const Transform = storyObject ( HtmlTransformScene , {
88134 camera : { position : [ - 20 , 20 , - 20 ] } ,
89135 argsOptions : {
0 commit comments