本文整理汇总了C++中TVector::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ TVector::Get方法的具体用法?C++ TVector::Get怎么用?C++ TVector::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TVector
的用法示例。
在下文中一共展示了TVector::Get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetString
void SetString(int row, int column, const ZString& str)
{
if (m_vvstr.Get(row).Get(column) != str) {
m_vvstr.Get(row).Set(column, str);
Changed();
}
}
示例2: SetColor
void SetColor(int row, const Color& color)
{
if (m_vcolor.Get(row) != color) {
m_vcolor.Set(row, color);
Changed();
}
}
示例3: AddExplosion
void AddExplosion(
const Vector& position,
const Vector& forward,
const Vector& right,
const Vector& dposition,
float radiusExplosion,
float radiusShockWave,
const Color& color,
int countDecals,
TVector<TRef<AnimatedImage> > vpimage,
Image* pimageShockwave
) {
//
// Add the shockwave
//
if (pimageShockwave != NULL) {
m_listShockwave.PushFront();
ShockwaveData& sdata = m_listShockwave.GetFront();
sdata.m_timeStart = GetTime()->GetValue();
sdata.m_pimageShockwave = pimageShockwave;
sdata.m_color = color;
sdata.m_position = position;
sdata.m_dposition = dposition;
sdata.m_scale = radiusShockWave;
sdata.m_forward = forward;
sdata.m_right = right;
}
//
// Add the little explosions
//
int countImage = vpimage.GetCount();
int indexImage = 0;
for (int index = 0; index < countDecals; index++) {
ExplosionDataList& list = m_vlistExplosion.Get(index);
list.PushFront();
ExplosionData& edata = list.GetFront();
edata.m_timeStart = GetTime()->GetValue() + index * 0.25f;
edata.m_pimage = vpimage[indexImage];
edata.m_position = position + Vector::RandomPosition(radiusExplosion * 0.5f);
edata.m_dposition = dposition;
edata.m_angle = random(0, 2 * pi);
edata.m_scale = radiusExplosion;
indexImage++;
if (indexImage >= countImage) {
indexImage = 0;
}
}
}
示例4: SetSize
void SetSize(int rows, int columns)
{
m_vvstr.SetCount(rows);
m_vcolor.SetCount(rows);
m_vColumn.SetCount(columns);
for (int index = 0; index < rows; index++) {
m_vvstr.Get(index).SetCount(columns);
}
Changed();
}
示例5: StringGridImageImpl
StringGridImageImpl(int columns, int rows, IEngineFont* pfont) :
m_pfont(pfont),
m_vvstr(rows),
m_vcolor(rows),
m_vColumn(columns)
{
for (int index = 0; index < rows; index++) {
m_vvstr.Get(index).SetCount(columns);
}
m_ysizeRow = (float)(m_pfont->GetTextExtent("W").Y());
}
示例6: Render
void Render(Context* pcontext)
{
float fill = 0;
fill += RenderShockwaves(pcontext);
int count = m_vlistExplosion.GetCount();
for (int index = 0; index < count; index++) {
fill += RenderExplosions(pcontext, m_vlistExplosion.Get(index));
//
// If we have passed the fill limit throw away the rest of the explosions
//
if (fill > 2.0f) {
for (int index2 = index + 1; index2 < count; index2++) {
m_vlistExplosion.Get(index2).SetEmpty();
}
return;
}
}
}
示例7: SetCount
void SetCount(unsigned int seed, short count)
{
count = count * 4;
m_data.SetCount(count);
srand(seed);
for (int index = 0; index < count; index++) {
//
// Allocate star positions with a nice uniform density
//
StarData& data = m_data.Get(index);
data.m_direction = Vector::RandomDirection();
data.m_bFirstFrame = true;
float bright = random(0.25f, 1);
data.m_color = Color(bright, bright, bright);
}
}
示例8: Render
void Render(Context* pcontext)
{
int count = m_data.GetCount();
if (count > 0) {
Camera* pcamera = GetCamera();
float focus = pcamera->GetFocus();
const Rect& rect = GetViewRect()->GetValue();
float scale = focus * rect.XSize() / 2;
float xc = rect.Center().X();
float yc = rect.Center().Y();
const Orientation& orient = GetCamera()->GetOrientation();
VertexScreen* pvertex = pcontext->GetVertexScreenBuffer(count * 2);
WORD* pindex = pcontext->GetIndexBuffer(count * 2);
int index = 0;
int indexPoint = count * 2;
for(int indexSource = 0; indexSource < count; indexSource++) {
StarData& data = m_data.Get(indexSource);
Color& color = data.m_color;
Vector& direction = data.m_direction;
Point& pointOld = data.m_pointOld;
//
// orient the start based on the current camera
//
Vector vec = orient.TimesInverse(direction);
//
// fold up the stars for higher density
//
if (vec.z > 0) {
vec.SetX(-vec.X());
vec.SetY(-vec.Y());
vec.SetZ(-vec.Z());
}
//
// project the star onto the screen
//
float x = (float)(int)(scale * vec.X() + xc);
float y = (float)(int)(yc - scale * vec.Y());
float xold;
float yold;
if (data.m_bFirstFrame) {
xold = x;
yold = y;
data.m_bFirstFrame = false;
} else {
xold = pointOld.X();
yold = pointOld.Y();
}
if (rect.Inside(Point(x, y))) {
float dx = abs(x - xold);
float dy = abs(y - yold);
float length = dx + dy;
if (length <= 1.0f) {
//
// Draw a point
//
indexPoint--;
pvertex[indexPoint].x = x;
pvertex[indexPoint].y = y;
pvertex[indexPoint].z = 0;
pvertex[indexPoint].qw = (float)1.0f/10000.0f;
pvertex[indexPoint].color = MakeD3DCOLOR(color);
pvertex[indexPoint].specular = 0;
} else {
//
// Draw a line
//
if (length > 16.0f) {
float scale = 16.0f / length;
xold = x + (xold - x) * scale;
yold = y + (yold - y) * scale;
}
if (rect.Inside(Point(xold, yold))) {
float alpha = 1.0f - 0.1f * length;
if (alpha < 0.25f) {
alpha = 0.25f;
}
pvertex[index * 2].x = x;
pvertex[index * 2].y = y;
pvertex[index * 2].z = 0;
pvertex[index * 2].qw = (float)1.0f/10000.0f;
//.........这里部分代码省略.........
示例9: GetTextureX
IDirect3DTextureX* GetTextureX(PixelFormat* ppf, const WinPoint& size, int& id)
{
id = m_data.m_id;
// Return the fullsize surface if that's what's wanted.
if (size == m_size)
{
if (ppf == m_data.m_ppf)
{
SetSurfaceMode(SurfaceModeDD);
return m_data.m_pd3dtexture;
}
UpdateConvertedSurface(ppf, m_size, m_dataConverted, m_data);
return m_dataConverted.m_pd3dtexture;
}
// Need to return a lower level of detail
int index = 0;
WinPoint sizeSource = m_size;
while (true) {
sizeSource.SetX(sizeSource.X() / 2);
sizeSource.SetY(sizeSource.Y() / 2);
//
// Do we need to allocate a new lower level of detail?
//
if (index == m_datas.GetCount()) {
m_datas.PushEnd();
m_datasConverted.PushEnd();
ConstructSurfaceData(m_datas.Get(index), m_data.m_ppf, sizeSource);
}
// Do we need to update this level?
if (m_datas[index].m_id != m_data.m_id)
{
_ASSERT( false );
/* DownSample(
sizeSource,
m_datas[index].m_pdds,
index == 0 ?
m_data.m_pdds
: m_datas[index - 1].m_pdds
);
m_datas.Get(index).m_id = m_data.m_id;*/
}
// Did we find the right size?
if (sizeSource == size)
{
// Does the format need to be converted?
if (ppf == m_data.m_ppf)
{
return m_datas[index].m_pd3dtexture;
}
else
{
UpdateConvertedSurface(ppf, size, m_datasConverted.Get(index), m_datas[index]);
return m_datasConverted[index].m_pd3dtexture;
}
}
index++;
}
}