Skip to content

Instantly share code, notes, and snippets.

@xissburg
xissburg / OgreGLTFImporter.cpp
Created May 29, 2023 18:34
Ogre GLTF Importer
#define TINYGLTF_IMPLEMENTATION
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "OgreGLTFImporter.hpp"
#include <OgreRoot.h>
#include <OgreItem.h>
#include <OgreMesh2.h>
#include <OgreSubMesh2.h>
@xissburg
xissburg / cpp.json
Created June 18, 2021 15:53
VSCode header guard snippet
{
"Header guard": {
"prefix": ["#ifndef"],
"body": ["#ifndef $0", "#define $0", "\n\n", "#endif // $0", ""],
"description": "C/C++ Header guard."
}
}
#include <taskflow.hpp>
#include <chrono>
#include <vector>
#include <cstdint>
#include <cmath>
#include <thread>
int main() {
tf::Executor executor;
tf::Taskflow taskflow;
This file has been truncated, but you can view the full file.
{
"asset" : {
"generator" : "Khronos glTF Blender I/O v0.9.35",
"version" : "2.0"
},
"extensionsUsed" : [
"MSFT_lod"
],
"scene" : 0,
"scenes" : [
#-------------------------------------------------------------------
# This file is part of the CMake build system for OGRE
# (Object-oriented Graphics Rendering Engine)
# For the latest info, see http://www.ogre3d.org/
#
# The contents of this file are placed in the public domain. Feel
# free to make use of it in any way you like.
#-------------------------------------------------------------------
macro( add_recursive dir retVal )
add_custom_command(TARGET SampleBrowser POST_BUILD
COMMAND mkdir ARGS -p ${OGRE_SAMPLE_CONTENTS_PATH}/Frameworks
COMMAND ln ARGS -s -f ${OGRE_BINARY_DIR}/lib/${OGRE_BUILT_FRAMEWORK}/Ogre.framework
${OGRE_SAMPLE_CONTENTS_PATH}/Frameworks/
COMMAND ln ARGS -s -f ${Cg_LIBRARY_REL}
${OGRE_SAMPLE_CONTENTS_PATH}/Frameworks/
)
foreach(FWK ${FRAMEWORKS})
add_custom_command(TARGET SampleBrowser POST_BUILD
COMMAND ARGS "if [ -d ${OGRE_BINARY_DIR}/lib/${OGRE_OSX_BUILD_CONFIGURATION}/${FWK}.framework ]\; then ln -s -f ${OGRE_BINARY_DIR}/lib/${OGRE_OSX_BUILD_CONFIGURATION}/${FWK}.framework ${OGRE_SAMPLE_CONTENTS_PATH}/Frameworks/${FWK}.framework\; fi"
)
endforeach(FWK)
2016-11-15 22:51:08.470726 [838:235725] bytesSent: 32768, dt: 0.002019
2016-11-15 22:51:08.475647 [838:235725] bytesSent: 32768, dt: 0.004951
2016-11-15 22:51:08.478524 [838:235725] bytesSent: 32768, dt: 0.002889
2016-11-15 22:51:12.054796 [838:235725] bytesSent: 32768, dt: 3.576237
2016-11-15 22:51:12.059358 [838:235725] bytesSent: 32768, dt: 0.004584
2016-11-15 22:51:12.062085 [838:235725] bytesSent: 32768, dt: 0.002742
2016-11-15 22:51:13.224882 [838:235725] bytesSent: 32768, dt: 1.162757
2016-11-15 22:51:13.229612 [838:235725] bytesSent: 32768, dt: 0.004749
2016-11-15 22:51:13.232596 [838:235725] bytesSent: 32768, dt: 0.003004
2016-11-15 22:51:15.647303 [838:235725] bytesSent: 32768, dt: 2.414670
public extension DateFormatter {
@nonobjc static let `default`: DateFormatter = { _ in
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ"
return formatter
}()
}
// this is a property in my class because I reuse it
self.coreImageContext = [CIContext contextWithOptions:nil];
// ...
- (UIImage *)UIImageFromSampleBuffer:(CMSampleBufferRef)sampleBuffer {
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
CIImage *ciImage = [CIImage imageWithCVImageBuffer:imageBuffer];
CGImageRef cgImage = [self.coreImageContext createCGImage:ciImage fromRect:ciImage.extent];