参考教程
学习心得
在之前我们一直使用正方体作为模型,现在终于可以接触别的了。在我们所玩的游戏,或者我们现实中所接触的东西,大都是不规则形状的,很难去简单的用几个三角形构成,这也是我们这一篇介绍的重点。
你想开发游戏还是改变世界?
LeetCode#781 Rabbits in Forest
In a forest, each rabbit has some color. Some subset of rabbits (possibly all of them) tell you how many other rabbits have the same color as them. Those answers
are placed in an array.
Return the minimum number of rabbits that could be in the forest.
之前两篇种我们简略的实现了基本地图的构造和摄像机的移动,这篇文章主要着重于摄像机的视角移动,和视角移动带来的摄像机移动的几个问题。
我们之前摄像机的移动是直接对cameraMat(即view矩阵)进行 translate 操作,是直接参照坐标轴实现的,即向前就是想z轴负方向移动,左就是x轴负方向,然而我们需要实现的是向前是向摄像机方向的正前方移动。所以需要修改。
我们假设的游戏角色是在xz平面上移动的,如果以摄像机前方作为正方向,如何保证当摄像机面向正上方时W键不会使得摄像机飞到天上…等等需要注意的问题。
A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longest length of set S, where S[i] = {A[i], A[A[i]], A[A[A[i]]], … } subjected to the rule below.
Suppose the first element in S starts with the selection of element A[i] of index = i, the next element in S should be A[A[i]], and then A[A[A[i]]]… By that analogy, we stop adding right before a duplicate element occurs in S.