niedziela, 3 lutego 2013

Poprawka dla znikających cząsteczek w kodzie Doom'a 3

Here's a patch that fixes the disappearing particles problem in Doom 3 engine. Use this code in idRenderModelStatic::FinishSurfaces() in file renderer/Model.cpp

// if the surface has a deformation, increase the bounds
switch ( surf->shader->Deform() ) {
case DFRM_NONE:
 break;
case DFRM_PARTICLE2: {
  // expand surface bounds to include any emitted particles
  srfTriangles_t *tri = surf->geometry;
  const idDeclParticle *particleSystem = (idDeclParticle *)surf->shader->GetDeformDecl();
  tri->bounds.AddBounds(particleSystem->bounds);
 }
 break;
default: {
  // the amount here is somewhat arbitrary, designed to handle
  // autosprites and flares, but could be done better with exact
  // deformation information.
  // Note that this doesn't handle deformations that are skinned in
  // at run time...
  srfTriangles_t *tri = surf->geometry;
  idVec3 mid = ( tri->bounds[1] + tri->bounds[0] ) * 0.5f;
  float radius = ( tri->bounds[0] - mid ).Length();
  radius += 20.0f;
 
  tri->bounds[0][0] = mid[0] - radius;
  tri->bounds[0][1] = mid[1] - radius;
  tri->bounds[0][2] = mid[2] - radius;
 
  tri->bounds[1][0] = mid[0] + radius;
  tri->bounds[1][1] = mid[1] + radius;
  tri->bounds[1][2] = mid[2] + radius;
 }
 break;
}

Link to entry in the The Dark Mod  issue tracker: http://bugs.thedarkmod.com/view.php?id=3278

poniedziałek, 1 sierpnia 2011

NTFS Streams tab in file properties

Here's an interesting article about NTFS streams:
http://www.forensicfocus.com/dissecting-ntfs-hidden-streams

The most interesting part is a DLL that adds a "Streams" tab to file properties:

Just download a Visual Studio project from here (self-extracting archive):
http://download.microsoft.com/download/F/C/6/FC6943EB-790A-44AA-B32D-14ED7E22FD5D/NTFSExt.exe
Compile it, and copy resulting StrmExt.dll to Windows\System32 folder along with two scripts: HardLinks.vbs and RWStream.vbs (found in ReleaseMinDependency folder) and then run:

regsvr32 StrmExt.dll

Done!

If you have trouble compiling the project comment out following lines in StdAfx.h:
//#ifndef _WIN32_WINNT
//#define _WIN32_WINNT 0x0400
//#endif

In case you are using 64 bit Windows: create x64 platform configuration and copy settings from Win32 configuration. Compile x64 version (StrmExt.dll still goes to Windows\System32 folder).

wtorek, 1 grudnia 2009

Test Wiritera i VSPaste

public class ParamRule
{
public string Name;
public SemanticDesc SemanticDesc;
public ParamRule(string name, SemanticDesc semanticDesc)
{
Name = name;
SemanticDesc = semanticDesc;
}
}
I co? Działa.

Online RegEx and JSON tools

Here's an online regular expressions editor: RegExr
And here's an online JSON formatter: JSON Formatter

niedziela, 22 listopada 2009

Perl, Ruby, Python Cookbook

There are cookbooks for almost any language here: PLEAC - Cookbooks

For example:
Ruby Cookbook
Python Cookbook
Perl Cookbook
C++ Cookbook

The Python Tutorial - often more helpful than library reference et. al. (i.e. Chapter 7: Input and Output).

sobota, 21 listopada 2009

Mozilla plugins refresh and stuff

To verify that Mozilla is aware of new .xpt files, you can look in the generated file, xpti.dat, where type libraries are listed. If you need to, you can call navigator.plugins.refresh() to find new XPT files and plug-in software.

Plug-in developers might find it useful for debugging purposes to turn off the exception catching mechanism currently implemented in Mozilla on Windows. To turn off Windows exception handling, add the following line into your prefs.js file: user_pref("plugin.dont_try_safe_calls", true);

wtorek, 17 listopada 2009

Mozilla Source Code Directory Structure

Dirctory structure: Mozilla Source Code Directory Structure
Another: Source code directories overview

Interesting:

browser - Firefox

xulrunner - xulrunner

widget - a cross-platform API, with implementations on each platform, for dealing with operating system/environment widgets, i.e., code related to creation and handling of windows, popups, and other native widgets and to converting the system's messages related to painting and events into the messages used by other parts of Mozilla (e.g. view/ and content/, the latter of which converts many of the messages to yet another API, the DOM event API).

gfx - contains interfaces that abstract the capabilities of platform specific graphics toolkits, along with implementations on various platforms. These interfaces provide methods for things like drawing images, text, and basic shapes. It also contains basic data structures such as points and rectangles used here and in other parts of Mozilla.
It is also the home of the new graphics architecture based on cairo (via a C++ wrapper called thebes). See NewGFXAPIs and GFXEvolution.


Not so interesting:

view - view manager. Contains cross-platform code used for painting, scrolling, event handling, z-ordering, and opacity. Soon to become obsolete, gradually.

docshell - Implementation of the docshell, the main object managing things related to a document window. Each frame has its own docshell. Contains methods for loading URIs, managing URI content listeners, etc. It is the outermost layer of the embedding API used to embed a Gecko browser into an application.

webshell - Mostly obsolete, and being merged into docshell/.

IRC: irc.mozilla.org, channel #developers