Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
Signed-off-by: German Zargaryan <2526045+germanz@users.noreply.github.com>
  • Loading branch information
germanz committed May 25, 2021
2 parents 74bf1b0 + 3640547 commit 4ba6d58
Show file tree
Hide file tree
Showing 84 changed files with 3,450 additions and 1,026 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,12 @@ jobs:
run: yarn run pre-test
shell: bash
- name: Test Coverage
run: yarn cov-test --forbid-only --timeout ${{ env.nodeTestTimeout }}
shell: bash
if: matrix.os != 'windows-latest'
- name: Generate coverage report
run: |
yarn cov-report-html
run: yarn test-cov
shell: bash
if: matrix.os != 'windows-latest'
- name: Publish Coverage (Linux)
run: |
bash <(curl -s https://codecov.io/bash) -f coverage/*.json
bash <(curl -s https://codecov.io/bash) -f coverage/**/*.info
shell: bash
if: matrix.os == 'ubuntu-latest'
- name: Save Coverage Report (Linux)
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/deploy_to_npm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ jobs:
- name: Test
run: |
yarn pre-test
yarn cov-test --forbid-only
yarn build-tests
yarn test-cov
yarn karma-headless
yarn karma-headless-firefox
./scripts/test-npm-packages.sh
Expand Down
65 changes: 61 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
stages:
- initial-status
- build
- trigger
- final-status

default:
interruptible: true
image: node
tags:
- docker-prod

workflow:
rules:
- if: $CI_EXTERNAL_PULL_REQUEST_IID
- if: $CI_PIPELINE_SOURCE == "pipeline"

trigger_internal_ci:
stage: build
image: node
tags:
- docker-prod
variables:
DOWNSTREAM_PROJECT_ID: $DOWNSTREAM_PROJECT_ID
DOWNSTREAM_PROJECT_NAME: $DOWNSTREAM_PROJECT_NAME
script:
- |
set -e
echo $CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME
echo $CI_EXTERNAL_PULL_REQUEST_IID
if [ -z "$CI_EXTERNAL_PULL_REQUEST_IID" ]
then
echo "CI_EXTERNAL_PULL_REQUEST_IID is empty since CI is trigger from sdk"
export CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME=$CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME
export CI_EXTERNAL_PULL_REQUEST_IID=$EXT_PULL_REQUEST_IID
fi
export TRIGGER_BRANCH=$CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME
#Creating a new branch
curl --request POST --header \
"PRIVATE-TOKEN: $SVC_HLS_RENDER_API" \
Expand All @@ -32,6 +42,53 @@ trigger_internal_ci:
paths:
- generated-config.yml

pending-update-github-pipline-status:
stage: initial-status
script:
- echo $LATEST_GITHUB_COMMIT
- |
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/heremaps/harp.gl/statuses/$LATEST_GITHUB_COMMIT \
-d '{"state":"pending","context":"Internal_CI", "target_url":"'$CI_PIPELINE_URL'"}'
rules:
- if: $CI_PIPELINE_SOURCE == "pipeline"
when: always
- when: never

success-update-github-pipline-status:
stage: final-status
script:
- echo $LATEST_GITHUB_COMMIT
- |
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/heremaps/harp.gl/statuses/$LATEST_GITHUB_COMMIT \
-d '{"state":"success","context":"Internal_CI","target_url":"'$CI_PIPELINE_URL'"}'
rules:
- if: $CI_PIPELINE_SOURCE == "pipeline"
when: on_success
- when: never

failure-update-github-pipline-status:
stage: final-status
script:
- echo $LATEST_GITHUB_COMMIT
- |
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/heremaps/harp.gl/statuses/$LATEST_GITHUB_COMMIT \
-d '{"state":"failure","context":"Internal_CI","target_url":"'$CI_PIPELINE_URL'"}'
rules:
- if: $CI_PIPELINE_SOURCE == "pipeline"
when: on_failure
- when: never

bridge_for_bridge:
stage: trigger
Expand Down
3 changes: 0 additions & 3 deletions @here/create-harp.gl-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
"files": [
"src/index.js"
],
"scripts": {
"test": "mocha $EXTRA_MOCHA_ARGS ./test/*.js"
},
"repository": {
"type": "git",
"url": "https://github.com/heremaps/harp.gl.git",
Expand Down
12 changes: 0 additions & 12 deletions @here/create-harp.gl-app/test/test.js

This file was deleted.

15 changes: 15 additions & 0 deletions @here/harp-datasource-protocol/lib/StyleSetEvaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ export class StyleSetEvaluator {
private m_zoomLevel: number | undefined;
private m_previousResult: IndexedTechnique[] | undefined;
private m_previousEnv: Env | undefined;
private m_nextArrayBufferId = 0;

constructor(private readonly m_options: StyleSetOptions) {
this.m_definitions = this.m_options.definitions;
Expand Down Expand Up @@ -737,6 +738,20 @@ export class StyleSetEvaluator {
.map(([_attrName, attrValue]) => {
if (attrValue === undefined) {
return "U";
} else if (typeof attrValue === "object") {
return JSON.stringify(attrValue, (_, value) => {
if (value instanceof ArrayBuffer) {
// ArrayBuffers cannot be directly stringified. They can be converted
// to typed arrays and then stringified, but it's too slow. Instead,
// assign them unique ids.
let arrayBufferId = (value as any).id;
if (arrayBufferId === undefined) {
arrayBufferId = (value as any).id = this.m_nextArrayBufferId++;
}
return arrayBufferId;
}
return value;
});
} else {
return JSON.stringify(attrValue);
}
Expand Down
15 changes: 12 additions & 3 deletions @here/harp-datasource-protocol/lib/TechniqueDescriptors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ const fillTechniqueDescriptor = mergeTechniqueDescriptor<FillTechnique>(
color: { scope: AttrScope.TechniqueRendering, automatic: true },
opacity: { scope: AttrScope.TechniqueRendering, automatic: true },
transparent: { scope: AttrScope.TechniqueRendering, automatic: true },
lineWidth: AttrScope.TechniqueRendering
lineWidth: AttrScope.TechniqueRendering,
map: { scope: AttrScope.TechniqueRendering, automatic: true }
}
}
);
Expand All @@ -244,7 +245,7 @@ const standardTechniqueDescriptor = mergeTechniqueDescriptor<StandardTechnique>(
baseTechniqueParamsDescriptor,
{
attrDescriptors: {
color: AttrScope.FeatureGeometry,
color: { scope: AttrScope.TechniqueRendering, automatic: true },
vertexColors: { scope: AttrScope.TechniqueRendering, automatic: true },
wireframe: { scope: AttrScope.TechniqueRendering, automatic: true },
roughness: { scope: AttrScope.TechniqueRendering, automatic: true },
Expand All @@ -256,7 +257,15 @@ const standardTechniqueDescriptor = mergeTechniqueDescriptor<StandardTechnique>(
emissive: { scope: AttrScope.TechniqueRendering, automatic: true },
emissiveIntensity: { scope: AttrScope.TechniqueRendering, automatic: true },
refractionRatio: { scope: AttrScope.TechniqueRendering, automatic: true },
normalMapType: { scope: AttrScope.TechniqueRendering, automatic: true }
normalMapType: { scope: AttrScope.TechniqueRendering, automatic: true },
map: { scope: AttrScope.TechniqueRendering, automatic: true },
normalMap: { scope: AttrScope.TechniqueRendering, automatic: true },
displacementMap: { scope: AttrScope.TechniqueRendering, automatic: true },
roughnessMap: { scope: AttrScope.TechniqueRendering, automatic: true },
emissiveMap: { scope: AttrScope.TechniqueRendering, automatic: true },
bumpMap: { scope: AttrScope.TechniqueRendering, automatic: true },
metalnessMap: { scope: AttrScope.TechniqueRendering, automatic: true },
alphaMap: { scope: AttrScope.TechniqueRendering, automatic: true }
}
}
);
Expand Down
48 changes: 31 additions & 17 deletions @here/harp-datasource-protocol/lib/TechniqueParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,58 +404,58 @@ export interface StandardTechniqueParams extends BaseTechniqueParams {
* URL or texture buffer that should be used as color map. See:
* https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.map
*/
map?: string | TextureBuffer;
mapProperties?: TextureProperties;
map?: DynamicProperty<string | TextureBuffer>;
mapProperties?: DynamicProperty<TextureProperties>;

/**
* URL or texture buffer that should be used as normal map. See:
* https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.normalMap
*/
normalMap?: string | TextureBuffer;
normalMapType?: number;
normalMapProperties?: TextureProperties;
normalMap?: DynamicProperty<string | TextureBuffer>;
normalMapType?: DynamicProperty<number>;
normalMapProperties?: DynamicProperty<TextureProperties>;

/**
* URL or texture buffer that should be used as displacement map. See:
* https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.displacementMap
*/
displacementMap?: string | TextureBuffer;
displacementMapProperties?: TextureProperties;
displacementMap?: DynamicProperty<string | TextureBuffer>;
displacementMapProperties?: DynamicProperty<TextureProperties>;

/**
* URL or texture buffer that should be used as roughness map. See:
* https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.roughnessMap
*/
roughnessMap?: string | TextureBuffer;
roughnessMapProperties?: TextureProperties;
roughnessMap?: DynamicProperty<string | TextureBuffer>;
roughnessMapProperties?: DynamicProperty<TextureProperties>;

/**
* URL or texture buffer that should be used as emissive map. See:
* https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.emissiveMap
*/
emissiveMap?: string | TextureBuffer;
emissiveMapProperties?: TextureProperties;
emissiveMap?: DynamicProperty<string | TextureBuffer>;
emissiveMapProperties?: DynamicProperty<TextureProperties>;

/**
* URL or texture buffer that should be used as bump map. See:
* https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.bumpMap
*/
bumpMap?: string | TextureBuffer;
bumpMapProperties?: TextureProperties;
bumpMap?: DynamicProperty<string | TextureBuffer>;
bumpMapProperties?: DynamicProperty<TextureProperties>;

/**
* URL or texture buffer that should be used as metalness map. See:
* https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.metalnessMap
*/
metalnessMap?: string | TextureBuffer;
metalnessMapProperties?: TextureProperties;
metalnessMap?: DynamicProperty<string | TextureBuffer>;
metalnessMapProperties?: DynamicProperty<TextureProperties>;

/**
* URL or texture buffer that should be used as alpha map. See:
* https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.alphaMap
*/
alphaMap?: string | TextureBuffer;
alphaMapProperties?: TextureProperties;
alphaMap?: DynamicProperty<string | TextureBuffer>;
alphaMapProperties?: DynamicProperty<TextureProperties>;
}

/**
Expand Down Expand Up @@ -1199,6 +1199,20 @@ export interface FillTechniqueParams extends BaseTechniqueParams, PolygonalTechn
* Width of the lines. Currently limited to the [0, 1] range.
*/
lineWidth?: DynamicProperty<number>;

/*
* URL or texture buffer that should be used as color map. See:
* https://threejs.org/docs/#api/en/materials/MeshBasicMaterial.map
*/
map?: DynamicProperty<string | TextureBuffer>;
mapProperties?: DynamicProperty<TextureProperties>;

/**
* Whether and how texture coordinates should be generated. No texture coordinates are
* generated if `undefined`.
* Should be set if a `map` is assigned.
*/
textureCoordinateType?: TextureCoordinateType;
}

/**
Expand Down
28 changes: 17 additions & 11 deletions @here/harp-datasource-protocol/lib/Techniques.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,21 +429,27 @@ export function needsVertexNormals(technique: Technique): boolean {
);
}

/**
* Type guard to check if an object is an instance of a technique with textures.
*/
export function supportsTextures(
technique: Technique
): technique is FillTechnique | StandardTechnique | ExtrudedPolygonTechnique | TerrainTechnique {
return (
isFillTechnique(technique) ||
isStandardTechnique(technique) ||
isExtrudedPolygonTechnique(technique) ||
isTerrainTechnique(technique)
);
}

/**
* Get the texture coordinate type if the technique supports it.
*/
export function textureCoordinateType(technique: Technique): TextureCoordinateType | undefined {
if (isStandardTechnique(technique)) {
return technique.textureCoordinateType;
} else if (isExtrudedPolygonTechnique(technique)) {
return technique.textureCoordinateType;
} else if (isTerrainTechnique(technique)) {
return technique.textureCoordinateType;
} else if (isShaderTechnique(technique)) {
return technique.textureCoordinateType;
} else {
return undefined;
}
return supportsTextures(technique) || isShaderTechnique(technique)
? technique.textureCoordinateType
: undefined;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions @here/harp-datasource-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@
"@here/harp-test-utils": "^0.24.0",
"@types/chai": "^4.2.14",
"@types/mocha": "^8.2.0",
"@types/three": "^0.126.0",
"@types/three": "^0.127.0",
"chai": "^4.0.2",
"cross-env": "^7.0.2",
"mocha": "^8.2.1",
"source-map-support": "^0.5.19",
"three": "^0.126.0",
"three": "^0.127.0",
"ts-json-schema-generator": "^0.68.1",
"typescript": "^4.1.2"
},
"peerDependencies": {
"three": "^0.126.0"
"three": "^0.127.0"
},
"publishConfig": {
"access": "public"
Expand Down
Loading

0 comments on commit 4ba6d58

Please sign in to comment.