Skip to content

Commit 9a697f2

Browse files
Chau TranChau Tran
Chau Tran
authored and
Chau Tran
committed
docs: migrate color grading
1 parent 5a2ac26 commit 9a697f2

File tree

6 files changed

+82
-2
lines changed

6 files changed

+82
-2
lines changed

apps/sandbox/src/app/pages/clump/index.page.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const routeMeta: RouteMeta = {
1414
};
1515

1616
@Directive({ selector: 'clump-pointer', standalone: true })
17-
class Pointer {
17+
class ClumpPointer {
1818
readonly pointerBody = injectSphere(() => ({ type: 'Kinematic', args: [3], position: [0, 0, 0] }));
1919

2020
constructor() {
@@ -67,7 +67,7 @@ class ObjectClump {
6767
@Component({
6868
standalone: true,
6969
templateUrl: 'scene.html',
70-
imports: [NgtArgs, NgtcPhysics, NgtsEnvironment, NgtsSky, NgtpEffectComposer, NgtpBloom, ObjectClump, Pointer],
70+
imports: [NgtArgs, NgtcPhysics, NgtsEnvironment, NgtsSky, NgtpEffectComposer, NgtpBloom, ObjectClump, ClumpPointer],
7171
schemas: [CUSTOM_ELEMENTS_SCHEMA],
7272
})
7373
class SceneGraph {}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<ngtp-effect-composer>
2+
<ngtp-lut *ngIf="texture() as texture" [lut]="texture" />
3+
</ngtp-effect-composer>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<ngt-mesh>
2+
<ngt-sphere-geometry *args="[1, 64, 64]" />
3+
<ngt-mesh-physical-material
4+
*ngIf="texture() as texture"
5+
[map]="texture"
6+
[envMapIntensity]="0.4"
7+
[clearcoat]="0.8"
8+
[clearcoatRoughness]="0"
9+
[roughness]="1"
10+
[metalness]="0"
11+
/>
12+
</ngt-mesh>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<ngt-canvas [sceneGraph]="scene" frameloop="demand" [camera]="{ position: [0, 0, 5], fov: 45 }" />
2+
<ngts-stats [right]="true" />
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { RouteMeta } from '@analogjs/router';
2+
import { NgIf } from '@angular/common';
3+
import { Component, CUSTOM_ELEMENTS_SCHEMA, Signal } from '@angular/core';
4+
import { injectNgtLoader, NgtArgs, NgtCanvas } from 'angular-three';
5+
import { NgtpEffectComposer } from 'angular-three-postprocessing';
6+
import { NgtpLUT } from 'angular-three-postprocessing/effects';
7+
import { NgtsOrbitControls } from 'angular-three-soba/controls';
8+
import { injectNgtsTextureLoader } from 'angular-three-soba/loaders';
9+
import { NgtsStats } from 'angular-three-soba/performance';
10+
import { NgtsEnvironment } from 'angular-three-soba/staging';
11+
import { LookupTexture, LUTCubeLoader } from 'postprocessing';
12+
13+
export const routeMeta: RouteMeta = {
14+
title: 'Color Grading',
15+
};
16+
17+
@Component({
18+
selector: 'grading-sphere',
19+
standalone: true,
20+
templateUrl: 'grading-sphere.html',
21+
imports: [NgtArgs, NgIf],
22+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
23+
})
24+
class GradingSphere {
25+
readonly texture = injectNgtsTextureLoader(() => 'terrazo.png');
26+
}
27+
28+
@Component({
29+
selector: 'grading-effect',
30+
standalone: true,
31+
templateUrl: 'grading-effect.html',
32+
imports: [NgtpLUT, NgtpEffectComposer, NgIf],
33+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
34+
})
35+
class GradingEffect {
36+
readonly texture = injectNgtLoader(
37+
() => LUTCubeLoader as any,
38+
() => 'cubicle-99.CUBE'
39+
) as Signal<LookupTexture>;
40+
}
41+
42+
@Component({
43+
standalone: true,
44+
templateUrl: 'scene.html',
45+
imports: [GradingSphere, GradingEffect, NgtsEnvironment, NgtsOrbitControls],
46+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
47+
})
48+
class SceneGraph {}
49+
50+
@Component({
51+
standalone: true,
52+
templateUrl: 'index.html',
53+
imports: [NgtCanvas, NgtsStats],
54+
host: { class: 'block h-full w-full bg-gradient-to-br from-indigo-300 to-sky-700' },
55+
})
56+
export default class ColorGrading {
57+
readonly scene = SceneGraph;
58+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ngt-spot-light [intensity]="0.5" [angle]="0.2" [penumbra]="1" [position]="[5, 15, 10]" />
2+
<grading-sphere />
3+
<grading-effect />
4+
<ngts-environment preset="warehouse" />
5+
<ngts-orbit-controls />

0 commit comments

Comments
 (0)