Skip to content

Instantly share code, notes, and snippets.

import React from 'react';
import { ILights } from 'src/types/lights';
import { GLTF } from 'three-stdlib';
import { GltfModel } from './gltf-model';
export const GltfScene = (props: { gltf: GLTF | undefined; lights: ILights }) => {
const { gltf, lights } = props;
const gltfElement = gltf ? <GltfModel gltf={gltf} lightOption={lights.additonalLights} /> : <group />;
@kenjiSpecial
kenjiSpecial / capture.js
Created July 27, 2020 09:17
puppeteerでスクリーンキャプチャを実行する
//
'use strict';
const puppeteer = require('puppeteer');
const { spawn } = require('child_process');
const viewportWidth = 1280; //parseInt(process.argv[4]);
const viewportHeight = (viewportWidth * 9) / 16; //parseInt(process.argv[3]);
const fps = 30;
/*--------------------------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
*-------------------------------------------------------------------------------------------------------------*/
struct StA {
a: i64,
b: i64,
}
@kenjiSpecial
kenjiSpecial / lake.cc
Created May 26, 2020 00:44
Lake Counting http://poj.org/problem?id=2386 深さ優先探索(DFS)
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
const int INF = 1001001001;
void dfs(vector<vector<string>> &vect, int x, int y, int N, int M) {
vect[x][y] = ".";
for (int dx = -1; dx <= 1; dx++) {
for (int dy = -1; dy <= 1; dy++) {
@kenjiSpecial
kenjiSpecial / lake.cc
Created May 26, 2020 00:44
Lake Counting
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
const int INF = 1001001001;
void dfs(vector<vector<string>> &vect, int x, int y, int N, int M) {
vect[x][y] = ".";
for (int dx = -1; dx <= 1; dx++) {
for (int dy = -1; dy <= 1; dy++) {
@kenjiSpecial
kenjiSpecial / main.js
Created August 25, 2019 02:13
rendering simple plane
gl.useProgram(program)
gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer());
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([ -1,-1, 1,-1, -1, 1, 1, 1]), gl.STATIC_DRAW);
var positionLocation = gl.getAttribLocation(program, "position");
gl.enableVertexAttribArray(positionLocation);
gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0);
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
@kenjiSpecial
kenjiSpecial / geo-json-to-line.ts
Created July 26, 2019 04:10
GeoJsonのデータをgl.linesで使えるjsonファイルに書き出し
import fs from 'fs';
import jsonfile from 'jsonfile';
import { IGeoJson } from './geo-json';
const eartDataUrl ='earth-line.json';
fs.readFile('./json/ne_110m_land.json', 'utf-8', (err, data) => {
const geoData = JSON.parse(data) as IGeoJson;
const pointData = [];
const indices = [];
const vertices = [];
@kenjiSpecial
kenjiSpecial / mp4_to_jpeg.py
Created May 17, 2019 22:37
covert mp4 to jpeg
import cv2
import os
print(cv2.__version__)
videoName = "n0"
cam = cv2.VideoCapture(
"C:\\freelance\\small\\nisshin\\Mp4ToJpeg\\videos\\" + videoName + ".mp4")
print('hello')
from pathlib import Path
from PIL import Image
import json
import unicodedata
Path("./output").mkdir(parents=True, exist_ok=True)
p = Path("./original/")
t = list(p.glob("*"))
@kenjiSpecial
kenjiSpecial / launch.json
Created December 10, 2018 02:41
vscode + chrome debug plugin + parcel
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",