Пример #1
0
void NyqTextCtrl::OnUpdate(wxUpdateUIEvent & e)
{
   int pos = GetInsertionPoint();

   if (pos != mLastCaretPos) {
      int lpos = wxMax(0, pos - 1);
   
      wxString text = GetRange(lpos, pos);
      if (text.Length() > 0) {
         if (text[0] == wxT('(')) {
            wxLongToLongHashMap::const_iterator left = mLeftParens.find(lpos);
            if (left != mLeftParens.end()) {
               Colorize(lpos, left->second);
            }
         }
         else if (text[0] == wxT(')')) {
            wxLongToLongHashMap::const_iterator right = mRightParens.find(lpos);
            if (right != mRightParens.end()) {
               Colorize(right->second, lpos);
            }
         }
      }

      mLastCaretPos = pos;
   }
}
Пример #2
0
protected func Initialize() 
{
  // Alle Fische anfangs umfärben
  var pFish;
  while(pFish=FindObject(FISH,0,0,0,0,0,0,0,0,pFish))
    Colorize(pFish);
}
Пример #3
0
void NyqTextCtrl::MoveCursor(long first, long second)
{
   int pos = GetInsertionPoint();
   int lpos = wxMax(0, pos - 1);

   wxString text = GetRange(lpos, pos);

   if (text[0] == wxT('(')) {
      SetInsertionPoint(first + 1);
      Colorize(first, second);
   }
   else if (text[0] == wxT(')')) {
      SetInsertionPoint(second + 1);
      Colorize(first, second);
   }
}
Пример #4
0
void MainWidget::editReturnPressedData()
{
  lw_text->append(FormatLwcp(Colorize(lw_edit->text()),true));
  lw_tcp_socket->write(lw_edit->text().toUtf8()+"\r\n",
			 lw_edit->text().length()+2);
  lw_edit->setText("");
}
Пример #5
0
void NyqTextCtrl::OnKeyUp(wxKeyEvent & e)
{
   e.Skip();

   int pos = GetInsertionPoint();
   int lpos = wxMax(0, pos - 1);

   wxString text = GetRange(lpos, pos);

   if (text[0] == wxT('(')) {
      wxLongToLongHashMap::const_iterator left = mLeftParens.find(lpos);
      if (left != mLeftParens.end()) {
         Colorize(lpos, left->second);
      }
   }
   else if (text[0] == wxT(')')) {
      wxLongToLongHashMap::const_iterator right = mRightParens.find(lpos);
      if (right != mRightParens.end()) {
         Colorize(right->second, lpos);
      }
   }
}
Пример #6
0
void EscDraw::DrawImageColor(EscEscape& e)
{
	int cnt = e.GetCount();
	if(cnt != 4 && cnt != 5 && cnt != 7)
		e.ThrowError("wrong number of arguments in call to 'DrawImageColor'");

	Image img = Colorize(GetUscImage((String)e[cnt - 3]), ColorEsc(e[cnt - 2]), e.Int(cnt - 1));

	if(cnt == 4)
		w.DrawImage(RectEsc(e[0]), img);
	else
	if(cnt == 5)
		w.DrawImage(e.Int(0), e.Int(1), img);
	else
	if(cnt == 7)
		w.DrawImage(e.Int(0), e.Int(1), e.Int(2), e.Int(3), img);
}
Пример #7
0
StatusBar::StatusBar(FXComposite *p, void* dont_freeze):
    FXHorizontalFrame(p,LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|FRAME_RAISED, 0,0,0,0, 3,3,3,3, 7,3)
{
  coords=new FXTextField(this,12,NULL,FRAME_RAISED|FRAME_SUNKEN|TEXTFIELD_READONLY);
  coords->setEditable(false);

  FXHorizontalFrame*hf=new FXHorizontalFrame(this,LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|FRAME_NONE, 0,0,0,0, 0,0,0,0, 0,0);
  docname=new FXTextField(hf, 1024, NULL, FRAME_RAISED|FRAME_SUNKEN|TEXTFIELD_READONLY|LAYOUT_FILL_X);
  docname->setEditable(false);

  encname=new FXTextField(this, 8, NULL, FRAME_RAISED|FRAME_SUNKEN|TEXTFIELD_READONLY);
  encname->setEditable(false);

  mode=new FXLabel(this, FXString::null, NULL,JUSTIFY_LEFT|LAYOUT_FIX_Y);
  mode->setY(6);
  mode->hide();
  mode->setUserData(dont_freeze);

  Colorize();
}
Пример #8
0
void CFulEditCtrl::AddInternalLine(const tstring & aLine) {
	int length = GetTextLengthEx(GTL_NUMCHARS)+1;
	
	AppendText(_T("\r"));
	AppendText(aLine.c_str());
	
	CHARRANGE cr;
	GetSel(cr);
	//HideSelection(TRUE, FALSE);

	Colorize(aLine, length);
	CheckUrls(aLine, length);
	
	SetSel(GetTextLengthEx(GTL_NUMCHARS), GetTextLengthEx(GTL_NUMCHARS));
	ScrollCaret();

	SetSel(cr);

	//HideSelection(FALSE, FALSE);

	skipLog = false;
}
Пример #9
0
//-----------------------------------------------------------------------------
// Purpose: Parses a line of text for color markup and inserts it via Colorize()
//-----------------------------------------------------------------------------
void CBaseHudChatLine::InsertAndColorizeText( wchar_t *buf, int clientIndex )
{
	if ( m_text )
	{
		delete[] m_text;
		m_text = NULL;
	}
	m_textRanges.RemoveAll();

	m_text = CloneWString( buf );

	CBaseHudChat *pChat = dynamic_cast<CBaseHudChat*>(GetParent() );

	if ( pChat == NULL )
		return;

	wchar_t *txt = m_text;
	int lineLen = wcslen( m_text );
	if ( m_text[0] == COLOR_PLAYERNAME || m_text[0] == COLOR_LOCATION || m_text[0] == COLOR_NORMAL || m_text[0] == COLOR_ACHIEVEMENT )
	{
		while ( txt && *txt )
		{
			TextRange range;

			switch ( *txt )
			{
			case COLOR_PLAYERNAME:
			case COLOR_LOCATION:
			case COLOR_ACHIEVEMENT:
			case COLOR_NORMAL:
				{
					// save this start
					range.start = (txt-m_text) + 1;
					range.color = pChat->GetTextColorForClient( (TextColor)(*txt), clientIndex );
					range.end = lineLen;

					int count = m_textRanges.Count();
					if ( count )
					{
						m_textRanges[count-1].end = range.start - 1;
					}

					m_textRanges.AddToTail( range );
				}
				++txt;
				break;

			default:
				++txt;
			}
		}
	}

	if ( !m_textRanges.Count() && m_iNameLength > 0 && m_text[0] == COLOR_USEOLDCOLORS )
	{
		TextRange range;
		range.start = 0;
		range.end = m_iNameStart;
		range.color = pChat->GetTextColorForClient( COLOR_NORMAL, clientIndex );
		m_textRanges.AddToTail( range );

		range.start = m_iNameStart;
		range.end = m_iNameStart + m_iNameLength;
		range.color = pChat->GetTextColorForClient( COLOR_PLAYERNAME, clientIndex );
		m_textRanges.AddToTail( range );

		range.start = range.end;
		range.end = wcslen( m_text );
		range.color = pChat->GetTextColorForClient( COLOR_NORMAL, clientIndex );
		m_textRanges.AddToTail( range );
	}

	if ( !m_textRanges.Count() )
	{
		TextRange range;
		range.start = 0;
		range.end = wcslen( m_text );
		range.color = pChat->GetTextColorForClient( COLOR_NORMAL, clientIndex );
		m_textRanges.AddToTail( range );
	}

	for ( int i=0; i<m_textRanges.Count(); ++i )
	{
		wchar_t * start = m_text + m_textRanges[i].start;
		if ( *start > 0 && *start < COLOR_MAX )
		{
			m_textRanges[i].start += 1;
		}
	}

	Colorize();
}
Пример #10
0
static int WriteOneColLine(int col)
{
    CalEntry *e = CalColumn[col];
    char const *s;
    char const *space;

#ifdef REM_USE_WCHAR
    wchar_t const *ws;
    wchar_t const *wspace;
#endif

    int numwritten = 0;

    /* Print as many characters as possible within the column */
#ifdef REM_USE_WCHAR
    if (e->wc_text) {
	wspace = NULL;
	ws = e->wc_pos;

	/* If we're at the end, and there's another entry, do a blank
	   line and move to next entry. */
	if (!*ws && e->next) {
	    PrintLeft("", ColSpaces, ' ');
	    CalColumn[col] = e->next;
	    free((void *)e->text);
	    free((void *)e->filename);
	    if (e->wc_text) free((void *)e->wc_text);
	    free(e);
	    return 1;
	}

	/* Find the last space char within the column. */
	while (ws - e->wc_pos <= ColSpaces) {
	    if (!*ws) {wspace = ws; break;}
	    if (iswspace(*ws)) wspace = ws;
	    ws++;
	}

	/* Colorize reminder if necessary */
	if (UseVTColors && e->is_color) {
	    Colorize(e);
	}

	/* If we couldn't find a space char, print what we have. */
	if (!wspace) {
	    for (ws = e->wc_pos; ws - e->wc_pos < ColSpaces; ws++) {
		if (!*ws) break;
		numwritten++;
		PutWideChar(*ws);
	    }
	    e->wc_pos = ws;
	} else {
	    /* We found a space - print everything before it. */
	    for (ws = e->wc_pos; ws<wspace; ws++) {
		if (!*ws) break;
		numwritten++;
		PutWideChar(*ws);
	    }
	}

	/* Decolorize reminder if necessary */
	if (UseVTColors && e->is_color) {
	    Decolorize();
	}

	/* Flesh out the rest of the column */
	while(numwritten++ < ColSpaces) PutChar(' ');

	/* Skip any spaces before next word */
	while (iswspace(*ws)) ws++;

	/* If done, free memory if no next entry. */
	if (!*ws && !e->next) {
	    CalColumn[col] = e->next;
	    free((void *)e->text);
	    free((void *)e->filename);
	    if (e->wc_text) free((void *)e->wc_text);
	    free(e);
	} else {
	    e->wc_pos = ws;
	}
	if (CalColumn[col]) return 1; else return 0;
    } else {
#endif
	space = NULL;
	s = e->pos;

	/* If we're at the end, and there's another entry, do a blank
	   line and move to next entry. */
	if (!*s && e->next) {
	    PrintLeft("", ColSpaces, ' ');
	    CalColumn[col] = e->next;
	    free((void *)e->text);
	    free((void *)e->filename);
#ifdef REM_USE_WCHAR
	    if (e->wc_text) free((void *)e->wc_text);
#endif
	    free(e);
	    return 1;
	}

	/* Find the last space char within the column. */
	while (s - e->pos <= ColSpaces) {
	    if (!*s) {space = s; break;}
	    if (*s == ' ') space = s;
	    s++;
	}

	/* Colorize reminder if necessary */
	if (UseVTColors && e->is_color) {
	    Colorize(e);
	}

	/* If we couldn't find a space char, print what we have. */
	if (!space) {
	    for (s = e->pos; s - e->pos < ColSpaces; s++) {
		if (!*s) break;
		numwritten++;
		PutChar(*s);
	    }
	    e->pos = s;
	} else {
	    /* We found a space - print everything before it. */
	    for (s = e->pos; s<space; s++) {
		if (!*s) break;
		numwritten++;
		PutChar(*s);
	    }
	}

	/* Decolorize reminder if necessary */
	if (UseVTColors && e->is_color) {
	    Decolorize();
	}

	/* Flesh out the rest of the column */
	while(numwritten++ < ColSpaces) PutChar(' ');

	/* Skip any spaces before next word */
	while (*s == ' ') s++;

	/* If done, free memory if no next entry. */
	if (!*s && !e->next) {
	    CalColumn[col] = e->next;
	    free((void *)e->text);
	    free((void *)e->filename);
#ifdef REM_USE_WCHAR
	    if (e->wc_text) free((void *)e->wc_text);
#endif
	    free(e);
	} else {
	    e->pos = s;
	}
	if (CalColumn[col]) return 1; else return 0;
#ifdef REM_USE_WCHAR
    }
#endif
}
Пример #11
0
void SystemFrame::addLine(const LogMessagePtr& aMessageData) {
	ctrlPad.SetRedraw(FALSE);
	
	POINT pt = { 0 };
	bool scroll = !lButtonDown && scrollIsAtEnd();
	ctrlPad.GetScrollPos(&pt);
	int curPos = ctrlPad.CharFromPos(pt); //current scroll position by character pos

	LONG SavedBegin, SavedEnd;
	LONG Begin = 0; 
	LONG End = 0;

	ctrlPad.GetSel(SavedBegin, SavedEnd);

	End = Begin = ctrlPad.GetTextLengthEx(GTL_NUMCHARS);


	tstring Text = Text::toT(aMessageData->getText()) + _T(" \r\n");
	tstring time = Text::toT(" [" + Util::getTimeStamp(aMessageData->getTime()) + "] ");
	tstring line = time + Text;

	LONG limitText = ctrlPad.GetLimitText();
	LONG TextLength = End + line.size();

	if((TextLength +1) > limitText) {
		dcdebug("textlength %s \n", Util::toString(TextLength).c_str());
		LONG RemoveEnd = 0;
		RemoveEnd = ctrlPad.LineIndex(ctrlPad.LineFromChar(2000));
		End = Begin -=RemoveEnd;
		SavedBegin -= RemoveEnd;
		SavedEnd -= RemoveEnd;

		//fix the scroll position if text was removed from the start
		POINT p = { 0 };
		curPos -= RemoveEnd;
		p = ctrlPad.PosFromChar(curPos);
		pt.y = p.y;

		ctrlPad.SetSel(0, RemoveEnd);
		ctrlPad.ReplaceSel(_T(""));
	}

	ctrlPad.AppendText(line.c_str());
	
	End += time.size() -1;
	ctrlPad.SetSel(Begin, End);
	ctrlPad.SetSelectionCharFormat(WinUtil::m_TextStyleTimestamp);

	if (aMessageData->getSeverity() == LogMessage::SEV_ERROR) {
		ctrlPad.SetSel(End, End+Text.length()-1);
		CHARFORMAT2 ec = WinUtil::m_ChatTextGeneral;
		ec.crTextColor = SETTING(ERROR_COLOR);
		ctrlPad.SetSelectionCharFormat(ec);
	}

	Colorize(Text, End+1); //timestamps should always be timestamps right?

	ctrlPad.SetSel(Begin, Begin);

	switch(aMessageData->getSeverity()) {

	case LogMessage::SEV_INFO:
		CImageDataObject::InsertBitmap(ctrlPad.GetOleInterface(),hbInfo, false);
		break;
	case LogMessage::SEV_WARNING:
		CImageDataObject::InsertBitmap(ctrlPad.GetOleInterface(), hbWarning, false);
		break;
	case LogMessage::SEV_ERROR:
		CImageDataObject::InsertBitmap(ctrlPad.GetOleInterface(), hbError, false);
		if(!errorNotified && !getActive()) { 
			setIcon(tabError);
			errorNotified = true;
		}
		break;
	default:
		break;
	}
	
	ctrlPad.SetSel(SavedBegin, SavedEnd); //restore the user selection

	if(scroll/* && (SavedBegin == SavedEnd)*/) { 
		scrollToEnd();
	} else {
		ctrlPad.SetScrollPos(&pt);
	}
	
	ctrlPad.SetRedraw(TRUE);
	ctrlPad.InvalidateRect(NULL);
}
Пример #12
0
void ScriptEditCtrl::Impl::PreSubclassWindow()
{
	self_->m_hWnd = m_hWnd;	// expose HWND

	SetupDirectAccess();

	// If we are running as Unicode, then use the UTF8 codepage
#ifdef _UNICODE
	SetCodePage(SC_CP_UTF8);
#endif

	SetLexer(SCLEX_LUA);
	StyleSetFont(STYLE_DEFAULT, "Lucida Console");
	StyleSetSize(STYLE_DEFAULT, 10);
	SetKeyWords(0, LuaKeywords);
	SetKeyWords(1, LuaFunctions);
	if (enable_input_attribs_)
		SetKeyWords(2, LuaUser);
	SetKeyWords(3, ConcatAttributes().c_str());

	COLORREF comment= RGB(0,128,128);
	COLORREF string= RGB(128,128,0);

	StyleSetFore(SCE_LUA_COMMENT, comment);
	StyleSetFore(SCE_LUA_COMMENTLINE, comment);
	StyleSetFore(SCE_LUA_COMMENTDOC, comment);
	StyleSetFore(SCE_LUA_NUMBER, RGB(0,0,255));
	StyleSetFore(SCE_LUA_WORD, RGB(34,78,160));		// keywords
	StyleSetFore(SCE_LUA_STRING, string);
	StyleSetFore(SCE_LUA_CHARACTER, string);
	StyleSetFore(SCE_LUA_LITERALSTRING, string);
	StyleSetFore(SCE_LUA_WORD2, RGB(53,113,202));	// functions
	StyleSetFore(SCE_LUA_WORD3, RGB(124,37,203));	// test & number
	StyleSetBack(SCE_LUA_WORD3, CalcColor(::GetSysColor(COLOR_WINDOW), RGB(0,0,255), 0.95f));
	StyleSetFore(SCE_LUA_WORD4, RGB(164,97,49));	// todo: attributes

	StyleSetFont(SCE_LUA_WORD, "Lucida Console");
	StyleSetSize(SCE_LUA_WORD, 10);
	StyleSetBold(SCE_LUA_WORD, true);

	//#define SCE_LUA_PREPROCESSOR 9
	//#define SCE_LUA_OPERATOR 10
	//#define SCE_LUA_IDENTIFIER 11
	//#define SCE_LUA_STRINGEOL 12
	//#define SCE_LUA_WORD2 13
	//#define SCE_LUA_WORD3 14
	//#define SCE_LUA_WORD4 15
	//#define SCE_LUA_WORD5 16
	//#define SCE_LUA_WORD6 17
	//#define SCE_LUA_WORD7 18
	//#define SCE_LUA_WORD8 19

	Colorize(0, -1);

	//MarkerDefine(MARKER_POINTER, SC_MARK_ARROW);
	//MarkerSetBack(MARKER_POINTER, RGB(255,255,0));

	//MarkerDefine(MARKER_BREAKPOINT, SC_MARK_ROUNDRECT);
	//MarkerSetBack(MARKER_BREAKPOINT, RGB(0,0,255));

	//MarkerDefine(MARKER_ERROR, SC_MARK_ARROW);
	//MarkerSetBack(MARKER_ERROR, RGB(255,0,0));

	int width= 0;
	SetMarginWidthN(1, width);

	SetScrollWidthTracking(true);
	SetScrollWidth(1);

	SetWrapMode(SC_WRAP_WORD);
	SetWrapVisualFlags(SC_WRAPVISUALFLAG_END);

	SetSelBack(true, CalcShade(::GetSysColor(COLOR_HIGHLIGHT), 50.0f));

	SetTabWidth(4);
	SetIndent(4);

	DWORD pixels= 1;
	::SystemParametersInfo(SPI_GETCARETWIDTH, 0, &pixels, 0);
	SetCaretWidth(pixels);

	// hwnd is attached, but message processing is not working yet, we are not yet subclassed,
	// so postpone this WM_NCCALCSIZE call:
	PostMessage(WM_APP+1234);
}
Пример #13
0
void Terrain()
{
    // Allocate the offscreen bitmap
    offMap = CreateBitmap(256, 200);
    if (!offMap) return;

    // Allocate the surface maps
    if (!ISurface()) return;

	// Build tables
	BuildProjectionTable();
                
    // Attempt to randomize
    gSeed = time(NULL) + clock();
        
    // Generate the fractal surface
    Fractify(0, 0, 256, 256);
	Smoothify();
	
    // Build obelisk
    for (int j=-3; j<4; j++)
    	for (int i=-3; i<4; i++)
        	Point(128+i, 128+j) = 240;
        
    // Generate the palette
    BuildPalette();
    // Colorize the surface (w/ sealevel  parameter)
    Colorize(80);

    // Initialize values
	int elev = 10 << (YFIX+FIX);
    gX = gY = gZ = 0;
   	gY = HeightAt(gX, gZ) + elev;

    // Do some display
    int  mx, my;
    char q = 0, clr=0;
    int  c, f = 0;
    char msg[80];
	
    clock_t clk = clock();
    while (!q)
    {
		// Count the frame
        f++;

        //------------Refresh the display-------------
        // Clear the offmap
        ClearScreen(254, 256, 200, offMap);
        // Draw the surface
		Caster();
        // Copy the offmap to the screen                
        Display(offMap, 256, 200);

        //------------Handle user input-------------
        MouseMove(&mx, &my);
        if (mx || my)
        {
            gZ -= my;
            gZ = gZ & 4095;
                        
            gX += mx;
            gX = gX & 4095;
        	gY = HeightAt(gX, gZ) + elev;
        }
        else if (kbhit())
        {
            c = getch();
            switch (c)
            {
                case 0:
                	c = getch();
                    switch (c)
                    {
                        case UP_ARROW_KEY:
                                gZ += 1;
                                break;

                        case DN_ARROW_KEY:
                                gZ -= 1;
                                break;
                                        
                        case LF_ARROW_KEY:
                                gX -= 1;
                                break;

                        case RT_ARROW_KEY:
                                gX += 1;
                            break;
                    }   
                    break;
                                
                case 'w':
                	elev += 8;
                	break;

                case 'x':
                	elev -= 8;
                	 break;

                case ESC_KEY:
                	q = 1;
               		break;
            }

            gZ &= 4095;
            gX &= 4095;
        	gY = HeightAt(gX, gZ) + elev;
        }                                   
    }
    clk = clock() - clk;
    
    _settextposition(1, 2);
    _settextcolor(255);
    sprintf(msg, "Frames: %ld,  Time: %5.2fs,  FPS: %5.2f\n", f, clk/(float)CLOCKS_PER_SEC, f * (float)CLOCKS_PER_SEC / clk);
    _outtext(msg);
}
Пример #14
0
void MainWidget::ProcessCommand(const QString &cmd)
{
  lw_text->append(FormatLwcp(Colorize(cmd),false));
}
Пример #15
0
int main(int argc,char **argv)
{
  // initialize generator
  InitTexgen();

  // colors
  Pixel black,white;
  black.Init(0,0,0,255);
  white.Init(255,255,255,255);

  timeBeginPeriod(1);
  sInt startTime = timeGetTime();

  for(sInt i=0;i<100;i++)
  {
    // create gradients
    GenTexture gradBW = LinearGradient(0xff000000,0xffffffff);
    GenTexture gradWB = LinearGradient(0xffffffff,0xff000000);
    GenTexture gradWhite = LinearGradient(0xffffffff,0xffffffff);

    // simple noise test texture
    GenTexture noise;
    noise.Init(256,256);
    noise.Noise(gradBW,2,2,6,0.5f,123,GenTexture::NoiseDirect|GenTexture::NoiseBandlimit|GenTexture::NoiseNormalize);

    /*// save test image
    if(!SaveImage(noise,"noise.tga"))
    {
      printf("Couldn't write 'noise.tga'!\n");
      return 1;
    }*/

    // 4 "random voronoi" textures with different minimum distances
    GenTexture voro[4];
    static sInt voroIntens[4] = {     37,     42,     37,     37 };
    static sInt voroCount[4]  = {     90,    132,    240,    255 };
    static sF32 voroDist[4]   = { 0.125f, 0.063f, 0.063f, 0.063f };

    for(sInt i=0;i<4;i++)
    {
      voro[i].Init(256,256);
      RandomVoronoi(voro[i],gradWhite,voroIntens[i],voroCount[i],voroDist[i]);
    }

    // linear combination of them
    LinearInput inputs[4];
    for(sInt i=0;i<4;i++)
    {
      inputs[i].Tex = &voro[i];
      inputs[i].Weight = 1.5f;
      inputs[i].UShift = 0.0f;
      inputs[i].VShift = 0.0f;
      inputs[i].FilterMode = GenTexture::WrapU|GenTexture::WrapV|GenTexture::FilterNearest;
    }

    GenTexture baseTex;
    baseTex.Init(256,256);
    baseTex.LinearCombine(black,0.0f,inputs,4);

    // blur it
    baseTex.Blur(baseTex,0.0074f,0.0074f,1,GenTexture::WrapU|GenTexture::WrapV);

    // add a noise layer
    GenTexture noiseLayer;
    noiseLayer.Init(256,256);
    noiseLayer.Noise(LinearGradient(0xff000000,0xff646464),4,4,5,0.995f,3,GenTexture::NoiseDirect|GenTexture::NoiseNormalize|GenTexture::NoiseBandlimit);

    baseTex.Paste(baseTex,noiseLayer,0.0f,0.0f,1.0f,0.0f,0.0f,1.0f,GenTexture::CombineAdd,0);

    // colorize it
    Colorize(baseTex,0xff747d8e,0xfff1feff);

    // Create transform matrix for grid pattern
    Matrix44 m1,m2,m3;
    MatTranslate(m1,-0.5f,-0.5f,0.0f);
    MatScale(m2,3.0f * sSQRT2F,3.0f * sSQRT2F,1.0f);
    MatMult(m3,m2,m1);
    MatRotateZ(m1,0.125f * sPI2F);
    MatMult(m2,m1,m3);
    MatTranslate(m1,0.5f,0.5f,0.0f);
    MatMult(m3,m1,m2);

    // Grid pattern GlowRect
    GenTexture rect1,rect1x,rect1n;
    rect1.Init(256,256);
    rect1.LinearCombine(black,1.0f,0,0); // black background
    rect1.GlowRect(rect1,gradWB,0.5f,0.5f,0.41f,0.0f,0.0f,0.25f,0.7805f,0.64f);

    rect1x.Init(256,256);
    rect1x.CoordMatrixTransform(rect1,m3,GenTexture::WrapU|GenTexture::WrapV|GenTexture::FilterBilinear);

    // Make a normalmap from it
    rect1n.Init(256,256);
    rect1n.Derive(rect1x,GenTexture::DeriveNormals,2.5f);

    // Apply as bump map
    GenTexture finalTex;
    Pixel amb,diff;

    finalTex.Init(256,256);
    amb.Init(0xff101010);
    diff.Init(0xffffffff);
    finalTex.Bump(baseTex,rect1n,0,0,0.0f,0.0f,0.0f,-2.518f,0.719f,-3.10f,amb,diff,sTRUE);

    // Second grid pattern GlowRect
    GenTexture rect2,rect2x;
    rect2.Init(256,256);
    rect2.LinearCombine(white,1.0f,0,0); // white background
    rect2.GlowRect(rect2,gradBW,0.5f,0.5f,0.36f,0.0f,0.0f,0.20f,0.8805f,0.74f);

    rect2x.Init(256,256);
    rect2x.CoordMatrixTransform(rect2,m3,GenTexture::WrapU|GenTexture::WrapV|GenTexture::FilterBilinear);

    // Multiply it over
    finalTex.Paste(finalTex,rect2x,0.0f,0.0f,1.0f,0.0f,0.0f,1.0f,GenTexture::CombineMultiply,0);
  }

  sInt totalTime = timeGetTime() - startTime;
  timeEndPeriod(1);

  printf("%d ms/tex\n",totalTime / 100);

  /*SaveImage(baseTex,"baseTex.tga");
  SaveImage(finalTex,"final.tga");*/

  return 0;
}