Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ci #16

Merged
merged 4 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/actions/get-pr-number/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
name: 'get-pr-number'
description: 'Gets the PR number from an artifact'
inputs:
platform-name:
description: "Name of the target platform"
required: true
outputs:
pr-number:
description: "PR number or empty string"
Expand All @@ -13,7 +9,7 @@ runs:
steps:
- uses: ./.github/actions/download-workflow-run-artifact
with:
artifact-name: pr-number-${{ inputs.platform-name }}
artifact-name: pr-number

- run: touch ./pr_number
shell: bash
Expand Down
9 changes: 3 additions & 6 deletions .github/actions/save-pr-number/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
name: 'save-pr-number'
description: 'Saves the current PR number as artifact'
inputs:
platform-name:
description: "Name of the target platform"
required: true
runs:
using: "composite"
steps:
Expand All @@ -16,5 +12,6 @@ runs:
- name: Upload pr_number
uses: actions/upload-artifact@v4
with:
name: pr-number-${{ inputs.platform-name }}
path: ./pr_number
name: pr-number
path: ./pr_number
overwrite: true
2 changes: 0 additions & 2 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ jobs:

- if: github.event_name == 'pull_request'
uses: ./.github/actions/save-pr-number
with:
platform-name: "android"

- name: Build Instrumentation Tests, copy to platform/android
run: |
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/android-device-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ jobs:

- uses: ./.github/actions/get-pr-number
id: get-pr-number
with:
platform-name: "android"

- name: Generate token
id: generate_token
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/ios-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ jobs:
- name: Lint plist files
run: bazel run //platform/ios:lint-plists --//:renderer=metal

# - name: Running iOS tests
# run: bazel test //platform/ios/test:ios_test --test_output=errors --//:renderer=metal
- name: Running iOS tests
run: bazel test //platform/ios/test:ios_test --test_output=errors --//:renderer=metal

# tsan run fails with 'Interceptors are not working. This may be because ThreadSanitizer is loaded too late...'
#- name: Running iOS UI tests (Thread Sanitizer)
Expand Down Expand Up @@ -193,8 +193,6 @@ jobs:

- if: github.event_name == 'pull_request'
uses: ./.github/actions/save-pr-number
with:
platform-name: "ios"

- name: Build DocC documentation
working-directory: .
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/linux-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ jobs:

- if: github.event_name == 'pull_request'
uses: ./.github/actions/save-pr-number
with:
platform-name: "linux-${{ matrix.renderer }}"

linux-coverage:
runs-on: ubuntu-22.04
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/pr-bloaty-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ jobs:

- uses: ./.github/actions/get-pr-number
id: get-pr-number
with:
platform-name: "ios"

- uses: ./.github/actions/download-workflow-run-artifact
with:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/pr-linux-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ jobs:

- uses: ./.github/actions/get-pr-number
id: get-pr-number
with:
platform-name: "linux-vulkan"

- uses: ./.github/actions/download-workflow-run-artifact
with:
Expand Down Expand Up @@ -136,8 +134,6 @@ jobs:

- uses: ./.github/actions/get-pr-number
id: get-pr-number
with:
platform-name: "linux-vulkan"

