enable_if_arithmetic_t 으로 체크 enable 구문에 따른 오류 출력 #include #include #include #ifdef _MSC_VER # define MATH_EMPTY_BASES __declspec(empty_bases) #else # define MATH_EMPTY_BASES #endif template using enable_if_arithmetic_t = std::enable_if_t; template struct TVecAdd {}; template struct TVecMul {}; template class MATH_EMPTY_BASES TVec4 : public TVecAdd, TVecMul { public: typedef T value_type; static ..
friend template decl. & impl. TVecHelpers.h 파일에는 아래와 같은 구현이 존재한다 TVecHelpers.h TVecAddOperators class 이고, TVec type이 이를 상속 받는다 private: /* * NOTE: the functions below ARE NOT member methods. They are friend functions * with they definition inlined with their declaration. This makes these * template functions available to the compiler when (and only when) this class * is instantiated, at which po..
Hazel / Scene and Entity - component system 아, 동영상 보면 좀더 쉬울듯, Serialize에는 YAML 을 사용 Component 로 각 객체를 구성 이건 Ray랑 비슷한가 객체에 add 하는 형태로 보인다 Entity entity = { m_Registry.create(), this }; entity.AddComponent();CameraCompoment, TransformComponent 등을 일반적인 구조 glm::mat4 GetTransform() const { glm::mat4 rotation = glm::toMat4(glm::quat(Rotation)); return glm::translate(glm::mat4(1.0f), Translation) * rot..
https://www.shadertoy.com/view/MtBSzR 원통으로 curl 효과를 계산한다 그 원통 안에 있는 음영은 전통적인 normal vec 방식, cos 값으로 계산하다 원통 외부의 음영은 아래 수식으로 계산됨 (원통 안쪽 front page의 음영은 다른 수식으로 계산함) float shadow = 1.0 - smoothstep (0.0, radius * 2.0, -(d - cyl[DIST]));cyl[DIST] 원통의 내부 원점라인을 잇는 직선 d는 위의 직선과 평행하게 떨어진 거리 보면 됨 smoothstep 구현상 해당 값이 r이 되었을 때 0.5, 2r 이 되었을 때 1.0 긴가 민가해서, 5r 로 늘리면,
가장 단순한 reflection 이용한, curl 효과 https://www.shadertoy.com/view/3s2SzW 단순, smoothstep을 이용한 그라데이션을 보여준다. shadow 제거하면 아래와 같다 반사 공식도 단순하다 pt = ( uv * aspect - 2.0 * side * normal ) / aspect; 좌표계를 (aspect, 1.0) 로 맞추기위한 aspect를 제거하면 단순, 3d reflect의 반사 공식이다. // Define the fold. vec2 origin = vec2(0.5,0.5); vec2 normal = normalize( vec2( 1.0, 1.0 ) ); 위의 origin, normal은 코드를 보면 간단하다 테스트 코드 링크 https://gist..
https://github.com/microsoft/WPFDXInterop/ WPF 코드도 볼만하고 좋은 듯 몇몇 필요한 call 들 InteropImage.SetPixelSize(surfWidth, surfHeight); InteropImage.WindowOwner = (new System.Windows.Interop.WindowInteropHelper(this)).Handle; InteropImage.OnRender = this.DoRender; // Start rendering now! InteropImage.RequestRender(); // 이건 이번에도 보이네 // It's possible for Rendering to call back twice in the same frame // ..
가끔 테스트 프로그램 만들 때 마다 맨날까먹는데, https://www.glfw.org/docs/3.3/group__window.html#ga37bd57223967b4211d60ca1a0bf3c832 void glfwPollEvents (void) This function processes only those events that are already in the event queue and then returns immediately. Processing events will cause the window and input callbacks associated with those events to be called. On some platforms, a window move, resize or menu..
- Total
- Today
- Yesterday