프로그래밍 (302) 썸네일형 리스트형 [swift] SCNProgram 쉐이더 투명 적용 프로그램으로 SCNMaterial 에 쉐이더를 적용하면, fragment 쉐이더에서 알파값을 0으로 주어도 불투명한 색상으로 처리된다. 알파값을 처리하기 위해 프로그램과 머터리얼 설정이 필요. 프로그램, 머터리얼 설정// 쉐이더를 적용할 노드의 머터리얼guard let targetMaterial = node.geometry?.firstMaterial else { // 노드에 geometry 혹은 geometry내에 material 이 없음 return}// 프로그램 생성 및 쉐이더, 불투명도 설정let program = SCNProgram()program.vertexFunctionName = "VertexFunc"program.fragmentFunctionName = "FragmentFunc"pr.. [swift] SceneKit uv animation 프로퍼티쉐이더에 전달할 구조체를 정의한다. 앱에서 사용할 구조체와 쉐이더에서 입력받을 구조체 각각 정의.delta는 uv 변화량을 나타내며, type은 애니메이션 방향이다.// swiftstruct MyInputValue { var delta: Float = 0.0 var type: UInt8 = 0 init(delta: Float, type: UInt8) { self.delta = delta self.type = type }}// c header#include #include using anmespace metal;struct MyInputValue { float delta; uint8_t type;}; 텍스처 이미지 설정uv 에니메이션에 사.. [swift] swiftui fileImpoter로 파일 선택하기 파일 접근 권한 설정mac의 경우 프로젝트 설정의 Capability에 Sandbox가 설정되어 있으면 File Access Type에 설정된 폴더의 파일만 사용 가능모든 폴더의 파일을 가져오려면 App Sandbox 항목 제거 iOS의 경우 권한 문제가 발생하는 경우 Info 탭에서 Privacy 추가 타입식별자 설정프로젝트 Info 탭에서 Imported Type Identifiers 에 항목추가extensions에 여러 확장자를 지정할 경우 콤마로 구분Conforms To 에는 부모 타입을 지정 한다. 타입생성파일패널(대화상자)를 표시하기 위한 퍼블리셔 선언 및 info 에 추가한 타입 식별자로 타입 생성struct ContentView: View { @State var isOpenFile =.. [RUST] 인자 입력 받아 명령 프로세스 실행하기 rust 에서 std::process::Command 를 사용해 cmd 명령이나 파일을 실행 할 수 있는데, 어떤 객체들이 사용되는지 대략적으로 살펴본다. useuse std::error::Error as StdError;use std::fmt;use std::io::Read;use std::os::windows::process::CommandExt; // creation flaguse std::process::{self, Command, Stdio, ExitStatus};use std::env;use std::path::Path; 호출 결과 구조체struct ProcessResult { stdout: Vec, stderr: Vec, exit_status: ExitStatus,} 에러처리.. [RUST] https 를 통해 파일 다운로드 간단 샘플 Cargo.toml사용할 모듈 정보를 입력한다.tokio: 파일, asyncreqwest : httpmain을 async로 동작시키려면 tokio feature중 "rt" or "rt-multi-thread", "macros" 필요https 사용을 위해 reqwest feature 중 "rustls-tls" or "native-tls" 필요[package]name = "sample"version = "0.1.0"edition = "2021"[features]default = [][dependencies]tokio = { version = "1", features = [ "fs", "rt-multi-thread", "macros"] }reqwest = { version = "0.12", features =.. [RUST] 다른 언어와 다른 부분, 특징 정리 중.... 러스트를 전체적으로 살펴보다가 좀 특이한 것들만 정리.일단 대략 파악만 하고... 좀더 세부적으로 살펴봐야 할 내용들이 많음. 엔트리포인트크레이트 루트 바이너리 : src/main.rs 라이브러리 : src/lib.rs 모듈 선언루트와 같은 파일에 있는 경우 모듈 정의mod module {}별도 파일로 모듈 정의src/module.rsorsrc/module/mod.rs별도 파일로 모듈을 구성한 경우 크레이트 루트에 모듈 정의mod module;서브모듈 선언 : 모듈안에 선언된 모듈 서브모듈을 가진 모듈도 모듈 폴더 아래에 위치해야 함.// 모듈src/module/mod.rs// 서브모듈src/module/submodule.rs or src/module/submodule/mod.rs코드참조직접참조 : cr.. [ffmpeg] 오디오, 비디오 코덱 변환 avi를 mp4 로 변경ffmpeg -i input.avi -c:v copy -c:a copy outpu.mp4 avi 파일(mpeg4, mp3) 을 mp4(mp4v, mp4a) 로 변경ffmpeg -i input.avi -c:v copy -c:a aac output.mp4 avi 를 mov로 변경ffmpeg -i input.avi -c:v libx264 -c:a aac output.mov mov를 gif로 변경ffmpeg -i input.mov -ss 0 -t 5 -loop 0 -filter_complex "fps=10, scale=1024:-1[s], [s]split[a][b]; [a]palettegen[palette]; [b][palette]paletteuse" output.gif wmv를 mp4.. [RUST] cargo 기본 사용법 프로젝트 생성새 폴더에 프로젝트 생성 및 초기화cargo new project_namecd project_name 기존 폴더에 프로젝트만 초기화cargo init 생성시 인자--bin : 바이너리 형태 배포, main.rs 생성됨--lib : 라이브러리 형태 배포, lib.rs 생성됨 패키지 설정패키지 설정을 위한 Manifest는 Cargo.toml 파일이며, 해당 파일을 직접 수정한다.패키지[package]name = "패키지명"version = "0.0.1"authors = ["author1", "author2"]edition = "2024"description = "설명"license = "라이센스"repository = "git"homepage = "homepage"categories = ["c.. 이전 1 2 3 4 ··· 38 다음 목록 더보기