- uses: ./.github/actions/download-workflow-run-artifact
with:
Expand Down
5 changes: 3 additions & 2 deletions platform/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS", "WARNING_FLAGS")
objc_library(
name = "macos-objcpp",
srcs = [
"//platform/darwin:darwin_gltf_hdrs",
"//platform/darwin:darwin_gltf_srcs",
"//platform/darwin:darwin_objcpp_custom_drawable_srcs",
"//platform/darwin:darwin_objcpp_srcs",
"//platform/darwin:darwin_private_hdrs",
Expand Down Expand Up @@ -36,6 +38,7 @@ objc_library(
"CoreLocation",
"AppKit",
"SystemConfiguration",
"Accelerate",
],
visibility = ["//visibility:public"],
deps = [
Expand All @@ -50,8 +53,6 @@ objc_library(
objc_library(
name = "macos-objc",
srcs = [
"//platform/darwin:darwin_gltf_hdrs",
"//platform/darwin:darwin_gltf_srcs",
"//platform/darwin:darwin_objc_hdrs",
"//platform/darwin:darwin_objc_srcs",
"//platform/darwin:darwin_private_hdrs",
Expand Down
54 changes: 26 additions & 28 deletions platform/darwin/bazel/files.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MLN_GLTF_HEADERS = [
"src/gltf/GLTFModelLayer.h"
"src/gltf/GLTFModelLayer.h",
]

MLN_GLTF_SOURCE = [
Expand All @@ -20,68 +20,66 @@ MLN_GLTF_SOURCE = [
"src/gltf/GLTFModelLayer.h",
"src/gltf/GLTFModelLayer.mm",
"src/gltf/GLTFModelLoader.h",
"src/gltf/GLTFModelLoader.m",
"src/gltf/GLTFModelLoader.mm",
"src/gltf/GLTFMTLRenderItem.h",
"src/gltf/GLTFMTLRenderItem.m",
"src/gltf/GLTFMTLRenderItem.mm",
"src/gltf/GLTFRenderer.hpp",
"src/gltf/GLTFRenderer.cpp",
"src/gltf/MetalRenderer+GLTFAsset.mm",
"src/gltf/gltfkit/GLTFAsset.h",
"src/gltf/gltfkit/GLTFAsset.m",
"src/gltf/gltfkit/GLTFAsset.mm",
"src/gltf/gltfkit/GLTFAccessor.h",
"src/gltf/gltfkit/GLTFAccessor.m",
"src/gltf/gltfkit/GLTFAccessor.mm",
"src/gltf/gltfkit/GLTFAnimation.h",
"src/gltf/gltfkit/GLTFAnimation.m",
"src/gltf/gltfkit/GLTFAnimation.mm",
"src/gltf/gltfkit/GLTFBinaryChunk.h",
"src/gltf/gltfkit/GLTFBinaryChunk.m",
"src/gltf/gltfkit/GLTFBinaryChunk.mm",
"src/gltf/gltfkit/GLTFBuffer.h",
"src/gltf/gltfkit/GLTFBufferAllocator.h",
"src/gltf/gltfkit/GLTFBufferView.h",
"src/gltf/gltfkit/GLTFBufferView.m",
"src/gltf/gltfkit/GLTFBufferView.mm",
"src/gltf/gltfkit/GLTFCamera.h",
"src/gltf/gltfkit/GLTFCamera.m",
"src/gltf/gltfkit/GLTFCamera.mm",
"src/gltf/gltfkit/GLTFDefaultBufferAllocator.h",
"src/gltf/gltfkit/GLTFDefaultBufferAllocator.m",
"src/gltf/gltfkit/GLTFDefaultBufferAllocator.mm",
"src/gltf/gltfkit/GLTFEnums.h",
"src/gltf/gltfkit/GLTFExtensionNames.h",
"src/gltf/gltfkit/GLTFExtensionNames.m",
"src/gltf/gltfkit/GLTFExtensionNames.mm",
"src/gltf/gltfkit/GLTFImage.h",
"src/gltf/gltfkit/GLTFImage.m",
"src/gltf/gltfkit/GLTFImage.mm",
"src/gltf/gltfkit/GLTFKHRLight.h",
"src/gltf/gltfkit/GLTFKHRLight.m",
"src/gltf/gltfkit/GLTFKHRLight.mm",
"src/gltf/gltfkit/GLTFMaterial.h",
"src/gltf/gltfkit/GLTFMaterial.m",
"src/gltf/gltfkit/GLTFMaterial.mm",
"src/gltf/gltfkit/GLTFMesh.h",
"src/gltf/gltfkit/GLTFMesh.m",
"src/gltf/gltfkit/GLTFMesh.mm",
"src/gltf/gltfkit/GLTFMTLBufferAllocator.h",
"src/gltf/gltfkit/GLTFMTLBufferAllocator.m",
"src/gltf/gltfkit/GLTFMTLBufferAllocator.mm",
"src/gltf/gltfkit/GLTFMTLShaderBuilder.h",
"src/gltf/gltfkit/GLTFMTLShaderBuilder.m",
"src/gltf/gltfkit/GLTFMTLShaderBuilder.mm",
"src/gltf/gltfkit/GLTFMTLTextureLoader.h",
"src/gltf/gltfkit/GLTFMTLTextureLoader.m",
"src/gltf/gltfkit/GLTFMTLTextureLoader.mm",
"src/gltf/gltfkit/GLTFMTLUtilities.h",
"src/gltf/gltfkit/GLTFMTLUtilities.m",
"src/gltf/gltfkit/GLTFMTLUtilities.mm",
"src/gltf/gltfkit/GLTFNode.h",
"src/gltf/gltfkit/GLTFNode.m",
"src/gltf/gltfkit/GLTFNode.mm",
"src/gltf/gltfkit/GLTFNodeVisitor.h",
"src/gltf/gltfkit/GLTFObject.h",
"src/gltf/gltfkit/GLTFObject.m",
"src/gltf/gltfkit/GLTFObject.mm",
"src/gltf/gltfkit/GLTFScene.h",
"src/gltf/gltfkit/GLTFScene.m",
"src/gltf/gltfkit/GLTFScene.mm",
"src/gltf/gltfkit/GLTFSkin.h",
"src/gltf/gltfkit/GLTFSkin.m",
"src/gltf/gltfkit/GLTFSkin.mm",
"src/gltf/gltfkit/GLTFTexture.h",
"src/gltf/gltfkit/GLTFTexture.mm",
"src/gltf/gltfkit/GLTFTextureSampler.h",
"src/gltf/gltfkit/GLTFTextureSampler.m",
"src/gltf/gltfkit/GLTFTextureSampler.mm",
"src/gltf/gltfkit/GLTFUtilities.h",
"src/gltf/gltfkit/GLTFUtilities.m",
"src/gltf/gltfkit/GLTFUtilities.mm",
"src/gltf/gltfkit/GLTFVertexDescriptor.h",
"src/gltf/gltfkit/GLTFVertexDescriptor.m",

"src/gltf/gltfkit/GLTFVertexDescriptor.mm",
]


MLN_GENERATED_DARWIN_STYLE_SOURCE = [
"src/MLNLight.mm",
"src/MLNBackgroundStyleLayer.mm",
Expand Down
22 changes: 7 additions & 15 deletions platform/darwin/src/gltf/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,35 @@ Camera::Camera() {
_rotationVelocity = 0;
_velocity = 0;
_distance = 4; // 0; // 2;

}

simd_double4x4 Camera::projectionMatrix() {
float fov = M_PI / 3; // original
float fov = M_PI / 3; // original
fov = 0.6435011087932844; // Constant that i found in ML
simd_double4x4 matrix = GLTFPerspectiveProjectionMatrixAspectFovRH(fov, 1.0, 0.01, 250);
return matrix;
}

void Camera::updateWithTimestep(double timestep) {


_rotationAngles += _rotationVelocity * timestep;

static double rot = 0;
// rot += 0.03;
// self.rotationAngles = rot;
// _rotationAngles = simd_make_float3(rot, M_PI/4.0, 0);
// self.rotationAngles = rot;
// _rotationAngles = simd_make_float3(rot, M_PI/4.0, 0);
_rotationAngles = simd_make_float3(rot, 0, 0);


// Clamp pitch
_rotationAngles = (simd_float3){ _rotationAngles.x,
static_cast<float>(fmax(-M_PI_2, fmin(_rotationAngles.y, M_PI_2))),
0 };

_rotationAngles = (simd_float3){
_rotationAngles.x, static_cast<float>(fmax(-M_PI_2, fmin(_rotationAngles.y, M_PI_2))), 0};

_rotationVelocity *= GLTFViewerOrbitCameraRotationDrag;

// _distance += _velocity * timestep;
_velocity *= GLTFViewerOrbitCameraZoomDrag;

simd_double4x4 pitchRotation = GLTFRotationMatrixFromAxisAngleD(GLTFAxisXD, -_rotationAngles.y);
simd_double4x4 yawRotation = GLTFRotationMatrixFromAxisAngleD(GLTFAxisYD, -_rotationAngles.x);
simd_double4x4 translation = GLTFMatrixFromTranslationD((simd_double3){ 0, 0, _distance });
simd_double4x4 translation = GLTFMatrixFromTranslationD((simd_double3){0, 0, _distance});
_viewMatrix = matrix_invert(matrix_multiply(matrix_multiply(yawRotation, pitchRotation), translation));


}
8 changes: 4 additions & 4 deletions platform/darwin/src/gltf/Camera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#include <stdio.h>
#include <simd/simd.h>

namespace maplibre { namespace gltf {
namespace maplibre {
namespace gltf {

class Camera {
public:
Expand All @@ -23,10 +24,9 @@ class Camera {
simd_double4x4 projectionMatrix();
simd_double4x4 _viewMatrix;
void updateWithTimestep(double timestep);

};

}}

} // namespace gltf
} // namespace maplibre

#endif /* Camera_hpp */
5 changes: 2 additions & 3 deletions platform/darwin/src/gltf/GLTFMTLRenderItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
//

#import <Foundation/Foundation.h>
#import "gltfkit/GLTFNode.h"
#import "gltfkit/GLTFMesh.h"
#import "gltfkit/GLTFNode.h"

NS_ASSUME_NONNULL_BEGIN


@interface GLTFMTLRenderItem: NSObject
@interface GLTFMTLRenderItem : NSObject
@property (nonatomic) NSString *label;
@property (nonatomic) GLTFNode *node;
@property (nonatomic, strong) GLTFSubmesh *submesh;
Expand Down
Loading
Loading