自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

GetRekt的博客

主要用作学习笔记。英文笔记需要翻译的请私信或留评论,会不定时进行翻译。

  • 博客(30)
  • 收藏
  • 关注

原创 Advanced Pathtracer with MIS

Advanced Pathtracer with MISIntroductionDirect/Indirect Separation (Next Event Estimation)Russian RouletteTheoryImplementationImportance SamplingConstant pdfCosine pdfModified Phong BRDFGGX Microfacet BRDFHalf VectorMicrofacet Distribution Function (D)Shad

2020-11-29 17:03:59 128

原创 Accelerating Program Based on Architecture From Software Level

Note: Before start optimization, use profiler such as gprof to determine the function that consumes the most percentage of time. gprof does not work with multithreading enabled.Increasing IPC (Instru...

2020-03-20 05:03:56 61

原创 `and` keyword in OCaml

A construction likelet rec f ... = ...and g ... = ....allows f and g to be mutually recursive (if they were separate let recs, g could refer to f but not vice versa.)That is, in the caselet rec ...

2019-10-08 13:49:27 83

原创 `option` keyword in OCaml

Error HandlingA common way of handling failure that we’ve already seen is raising exceptions with failwith.For example:let rec find (l : 'a list) (pred : 'a -> bool) : 'a = match l with | ...

2019-10-02 11:40:49 113

原创 Effective C++: Item 48 -- Be aware of template metaprogramming (TMP)

DefinitionTemplate metaprogramming (TMP) is the process of writing template-based C++ programs that execute during compilation. Think about that for a minute: a template metaprogram is a program writ...

2019-09-10 12:01:18 113

原创 Effective C++: Item 47 -- Use traits classes for information about types(check type in compile time)

Mini-review on STL Iterator Category5 categories of iterators:Input iterators can move only forward, can move only one step at a time, can only read what they point to, and can read what they’re po...

2019-09-04 11:10:38 116

原创 How to store data that can be used by another class?

ProblemBased on the One Responsibility Principle, we usually want the data as a separate component from the implementation class. This implys an “is implemented in terms of” relationship.Implement t...

2019-09-03 20:55:49 64

原创 Effective C++: Item 46:Define non-member functions inside templates when type conversions are desire

ExampleModification on example from Item 24.template<typename T>class Rational { public: Rational(const T& numerator = 0, // see Item 20 for why params const T& denominator =...

2019-09-03 11:59:17 55

转载 怎样理解C / C++复杂变量声明 -- "right-left" rule

The “right-left” rule is a completely regular rule for deciphering Cdeclarations. It can also be useful in creating them.First, symbols. Read * as "pointer to" - always on the left side ...

2019-09-02 18:18:10 210

原创 Effective C++: Item 45 -- Use member function templates to accept “all compatible types.”

SmartPtr exampleSmart pointers are objects that act much like pointers but add functionality pointers don’t provide. However, one of the things that real pointers do well is support implicit conversi...

2019-09-02 10:55:49 70

原创 Effective C++: Item 44 -- Factor parameter-independent code out of templates

Problem:Using templates can lead to code bloat: binaries with replicated (or almost replicated) code, data, or both.The result can be source code that looks fit and trim, yet object code that’s fat ...

2019-08-30 11:26:08 74

转载 WebGL canvas size vs. CSS size vs. viewport vs. clipspace vs. world space

There are lots of different widths and heights in WebGL! This post tries to clarify the pipeline which transforms your world coordinates into physical pixels. Start with a canvas:<canvas id="foo" ...

2019-08-29 16:30:11 160

转载 Texture Filtering in OpenGL

WHAT IS TEXTURE FILTERING?Textures in OpenGL are made up of arrays of elements known as texels, which contain colour and alpha values. This corresponds with the display, which is made up of a bunch o...

2019-08-29 15:59:41 215

原创 C++隐式转换与explicit关键字

隐式转换定义Implicit conversions are performed whenever an expression of some type T1 is used in context that does not accept that type, but accepts some other type T2; in particular:when the expression ...

2019-08-29 12:14:25 150

原创 Effective C++: Item 43 -- Know how to access names in templatized base classes.

Problem: Unable to access names in templatized base classIn example:class CompanyA { public: ... void sendCleartext(const std::string& msg); void sendEncrypted(const std::string& msg); ...

2019-08-29 10:59:13 75

原创 Forward Declare an Enum (error: ISO C++ forbids forward references to 'enum' types)

注: 此为英文笔记,如需翻译请私信或留评论To declare an Enum, this way won’t work. The compiler will throw a compile error since no size is explicitly specified.enum e;void Foo (E e);enum E {A, B, C};Instead, in C...

2019-08-28 19:14:10 3580

原创 C++ 中多余大括号的用处

问题今天看同事代码的时候见到了一种比较特殊的c++写法。bool test(){ ... \\ Some unrelated code { \\ Some other code ... } \\ Somce unrelated code ...}在代码中有一个多余的大括号,但是不知道是做什么用的,因为他不和前面或后面的任何代码有关。解释这个多余的大括号提供了一个...

2019-08-28 18:23:34 971 1

原创 Effective C++: Item 42 -- Understand the two meanings of typename

Difference between typename and class in template declarationstemplate<class T> class Widget; // uses “class”template<typename T> class Widget; // uses “typename”No difference. When de...

2019-08-28 11:19:10 97

原创 Initialize Member Variable Which is an Object

ProblemI have a class with a member as an object of another class. I want to initialize it and use it.class Test {public: TestImpl testImpl;}SolutionUse Guaranteed Initialization (Suggested)c...

2019-08-27 21:06:20 94

原创 Effective C++: Item 41 -- Understand implicit interfaces and compile time polymorphism.

DefinitionThe world of object-oriented programming revolves around explicit interfaces and runtime polymorphism. In the world of templates and generic programming, explicit interfaces and runtime pol...

2019-08-27 11:27:43 90

原创 glsl中lowp, mediump, highp的区别 (Precision Qualifier)

定义浮点数和整数类型的区间和精度取决于数据来源(varying, uniform, texture look-up, etc.), 是在片元着色器还是在顶点着色器中,及其他细节。Precision Qualifier的用处就是定义一个变量的最小的储存需求。Precision Qualifiers任何浮点数或整数的定义可以由这三个precision qualifier之中的一个定义例子l...

2019-08-26 20:43:53 9673

原创 C++ 长行字符串多行书写

问题在使用C++编写图形学程序的时候往往会碰到需要将着色器代码变为字符串嵌入代码的情况。如何将着色器代码更简便快捷的用字符串表示出来便成为了一个问题。解决方案使用双引号string testShader = "uniform mat4 g_mvpMatrix; \n" "attribute vec3 position;\n" ...

2019-08-26 17:18:04 8269 2

原创 Effective C++: Item 40 -- Use multiple inheritance judiciously

注: 此为英文资料整理,如需翻译请私信或留评论Multiple Inheritance (MI) DefinitionMultiple inheritance just means inheriting from more than one base class, but it is not uncommon for MI to be found in hierarchies that hav...

2019-08-26 11:49:10 103

原创 Pure Virtual Function, Abstract Class and Interface in C++

Pure Virtual FunctionA pure virtual function (or abstract function) in C++ is a virtual function for which we don’t have implementation, we only declare it. A pure virtual function is declared by ass...

2019-08-23 17:41:12 132

原创 Forward declare a class which is in a namespace

Normally, we forward declare a class like following.class T1;class T2 { T1* t1; };However, for class which is in a namespace the above way doesn’t work. We need instead:namespace n1 {class T1;...

2019-08-23 16:05:58 193

原创 Effective C++: Item 39 -- Use private inheritance judiciously

DefinitionPrivate inheritance doesn’t mean is-a. In contrast to public inheritance, compilers will generally not convert a derived class object into a base class object if the inheritance relationshi...

2019-08-23 11:32:04 74

原创 Effective C++: Item 38 -- Model “has-a” or “is-implemented-in-terms- of” through composition

DefinitionComposition is the relationship between types that arises when objects of one type contain objects of another type. Composition is also known as layering, containment, aggrega- tion, and em...

2019-08-22 21:32:08 104 1

原创 Javascript Coercion and Operator Between Non-boolean Values

DefinitionConverting a value from one type to another is often called “type casting,” when done explicitly, and “coercion” when done implicitly (forced by the rules of how a value is used).Another w...

2019-08-22 16:51:51 187 1

翻译 Window.devicePixelRatio 设备像素比

定义设备像素比返回了设备上的物理像素和当前设备CSS像素的一个比值。 这个数值告诉浏览器多少屏幕实际的像素点被用来画了一个CSS像素点。公式表示就是:window.devicePixelRatio = 物理像素 / css像素这个比例常被用来解决标准显示及Retina显示的不同。注意没有办法可以得知这个比值的变化(这可能发生,比如用户将一个窗口拖到另一个显示器中)。 唯一的解决办法就是周...

2019-08-22 16:12:13 1732

原创 C++ namespace 命名空间

namespace 的作用namespace用于分割项目整个空间,使每一个空间相对独立,虽然相同的名字存在,但是他们处于不同的namespace中,就不会发生命名冲突。全局作用域最大的问题是只有一个。在一个大型项目中,人们经常会重复命名从而导致命名冲突。例子:library1.h might define a number of constants, including the follo...

2019-08-22 12:16:52 61

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除